From 2eac854fb7f2f3e8a914b461dacb916c01bbcbf1 Mon Sep 17 00:00:00 2001 From: modmuss50 Date: Sun, 22 Jan 2023 13:23:19 +0000 Subject: [PATCH] Add a test for cross project access widenerners --- .../groovy/net/fabricmc/loom/test/LoomTestConstants.groovy | 4 ++-- src/test/resources/projects/multiproject/core/build.gradle | 4 ++++ .../multiproject/core/src/main/resources/core.accesswidener | 3 +++ .../multiproject/core/src/main/resources/fabric.mod.json | 3 ++- .../src/main/java/net/fabricmc/example/ExampleMod.java | 5 +++++ 5 files changed, 16 insertions(+), 3 deletions(-) create mode 100644 src/test/resources/projects/multiproject/core/src/main/resources/core.accesswidener diff --git a/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy b/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy index 83e23162..888bc32e 100644 --- a/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy +++ b/src/test/groovy/net/fabricmc/loom/test/LoomTestConstants.groovy @@ -27,13 +27,13 @@ package net.fabricmc.loom.test import org.gradle.util.GradleVersion class LoomTestConstants { - private final static String NIGHTLY_VERSION = "8.1-20230109232704+0000" + private final static String NIGHTLY_VERSION = "8.1-20230119104422+0000" private final static boolean NIGHTLY_EXISTS = nightlyExists(NIGHTLY_VERSION) // Test against the version of Gradle being used to build loom public final static String DEFAULT_GRADLE = GradleVersion.current().getVersion() // Test against Gradle 8 - public final static String GRADLE_8 = "8.0-rc-1" + public final static String GRADLE_8 = "8.0-rc-2" // Tests that depend specifically on the nightly will run on the current version when the nightly is not available. public final static String PRE_RELEASE_GRADLE = NIGHTLY_EXISTS ? NIGHTLY_VERSION : DEFAULT_GRADLE // Randomly sorted to ensure that all versions can run with a clean gradle home. diff --git a/src/test/resources/projects/multiproject/core/build.gradle b/src/test/resources/projects/multiproject/core/build.gradle index 652eb359..8e774da8 100644 --- a/src/test/resources/projects/multiproject/core/build.gradle +++ b/src/test/resources/projects/multiproject/core/build.gradle @@ -1,5 +1,9 @@ archivesBaseName = "core" +loom { + accessWidenerPath = file("src/main/resources/core.accesswidener") +} + dependencies { // An example api dep to be used by the other sub project. modApi "TechReborn:TechReborn-1.16:3.8.4+build.236" diff --git a/src/test/resources/projects/multiproject/core/src/main/resources/core.accesswidener b/src/test/resources/projects/multiproject/core/src/main/resources/core.accesswidener new file mode 100644 index 00000000..d1d479de --- /dev/null +++ b/src/test/resources/projects/multiproject/core/src/main/resources/core.accesswidener @@ -0,0 +1,3 @@ +accessWidener v2 named + +transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionType (Lnet/minecraft/item/Item;)V \ No newline at end of file diff --git a/src/test/resources/projects/multiproject/core/src/main/resources/fabric.mod.json b/src/test/resources/projects/multiproject/core/src/main/resources/fabric.mod.json index bcd09423..f68511a1 100644 --- a/src/test/resources/projects/multiproject/core/src/main/resources/fabric.mod.json +++ b/src/test/resources/projects/multiproject/core/src/main/resources/fabric.mod.json @@ -34,5 +34,6 @@ "loom:injected_interfaces": { "net/minecraft/class_2248": ["net/fabricmc/core/InjectedInterface"] } - } + }, + "accessWidener" : "core.accesswidener" } diff --git a/src/test/resources/projects/multiproject/example/src/main/java/net/fabricmc/example/ExampleMod.java b/src/test/resources/projects/multiproject/example/src/main/java/net/fabricmc/example/ExampleMod.java index 6a4f50a9..c2936483 100644 --- a/src/test/resources/projects/multiproject/example/src/main/java/net/fabricmc/example/ExampleMod.java +++ b/src/test/resources/projects/multiproject/example/src/main/java/net/fabricmc/example/ExampleMod.java @@ -5,6 +5,8 @@ import net.minecraft.block.BlockState; import techreborn.blocks.cable.CableShapeUtil; import net.minecraft.util.shape.VoxelShape; import net.minecraft.block.Blocks; +import net.minecraft.recipe.BrewingRecipeRegistry; +import net.minecraft.item.Items; public class ExampleMod implements ModInitializer { @Override @@ -22,6 +24,9 @@ public class ExampleMod implements ModInitializer { // Interface is injected by another project that we are depending on. Blocks.AIR.newMethodThatDidNotExist(); + + // Method has a transitive AW in the core project. + BrewingRecipeRegistry.registerPotionType(Items.DIAMOND); } } }