Files
distant-horizons-sharded/forge/build.gradle
T

197 lines
6.6 KiB
Groovy

buildscript {
repositories {
maven { url = "https://maven.minecraftforge.net" }
maven { url = "https://maven.parchmentmc.org" }
maven { url = "https://repo.spongepowered.org/repository/maven-public/" }
mavenCentral()
}
dependencies {
classpath group: "net.minecraftforge.gradle", name: "ForgeGradle", version: "5.1.+", changing: true
classpath "org.parchmentmc:librarian:1.+"
classpath "org.spongepowered:mixingradle:0.7-SNAPSHOT"
}
}
apply plugin: "net.minecraftforge.gradle"
apply plugin: "org.parchmentmc.librarian.forgegradle"
apply plugin: "org.spongepowered.mixin"
// TODO: Check accessWidener works fine
mixin {
add sourceSets.main, "DistantHorizons.refmap.json"
config "DistantHorizons.mixins.json"
}
minecraft {
// mappings channel: "official", version: minecraft_version // Vanilla mappings
mappings channel: "parchment", version: "${parchment_version}-${minecraft_version}" // Parchment mappings
accessTransformer = project(":forge").file("src/main/resources/META-INF/accesstransformer.cfg") // FIXME: Find a libary to use fabric's accessWidener instead of forge's own accesstransformer format
runs {
client {
workingDirectory project.file("run")
ideaModule "${rootProject.name}.${project.name}.main"
taskName "Client"
args "-mixins.config=DistantHorizons.mixins.json"
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":common").sourceSets.main
source project(":core").sourceSets.main
source project(":api").sourceSets.main
}
}
}
// TODO: Do this once client works
// server {
// workingDirectory project.file("run")
// ideaModule "${rootProject.name}.${project.name}.main"
// taskName "Server"
// args "-mixins.config=DistantHorizons.mixins.json"
// }
data {
workingDirectory project.file("run")
ideaModule "${rootProject.name}.${project.name}.main"
args '--mod', "lod", '--all', '--output', file('src/generated/resources/'), '--existing', file('src/main/resources/')
taskName 'Data'
args "-mixins.config=DistantHorizons.mixins.json" // To add more mixins, you can just add a comma for another arg
property 'mixin.env.remapRefMap', 'true'
property 'mixin.env.refMapRemappingFile', "${projectDir}/build/createSrgToMcp/output.srg"
mods {
modClientRun {
source sourceSets.main
source project(":common").sourceSets.main
source project(":core").sourceSets.main
source project(":api").sourceSets.main
}
}
}
}
}
// TODO: Check if the next 7 lines are necessary
sourceSets.main.resources.srcDir "src/generated/resources"
minecraft.runs.all {
lazyToken('minecraft_classpath') {
configurations.library.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
configurations.runtimeLibrary.copyRecursive().resolve().collect { it.absolutePath }.join(File.pathSeparator)
}
}
//loom {
// forge {
// convertAccessWideners.set(true)
// extraAccessWideners.add("lod.accesswidener")
// mixinConfigs("DistantHorizons.mixins.json")
// }
//}
//loom {
// accessWidenerPath = project(":common").loom.accessWidenerPath
//
// forge {
// convertAccessWideners = true
// extraAccessWideners.add loom.accessWidenerPath.get().asFile.name
// }
//}
def addMod(path, enabled) {
if (enabled == "2")
dependencies { implementation(path) }
else if (enabled == "1")
dependencies { modCompileOnly(path) }
}
dependencies {
// Forge loader
minecraft "net.minecraftforge:forge:${rootProject.minecraft_version}-${rootProject.forge_version}"
// Architectury API
// if (minecraft_version == "1.16.5") {
// implementation("me.shedaniel:architectury-forge:${rootProject.architectury_version}")
// } else {
// implementation("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)
if (System.getProperty("idea.sync.active") != "true") {
annotationProcessor "org.spongepowered:mixin:0.8.4:processor"
}
common(project(path: ":common")) { transitive false }
shadowCommon(project(path: ":common")) { transitive false }
shadowMe(project(path: ":core")) { transitive false }
shadowMe(project(path: ":api")) { transitive false }
}
processResources {
dependsOn(copyCoreResources)
dependsOn(copyAccessWidener)
}
shadowJar {
exclude "architectury.common.json"
configurations = [project.configurations.shadowCommon, project.configurations.shadowMe, project.configurations.customModule]
relocate "om.seibel.lod.common", "loaderCommon.forge.com.seibel.lod.common"
// Compression
relocate "org.tukaani", "distanthorizons.libraries.tukaani"
// NightConfig (includes Toml & Json)
relocate "com.electronwill.nightconfig", "distanthorizons.libraries.electronwill.nightconfig"
// Theming
relocate "com.formdev.flatlaf", "distanthorizons.libraries.formdev.flatlaf"
// svg
relocate "com.kitfox.svg", "distanthorizons.libraries.kitfox.svg"
mergeServiceFiles()
}
//remapJar {
// input.set shadowJar.archiveFile
// dependsOn shadowJar
// classifier null
//}
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.mod_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.
}
}