diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 4d9c624..c62f061 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -29,7 +29,7 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} - name: :build - run: ./gradlew build --stacktrace --no-daemon + run: ./gradlew build --stacktrace --no-daemon -PwithAuditAndExit=true - name: Upload artifacts if: always() @@ -44,7 +44,7 @@ jobs: id: smokeTest uses: coactions/setup-xvfb@v1 with: - run: ./gradlew :smokeTest --no-daemon + run: ./gradlew :smokeTest --no-daemon -PwithAuditAndExit=true - name: Upload test results if: failure() diff --git a/.github/workflows/pull_request.yml b/.github/workflows/pull_request.yml index fc6639f..79652da 100644 --- a/.github/workflows/pull_request.yml +++ b/.github/workflows/pull_request.yml @@ -18,11 +18,11 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY_PR }} cache-read-only: true - name: :build - run: ./gradlew build --no-daemon + run: ./gradlew build --no-daemon -PwithAuditAndExit=true - name: :smokeTest uses: coactions/setup-xvfb@v1 with: - run: ./gradlew :smokeTest --no-daemon + run: ./gradlew :smokeTest --no-daemon -PwithAuditAndExit=true - name: Upload artifacts uses: actions/upload-artifact@v4 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 0f4daf6..bf2dc05 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -21,11 +21,11 @@ jobs: cache-encryption-key: ${{ secrets.GRADLE_ENCRYPTION_KEY }} cache-read-only: true - name: :build - run: ./gradlew :build + run: ./gradlew :build -PwithAuditAndExit=true - name: :smokeTest uses: coactions/setup-xvfb@v1 with: - run: ./gradlew :smokeTest + run: ./gradlew :smokeTest -PwithAuditAndExit=true - name: :publishMods run: ./gradlew publishMods -Prelease_channel=RELEASE --no-daemon env: diff --git a/api/build.gradle.kts b/api/build.gradle.kts index 14ae6b7..0643004 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -16,6 +16,7 @@ buildConfig { buildConfigField("MOD_NAME", "mod_name"()) buildConfigField("ARCHAIC_VERSION_RANGE", "archaic_minecraft_range"()) buildConfigField("VINTAGE_VERSION_RANGE", "vintage_minecraft_range"()) + buildConfigField("AUDIT_AND_EXIT_ENABLED", Zume.auditAndExitEnabled) } dependencies { diff --git a/api/src/main/java/dev/nolij/zume/impl/Zume.java b/api/src/main/java/dev/nolij/zume/impl/Zume.java index 6689617..03d1868 100644 --- a/api/src/main/java/dev/nolij/zume/impl/Zume.java +++ b/api/src/main/java/dev/nolij/zume/impl/Zume.java @@ -11,7 +11,7 @@ import java.io.IOException; import java.nio.file.Path; -import static dev.nolij.zume.impl.ZumeConstants.MOD_ID; +import static dev.nolij.zume.impl.ZumeConstants.*; public class Zume { @@ -68,7 +68,7 @@ public static void registerImplementation(final IZumeImplementation implementati } public static void postInit() { - if (Boolean.getBoolean("zumeGradle.auditAndExit")) { + if (AUDIT_AND_EXIT_ENABLED && Boolean.getBoolean("zumeGradle.auditAndExit")) { try { MixinUtil.audit(); LOGGER.info("ZumeGradle audit passed"); diff --git a/build.gradle.kts b/build.gradle.kts index a142d2a..47757e8 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -40,6 +40,8 @@ plugins { operator fun String.invoke(): String = rootProject.properties[this] as? String ?: error("Property $this not found") +Zume.auditAndExitEnabled = (rootProject.properties["withAuditAndExit"] as String?).toBoolean() + enum class ReleaseChannel( val suffix: String? = null, val releaseType: ReleaseType? = null, diff --git a/buildSrc/src/main/kotlin/Zume.kt b/buildSrc/src/main/kotlin/Zume.kt index de821ee..3496aee 100644 --- a/buildSrc/src/main/kotlin/Zume.kt +++ b/buildSrc/src/main/kotlin/Zume.kt @@ -8,4 +8,6 @@ object Zume { if (value.isNotEmpty()) _version = value } + + var auditAndExitEnabled = false } \ No newline at end of file diff --git a/buildSrc/src/main/kotlin/dev/nolij/zumegradle/task/SmokeTestTask.kt b/buildSrc/src/main/kotlin/dev/nolij/zumegradle/task/SmokeTestTask.kt index 5f659b7..956c9f4 100644 --- a/buildSrc/src/main/kotlin/dev/nolij/zumegradle/task/SmokeTestTask.kt +++ b/buildSrc/src/main/kotlin/dev/nolij/zumegradle/task/SmokeTestTask.kt @@ -48,6 +48,9 @@ abstract class SmokeTestTask : DefaultTask() { @TaskAction fun runSmokeTest() { + if (!Zume.auditAndExitEnabled) + error("Smoke testing requires `auditAndExit` support!") + SmokeTest( project, portableMCBinary.get(),