Skip to content

Commit 5acb511

Browse files
committed
Add mixin audit to CI
1 parent 37dc9e6 commit 5acb511

3 files changed

Lines changed: 14 additions & 0 deletions

File tree

.github/workflows/gradle.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,8 @@ jobs:
4444
run: ./scripts/tagcleaner.sh
4545
- name: Build ModernFix using Gradle
4646
run: ./gradlew build
47+
- name: Run mixin audit
48+
run: timeout 60 xvfb-run ./gradlew runAuditClient
4749
- name: Publish mod to CurseForge & Modrinth
4850
if: steps.check_branch.outputs.is_release == 'true'
4951
run: ./gradlew publishMods copyJarToBin

build.gradle.kts

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,10 @@ legacyForge {
3838
create("server") {
3939
server()
4040
}
41+
create("auditClient") {
42+
client()
43+
jvmArguments.addAll("-Dmodernfix.auditAndExit=true", "-Djava.awt.headless=true")
44+
}
4145
}
4246

4347
mods {

src/main/java/org/embeddedt/modernfix/common/mixin/core/BootstrapMixin.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
import org.embeddedt.modernfix.util.TimeFormatter;
99
import org.spongepowered.asm.mixin.Final;
1010
import org.spongepowered.asm.mixin.Mixin;
11+
import org.spongepowered.asm.mixin.MixinEnvironment;
1112
import org.spongepowered.asm.mixin.Shadow;
1213
import org.spongepowered.asm.mixin.injection.At;
1314
import org.spongepowered.asm.mixin.injection.Inject;
@@ -27,6 +28,13 @@ private static void doModernFixBootstrap(CallbackInfo ci) {
2728
LOGGER.info("ModernFix reached bootstrap stage ({} after launch)", TimeFormatter.formatNanos(ManagementFactory.getRuntimeMXBean().getUptime() * 1000L * 1000L));
2829
ModWorkManagerQueue.replace();
2930
ManifestCompactor.compactManifests();
31+
boolean auditAndExit = Boolean.getBoolean("modernfix.auditAndExit");
32+
if (auditAndExit || Boolean.getBoolean("modernfix.auditMixinsAtStart")) {
33+
MixinEnvironment.getCurrentEnvironment().audit();
34+
if (auditAndExit) {
35+
System.exit(0);
36+
}
37+
}
3038
}
3139
}
3240

0 commit comments

Comments
 (0)