diff --git a/common/build.gradle b/common/build.gradle index c9056d5..86c9030 100644 --- a/common/build.gradle +++ b/common/build.gradle @@ -10,8 +10,17 @@ base { } neoForge { - neoFormVersion = "1.21.4-20241203.161809" - + neoFormVersion = "${neoform_version}" + // Automatically enable AccessTransformers if the file exists + // While this location can be changed, it is recommended for + // common and neoforge to share an accesstransformer file + // and this location is hardcoded in FML + // https://github.com/neoforged/FancyModLoader/blob/a952595eaaddd571fbc53f43847680b00894e0c1/loader/src/main/java/net/neoforged/fml/loading/moddiscovery/ModFile.java#L118 + def at = file('src/main/resources/META-INF/accesstransformer.cfg') + if (at.exists()) { + accessTransformers.add(at.absolutePath) + } + addModdingDependenciesTo(sourceSets["test"]) parchment { minecraftVersion = "${parchment_minecraft_version}" mappingsVersion = "${parchment_mapping_version}" @@ -20,9 +29,9 @@ neoForge { dependencies { compileOnly "net.fabricmc:sponge-mixin:${mixin_version}" - annotationProcessor("io.github.llamalad7:mixinextras-common:${mixinextras_version}") - compileOnly group: 'org.spongepowered', name: 'mixin', version: '0.8.5' - implementation group: 'com.google.code.findbugs', name: 'jsr305', version: '3.0.1' + // fabric and neoforge both bundle mixinextras, so it is safe to use it in common + compileOnly group: 'io.github.llamalad7', name: 'mixinextras-common', version: "${mixinextras_version}" + annotationProcessor group: 'io.github.llamalad7', name: 'mixinextras-common', version: "${mixinextras_version}" } publishing { diff --git a/fabric/build.gradle b/fabric/build.gradle index 1271bda..63a0326 100644 --- a/fabric/build.gradle +++ b/fabric/build.gradle @@ -21,6 +21,7 @@ repositories { includeGroup "com.terraformersmc" } } + mavenLocal() } dependencies { diff --git a/forge/build.gradle b/forge/build.gradle index e00b9a3..cff1115 100644 --- a/forge/build.gradle +++ b/forge/build.gradle @@ -16,6 +16,9 @@ if (file('src/main/resources/META-INF/accesstransformer.cfg').exists()) { minecraft.accessTransformers.file file('src/main/resources/META-INF/accesstransformer.cfg') } +configurations { + testmodImplementation.extendsFrom implementation +} neoForge { version = "${neo_version}" @@ -24,6 +27,13 @@ neoForge { mappingsVersion = "${parchment_mapping_version}" } + // Automatically enable neoforge AccessTransformers if the file exists + def at = project(':common').file('src/main/resources/META-INF/accesstransformer.cfg') + if (at.exists()) { + accessTransformers.add(at.absolutePath) + } + addModdingDependenciesTo(sourceSets["test"]) + runs { configureEach { gameDirectory = project.file('../run') @@ -46,6 +56,7 @@ neoForge { mods { "${mod_id}" { sourceSet sourceSets.main + sourceSet sourceSets.test } } } @@ -74,6 +85,10 @@ tasks.withType(ProcessResources).matching(notNeoTask).configureEach { from project(":common").sourceSets.main.resources } +//tasks.named("compileTestJava").configure { +// enabled = false +//} + publishing { publications { mavenJava(MavenPublication) {