Add Mixin audit unit test for Fabric

Doing this for NeoForge may need to wait until we build using ModDevGradle
This commit is contained in:
Jason Penilla
2024-11-23 22:35:39 -07:00
parent 73d73c935a
commit 43164acf5e
3 changed files with 36 additions and 0 deletions

View File

@@ -57,6 +57,10 @@ allprojects {
}
}
tasks.test {
useJUnitPlatform()
}
repositories {
mavenLocal {
mavenContent {

View File

@@ -1,3 +1,6 @@
import java.util.stream.Collectors
import net.fabricmc.loom.util.gradle.SourceSetHelper
plugins {
id("quiet-fabric-loom")
id 'maven-publish'
@@ -7,6 +10,7 @@ dependencies {
minecraft "com.mojang:minecraft:${project.minecraft_version}"
mappings loom.officialMojangMappings()
modImplementation "net.fabricmc:fabric-loader:${project.loader_version}"
testImplementation "net.fabricmc:fabric-loader-junit:${project.loader_version}"
runtimeOnly(project(":").sourceSets.main.output)
shadow(project(":"))
@@ -48,6 +52,14 @@ tasks.shadowJar {
relocate 'org.yaml.snakeyaml', 'ca.spottedleaf.moonrise.libs.org.yaml.snakeyaml'
}
tasks.test {
def classPathGroups = SourceSetHelper.getClasspath(loom.mods.main, getProject()).stream()
.map(File.&getAbsolutePath)
.collect(Collectors.joining(File.pathSeparator))
systemProperty("fabric.classPathGroups", classPathGroups)
}
publishMods {
file = remapJar.archiveFile
modLoaders = ["fabric"]

View File

@@ -0,0 +1,20 @@
package ca.spottedleaf.moonrise.fabric;
import net.minecraft.SharedConstants;
import net.minecraft.server.Bootstrap;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import org.spongepowered.asm.mixin.MixinEnvironment;
public class MixinAuditTest {
@BeforeAll
static void beforeAll() {
SharedConstants.tryDetectVersion();
Bootstrap.bootStrap();
}
@Test
void auditMixins() {
MixinEnvironment.getCurrentEnvironment().audit();
}
}