From 7841efed5410808719826cd19c47039dee2aeb89 Mon Sep 17 00:00:00 2001 From: Brian Neumann-Fopiano Date: Tue, 8 Sep 2026 03:41:15 -0400 Subject: [PATCH] Run modded and buildSrc tests - Add a root moddedTest that runs adapters/modded-common through the Fabric build - Make check depend on moddedTest, ordered ahead of the loader jars - Gate the buildSrc jar on the buildSrc tests so they stop being skipped - Drop an unreachable classpath guard from SchemaBuilderPlatformIsolationTest --- .../SchemaBuilderPlatformIsolationTest.java | 3 -- build.gradle | 50 +++++++++++++++++++ buildSrc/build.gradle | 6 +++ 3 files changed, 56 insertions(+), 3 deletions(-) diff --git a/adapters/modded-common/src/test/java/art/arcane/iris/modded/SchemaBuilderPlatformIsolationTest.java b/adapters/modded-common/src/test/java/art/arcane/iris/modded/SchemaBuilderPlatformIsolationTest.java index 42d763ab5..e58411058 100644 --- a/adapters/modded-common/src/test/java/art/arcane/iris/modded/SchemaBuilderPlatformIsolationTest.java +++ b/adapters/modded-common/src/test/java/art/arcane/iris/modded/SchemaBuilderPlatformIsolationTest.java @@ -13,13 +13,10 @@ import java.util.ArrayList; import java.util.List; import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertThrows; public class SchemaBuilderPlatformIsolationTest { @Test public void enumSchemaDoesNotResolveBukkitOnlyMethodSignatures() { - assertThrows(ClassNotFoundException.class, () -> Class.forName("org.bukkit.block.BlockFace")); - JSONObject schema = new SchemaBuilder(DirectionModel.class, null).construct(); JSONObject direction = schema.getJSONObject("properties").getJSONObject("direction"); String definitionKey = direction.getString("$ref").substring("#/definitions/".length()); diff --git a/build.gradle b/build.gradle index 116b4ee87..cac409c7f 100644 --- a/build.gradle +++ b/build.gradle @@ -446,6 +446,56 @@ tasks.named('neoforgeJar').configure { mustRunAfter(tasks.named('forgeJar')) } +// adapters/modded-common has no build of its own: its sources are compiled by each loader wrapper, so +// its tests only run when one of those wrappers is asked for `test`. The Fabric wrapper is the one +// that runs them as plain JUnit - NeoForge's moddev unit-test harness boots the mod through FML's +// transforming class loader and dies on a split-package ServiceConfigurationError before any test +// starts. One loader is enough: the sources are identical across all three. +tasks.register('moddedTest', Exec) { + group = 'verification' + description = 'Runs the adapters/modded-common test suite through the Fabric adapter build.' + workingDir = layout.projectDirectory.dir('adapters/fabric').asFile + String wrapperScript = System.getProperty('os.name').toLowerCase().contains('windows') ? 'gradlew.bat' : 'gradlew' + List command = [ + layout.projectDirectory.file(wrapperScript).asFile.absolutePath, + 'test', + '--console=plain', + "-PirisVersion=${project.version}", + "-PminecraftVersion=${minecraftVersion}", + "-PfabricLoaderVersion=${fabricLoaderVersion}", + "-PuseLocalVolmLib=${useLocalVolmLib}", + "-PvolmLibCoordinate=${volmLibCoordinate}" + ] + if (localVolmLibDirectory != null && !localVolmLibDirectory.isBlank()) { + command.add("-PlocalVolmLibDirectory=${localVolmLibDirectory}") + } + commandLine(command) + inputs.files(moddedSharedInputs).withPropertyName('moddedSharedSources') + inputs.files( + layout.projectDirectory.file('adapters/fabric/src').asFile, + layout.projectDirectory.file('adapters/fabric/build.gradle').asFile, + layout.projectDirectory.file('adapters/fabric/settings.gradle').asFile + ).withPropertyName('adapterSources') + inputs.property('irisVersion', project.version.toString()) + inputs.property('minecraftVersion', minecraftVersion) + inputs.property('fabricLoaderVersion', fabricLoaderVersion) + inputs.property('useLocalVolmLib', useLocalVolmLib) + inputs.property('volmLibCoordinate', volmLibCoordinate) + inputs.property('localVolmLibCheckout', localVolmLibCheckout == null ? '' : localVolmLibCheckout.absolutePath) + outputs.dir(layout.projectDirectory.dir('adapters/fabric/build/test-results/test')) + mustRunAfter(tasks.named('jar')) + mustRunAfter(project(':core').tasks.named('check')) + mustRunAfter(project(':spi').tasks.named('jar')) +} + +tasks.named('fabricJar').configure { + mustRunAfter(tasks.named('moddedTest')) +} + +tasks.named('check').configure { + dependsOn('moddedTest') +} + List commonModdedArtifactEntries = [ 'META-INF/iris/generation-kernels/catalog.tsv', 'META-INF/iris/generation-kernels/abi-1.revision', diff --git a/buildSrc/build.gradle b/buildSrc/build.gradle index 1f878dab1..0270c1deb 100644 --- a/buildSrc/build.gradle +++ b/buildSrc/build.gradle @@ -18,6 +18,12 @@ repositories { } } +// Nothing else asks buildSrc for `test`: Gradle only requests the jar that carries the build logic. +// Gating the jar on the tests is what makes them run at all, and it costs nothing once they are green. +tasks.named('jar').configure { + dependsOn(tasks.named('test')) +} + dependencies { implementation(gradleApi()) implementation('org.ow2.asm:asm:9.10.1')