Files
distant-horizons-sharded/forge/build.gradle
T
2022-08-25 17:50:10 +06:00

127 lines
3.6 KiB
Groovy

version = rootProject.versionStr
loom {
forge {
convertAccessWideners.set(true)
extraAccessWideners.add("lod.accesswidener")
mixinConfigs("DistantHorizons.mixins.json")
}
}
architectury {
platformSetupLoomIde()
forge()
}
loom {
accessWidenerPath = project(":common").loom.accessWidenerPath
forge {
convertAccessWideners = true
extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
}
}
configurations {
common
shadowCommon // Don't use shadow from the shadow plugin because we don't want IDEA to index this.
compileClasspath.extendsFrom common
runtimeClasspath.extendsFrom common
developmentForge.extendsFrom common
}
def addMod(path, enabled) {
if (enabled == "2")
dependencies { modImplementation(path) }
else if (enabled == "1")
dependencies { modCompileOnly(path) }
}
dependencies {
// Forge loader
forge "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
// Architectury API
if (minecraft_version == "1.16.5") {
modImplementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}")
} else {
modImplementation("dev.architectury:architectury-forge:${rootProject.architectury_version}")
}
// Starlight
addMod("curse.maven:starlight-forge-526854:${rootProject.starlight_version_forge}", rootProject.enable_starlight_forge)
annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
addMod("curse.maven:TerraForged-363820:${rootProject.terraforged_version}", rootProject.enable_terraforged)
common(project(path: ":common", configuration: "namedElements")) { transitive false }
shadowCommon(project(path: ":common", configuration: "transformProductionForge")) { transitive false }
}
processResources {
dependsOn(copyCoreResources)
}
shadowJar {
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule]
// Compression
relocate 'org.tukaani', 'distanthorizons.libraries.tukaani'
relocate 'org.apache.commons.compress', 'distanthorizons.libraries.apache.commons.compress'
// Toml & Json for config
relocate 'com.electronwill.nightconfig', 'distanthorizons.libraries.electronwill.nightconfig'
// FIXME: This is a massive library that is located in lots of different spots
relocate 'com.googlecode.json-simple', 'distanthorizons.libraries.googlecode.json-simple'
relocate 'org.json.simple', 'distanthorizons.libraries.json.simple'
// Theming
relocate 'com.formdev.flatlaf', 'distanthorizons.libraries.formdev.flatlaf'
// svg
relocate 'com.kitfox.svg', 'distanthorizons.libraries.kitfox.svg'
classifier "dev-shadow"
mergeServiceFiles()
}
remapJar {
input.set shadowJar.archiveFile
dependsOn shadowJar
classifier null
}
jar {
classifier "dev"
}
sourcesJar {
def commonSources = project(":common").sourcesJar
dependsOn commonSources
from commonSources.archiveFile.map { zipTree(it) }
}
components.java {
withVariantsFromConfiguration(project.configurations.shadowRuntimeElements) {
skip()
}
}
publishing {
publications {
mavenForge(MavenPublication) {
artifactId = rootProject.archives_base_name + "-" + project.name
from components.java
}
}
// See https://docs.gradle.org/current/userguide/publishing_maven.html for information on how to set up publishing.
repositories {
// Add repositories to publish to here.
}
}