diff options
Diffstat (limited to 'build.gradle.kts')
-rw-r--r-- | build.gradle.kts | 91 |
1 files changed, 28 insertions, 63 deletions
diff --git a/build.gradle.kts b/build.gradle.kts index 3a72ed0..c8bdfdb 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -6,6 +6,7 @@ * SPDX-License-Identifier: GPL-3.0-or-later */ +import com.github.jengelman.gradle.plugins.shadow.tasks.ShadowJar import com.google.common.hash.Hashing import com.google.devtools.ksp.gradle.KspAATask import com.google.gson.Gson @@ -27,15 +28,15 @@ plugins { alias(libs.plugins.kotlin.plugin.powerassert) alias(libs.plugins.kotlin.plugin.ksp) // alias(libs.plugins.loom) + alias(libs.plugins.shadow) apply false // TODO: use arch loom once they update to 1.8 id("fabric-loom") version "1.10.1" - alias(libs.plugins.shadow) - id("moe.nea.licenseextractificator") + id("firmament.common") + id("firmament.license-management") alias(libs.plugins.mcAutoTranslations) } version = getGitTagInfo(libs.versions.minecraft.get()) -group = rootProject.property("maven_group").toString() java { withSourcesJar() @@ -43,6 +44,7 @@ java { languageVersion.set(JavaLanguageVersion.of(21)) } } + loom { mixin.useLegacyMixinAp.set(false) } @@ -53,54 +55,6 @@ tasks.withType(KotlinCompile::class) { } } -allprojects { - repositories { - mavenCentral() - maven("https://maven.terraformersmc.com/releases/") - maven("https://maven.shedaniel.me") - maven("https://maven.fabricmc.net") - maven("https://pkgs.dev.azure.com/djtheredstoner/DevAuth/_packaging/public/maven/v1") - maven("https://api.modrinth.com/maven") { - content { - includeGroup("maven.modrinth") - } - } - maven("https://repo.sleeping.town") { - content { - includeGroup("com.unascribed") - } - } - ivy("https://github.com/HotswapProjects/HotswapAgent/releases/download") { - patternLayout { - artifact("[revision]/[artifact]-[revision].[ext]") - } - content { - includeGroup("virtual.github.hotswapagent") - } - metadataSources { - artifact() - } - } - maven("https://server.bbkr.space/artifactory/libs-release") - maven("https://repo.nea.moe/releases") - maven("https://maven.notenoughupdates.org/releases") - maven("https://repo.nea.moe/mirror") - maven("https://jitpack.io/") { - content { - includeGroupByRegex("(com|io)\\.github\\..+") - excludeModule("io.github.cottonmc", "LibGui") - } - } - maven("https://repo.hypixel.net/repository/Hypixel/") - maven("https://maven.azureaaron.net/snapshots") - maven("https://maven.azureaaron.net/releases") - maven("https://www.cursemaven.com") - maven("https://maven.isxander.dev/releases") { - name = "Xander Maven" - } - mavenLocal() - } -} kotlin { sourceSets.all { languageSettings { @@ -130,6 +84,9 @@ val collectTranslations by tasks.registering(CollectTranslations::class) { this.classes.from(sourceSets.main.get().kotlin.classesDirectory) } +val shadowJar = tasks.register("shadowJar", ShadowJar::class) +val mergedSourceSetsJar = tasks.register("mergedSourceSetsJar", ShadowJar::class) + val compatSourceSets: MutableSet<SourceSet> = mutableSetOf() fun createIsolatedSourceSet(name: String, path: String = "compat/$name", isEnabled: Boolean = true): SourceSet { val ss = sourceSets.create(name) { @@ -178,7 +135,7 @@ fun createIsolatedSourceSet(name: String, path: String = "compat/$name", isEnabl (ss.implementationConfigurationName)(project.files(tasks.compileKotlin.map { it.destinationDirectory })) (ss.implementationConfigurationName)(project.files(tasks.compileJava.map { it.destinationDirectory })) } - tasks.shadowJar { + mergedSourceSetsJar.configure { from(ss.output) } // TODO: figure out why inheritances are not being respected by tiny kotlin names @@ -268,8 +225,7 @@ dependencies { nonModImplentation("com.google.auto.service:auto-service-annotations:1.1.1") ksp("dev.zacsweers.autoservice:auto-service-ksp:1.2.0") include(libs.manninghamMills) - include(libs.moulconfig) - + shadowMe(libs.moulconfig) annotationProcessor(libs.mixinextras) nonModImplentation(libs.mixinextras) @@ -437,22 +393,33 @@ tasks.jar { destinationDirectory.set(layout.buildDirectory.dir("badjars")) archiveClassifier.set("slim") } - -tasks.shadowJar { +mergedSourceSetsJar.configure { + from(zipTree(tasks.jar.flatMap { it.archiveFile })) + destinationDirectory.set(layout.buildDirectory.dir("badjars")) + archiveClassifier.set("merged-source-sets") + mergeServiceFiles() +} +shadowJar.configure { + from(zipTree(tasks.remapJar.flatMap { it.archiveFile })) configurations = listOf(shadowMe) - archiveClassifier.set("dev") + archiveClassifier.set("") relocate("io.github.moulberry.repo", "moe.nea.firmament.deps.repo") - destinationDirectory.set(layout.buildDirectory.dir("badjars")) + relocate("io.github.notenoughupdates.moulconfig", "moe.nea.firmament.deps.moulconfig") mergeServiceFiles() + transform<FabricModTransform>() } tasks.remapJar { // injectAccessWidener.set(true) - inputFile.set(tasks.shadowJar.flatMap { it.archiveFile }) - dependsOn(tasks.shadowJar) - archiveClassifier.set("") + inputFile.set(mergedSourceSetsJar.flatMap { it.archiveFile }) + dependsOn(mergedSourceSetsJar) + destinationDirectory.set(layout.buildDirectory.dir("badjars")) + archiveClassifier.set("remapped") } +tasks.assemble { dependsOn(shadowJar) } + + tasks.processResources { val replacements = listOf( "version" to project.version.toString(), @@ -552,5 +519,3 @@ tasks.withType<AbstractArchiveTask>().configureEach { isPreserveFileTimestamps = false isReproducibleFileOrder = true } - -licensing.addExtraLicenseMatchers() |