Add a test for cross project access widenerners

This commit is contained in:
modmuss50
2023-01-22 13:23:19 +00:00
parent 0d609502fa
commit 2eac854fb7
5 changed files with 16 additions and 3 deletions

View File

@@ -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.

View File

@@ -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"

View File

@@ -0,0 +1,3 @@
accessWidener v2 named
transitive-accessible method net/minecraft/recipe/BrewingRecipeRegistry registerPotionType (Lnet/minecraft/item/Item;)V

View File

@@ -34,5 +34,6 @@
"loom:injected_interfaces": {
"net/minecraft/class_2248": ["net/fabricmc/core/InjectedInterface"]
}
}
},
"accessWidener" : "core.accesswidener"
}

View File

@@ -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);
}
}
}