From 2e758d624353dbb4077bb5761503983405c94eca Mon Sep 17 00:00:00 2001 From: dhyces <10985914+dhyces@users.noreply.github.com> Date: Sat, 23 Dec 2023 16:59:29 -0800 Subject: [PATCH] Fix forge weirdness, add publishers, cleanup Had the most frustrating experience with JIJ. Apparently, using the version catalog MinimalExternalModuleDependency does not work with the extension block added to the outside implementation config. It has to be added on jarJar. Works fine if it's a String though. Also had fun with mappings, forgot to tell it that it was using namedElements. Other cleanup, adding configureEach, copyIdeResources, test config extends compileOnly, etc. --- Forge/build.gradle | 42 ++++++++++++++++-------------------------- Neo/build.gradle | 22 ++-------------------- 2 files changed, 18 insertions(+), 46 deletions(-) diff --git a/Forge/build.gradle b/Forge/build.gradle index 1da014b6..660ebe91 100644 --- a/Forge/build.gradle +++ b/Forge/build.gradle @@ -2,12 +2,20 @@ plugins { id 'idea' id 'java' id 'maven-publish' + alias libs.plugins.curseforgegradle + alias libs.plugins.minotaur alias libs.plugins.forgegradle alias libs.plugins.librarian alias libs.plugins.mixingradle } -archivesBaseName = "${mod_id}-forge-${libs.versions.minecraft}" +base { + archivesName = "${mod_id}-forge-${libs.versions.minecraft.release.get()}" +} + +configurations { + testCompileOnly.extendsFrom(compileOnly) +} sourceSets { main @@ -23,6 +31,8 @@ minecraft { accessTransformer = file('src/main/resources/META-INF/accesstransformer.cfg') + copyIdeResources = true + runs { client { workingDirectory file('run') @@ -80,11 +90,11 @@ dependencies { minecraft libs.forge compileOnly(annotationProcessor(libs.mixinextras.common.get())) - implementation(jarJar(libs.mixinextras.forge.get())) { + implementation(jarJar(libs.mixinextras.forge.get()) { jarJar.ranged(it, "[${libs.versions.mixinextras.get()},)") - } + }) - compileOnly(project(":Common")) + compileOnly(project(path: ":Common", configuration: "namedElements")) annotationProcessor "${libs.sponge.mixin.get()}:processor" } @@ -104,7 +114,7 @@ tasks.withType(JavaCompile).configureEach { it.options.release = 17 } -tasks.withType(GenerateModuleMetadata) { +tasks.withType(GenerateModuleMetadata).configureEach { enabled = false } @@ -119,7 +129,7 @@ java { } } -tasks.withType(JavaCompile) { +tasks.withType(JavaCompile).configureEach { source(project(":Common").sourceSets.main.allSource) } @@ -128,26 +138,6 @@ processResources { exclude("trimmed.accesswidener") } -jar { - from(rootProject.file("LICENSE")) { - rename { "${it}_${mod_id}" } - } - manifest { - attributes([ - 'Specification-Title' : mod_id, - 'Specification-Vendor' : mod_author, - 'Specification-Version' : project.jar.archiveVersion, - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_author, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Timestamp' : System.currentTimeMillis(), - 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On-Minecraft' : libs.versions.minecraft.release - ]) - } -} - tasks.named('publish').configure { dependsOn 'reobfJar' } diff --git a/Neo/build.gradle b/Neo/build.gradle index c1a6a2e9..0c14b616 100644 --- a/Neo/build.gradle +++ b/Neo/build.gradle @@ -2,6 +2,8 @@ plugins { id 'idea' id 'java' id 'maven-publish' + alias libs.plugins.curseforgegradle + alias libs.plugins.minotaur alias libs.plugins.archloom } @@ -78,26 +80,6 @@ processResources { exclude("trimmed.accesswidener") } -jar { - from(rootProject.file("LICENSE")) { - rename { "${it}_${mod_id}" } - } - manifest { - attributes([ - 'Specification-Title' : mod_id, - 'Specification-Vendor' : mod_author, - 'Specification-Version' : project.jar.archiveVersion, - 'Implementation-Title' : project.name, - 'Implementation-Version' : project.jar.archiveVersion, - 'Implementation-Vendor' : mod_author, - 'Implementation-Timestamp': new Date().format("yyyy-MM-dd'T'HH:mm:ssZ"), - 'Timestamp' : System.currentTimeMillis(), - 'Built-On-Java' : "${System.getProperty('java.vm.version')} (${System.getProperty('java.vm.vendor')})", - 'Built-On-Minecraft' : libs.versions.minecraft.release - ]) - } -} - publishing { publications { register('mavenJava', MavenPublication) {