mirror of
https://github.com/GTNewHorizons/ForgeMultipart.git
synced 2026-11-21 12:42:51 +00:00
Upload functional test reports, JUnit XML and server logs on every run so a CI failure has something to read beyond aggregate counts. Print unit and functional test summaries, naming each failed functional test. Repackage the JUnit stack into the test mod jar without module descriptors so FML stops logging a LoaderException per jar while scanning the classpath, and silence the two ERROR lines that passing tests drive on purpose. Refresh the handoff counts and record which migration documents are deleted when the port closes.
77 lines
3.4 KiB
Groovy
77 lines
3.4 KiB
Groovy
//version: 1707058017
|
|
|
|
plugins {
|
|
id 'com.gtnewhorizons.gtnhconvention'
|
|
}
|
|
|
|
tasks.test {
|
|
useJUnitPlatform()
|
|
testLogging {
|
|
events("failed")
|
|
exceptionFormat = "full"
|
|
}
|
|
// Gradle prints nothing on success, so a green run never says how much ran.
|
|
afterSuite { desc, result ->
|
|
if (desc.parent != null) {
|
|
return
|
|
}
|
|
def summary = "Unit tests: ${result.testCount} tests, ${result.successfulTestCount} passed, " +
|
|
"${result.failedTestCount} failed, ${result.skippedTestCount} skipped"
|
|
logger.lifecycle(summary)
|
|
def stepSummary = System.getenv("GITHUB_STEP_SUMMARY")
|
|
if (stepSummary) {
|
|
new File(stepSummary) << "### ${summary}\n"
|
|
}
|
|
}
|
|
}
|
|
|
|
// Scope modern syntax to these helpers; retained Scala and joint Java stay on Java 8.
|
|
apply plugin: xyz.wagyourtail.jvmdg.gradle.JVMDowngraderPlugin
|
|
|
|
// Single source of truth for the modern-syntax helpers. These are compiled by compileModernJava
|
|
// and must be excluded from compileScala; keep one list, because a file excluded from the joint
|
|
// Scala compile but absent from this list is never compiled at all, and nothing reports it.
|
|
def modernJavaPaths = [
|
|
'codechicken/multipart/asm/StackAnalyserLogic.java',
|
|
'codechicken/multipart/asm/JavaTraitRegistration.java',
|
|
'codechicken/multipart/asm/ClassInfoLookup.java',
|
|
'codechicken/multipart/asm/ScalaSignatureParser.java',
|
|
'codechicken/microblock/HollowMicroblockTraitLogic.java',
|
|
'codechicken/microblock/PostMicroblockClientLogic.java',
|
|
'codechicken/microblock/HollowMicroblockClientLogic.java',
|
|
'codechicken/microblock/TMicroOcclusionLogic.java',
|
|
]
|
|
def modernJavaSources = sourceSets.main.scala.matching { include modernJavaPaths }
|
|
def legacyScala = tasks.named('compileScala') {
|
|
// Zinc does not invalidate joint-compiled Java annotations when Tags.VERSION changes.
|
|
scalaCompileOptions.force = true
|
|
// Scalac reads the Java declaration without asking Java 8 javac to compile its body.
|
|
exclude modernJavaPaths
|
|
scalaCompileOptions.additionalParameters = ['-sourcepath', file('src/main/scala').absolutePath]
|
|
inputs.files(modernJavaSources).withPropertyName('modernJavaDeclarations').withPathSensitivity(PathSensitivity.RELATIVE)
|
|
}
|
|
|
|
def compileModernJava = tasks.register('compileModernJava', JavaCompile) {
|
|
source(modernJavaSources)
|
|
classpath = sourceSets.main.compileClasspath + files(
|
|
tasks.named('compileJava').flatMap { it.destinationDirectory },
|
|
legacyScala.flatMap { it.destinationDirectory })
|
|
destinationDirectory = layout.buildDirectory.dir('classes/java/modern')
|
|
javaCompiler = javaToolchains.compilerFor { languageVersion = JavaLanguageVersion.of(25) }
|
|
options.release = 21
|
|
options.encoding = 'UTF-8'
|
|
}
|
|
|
|
def downgradeModernJava = tasks.register('downgradeModernJava', xyz.wagyourtail.jvmdg.gradle.task.files.DowngradeFiles) {
|
|
inputCollection = files(compileModernJava.flatMap { it.destinationDirectory })
|
|
classpath = compileModernJava.get().classpath
|
|
downgradeTo = JavaVersion.VERSION_1_8
|
|
multiReleaseOriginal = false
|
|
multiReleaseVersions = [] as Set
|
|
// The bundled plugin otherwise declares outputs only when inputs already exist.
|
|
outputs.dirs(outputMap.values())
|
|
}
|
|
|
|
sourceSets.main.output.classesDirs.from(downgradeModernJava.map { it.outputCollection })
|
|
tasks.named('classes') { dependsOn(downgradeModernJava) }
|