From 0e22a9adc7fa2f6bc3f5e37477a0ed1bfea8ea7c Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sat, 16 Dec 2023 22:10:19 -0800 Subject: [PATCH 1/4] Make sure that the undertest tests are never up-to-date. --- undertest-junit5/build.gradle | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/undertest-junit5/build.gradle b/undertest-junit5/build.gradle index 6dfa8874..5cd65e34 100644 --- a/undertest-junit5/build.gradle +++ b/undertest-junit5/build.gradle @@ -27,10 +27,19 @@ test { } tasks.register('underTest', Test) { useJUnitPlatform() + testClassesDirs = testing.suites.test.sources.output.classesDirs + classpath = testing.suites.test.sources.runtimeClasspath + // the snapshots are both output and input, for this harness best if the test just always runs + outputs.upToDateWhen { false } // defaults to 'write' systemProperty 'selfie', findProperty('selfie') } tasks.register('underTestRead', Test) { useJUnitPlatform() + testClassesDirs = testing.suites.test.sources.output.classesDirs + classpath = testing.suites.test.sources.runtimeClasspath + // the snapshots are both output and input, for this harness best if the test just always runs + outputs.upToDateWhen { false } + // read-only systemProperty 'selfie', 'read' } From 10756104c21c1fddfc04a8544c1419113021982a Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sat, 16 Dec 2023 22:11:05 -0800 Subject: [PATCH 2/4] Test harness wasn't closing a Closeable. --- .../com/diffplug/selfie/junit5/Harness.kt | 46 ++++++++++--------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/Harness.kt b/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/Harness.kt index 56301dd2..b4d6b393 100644 --- a/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/Harness.kt +++ b/selfie-runner-junit5/src/test/kotlin/com/diffplug/selfie/junit5/Harness.kt @@ -24,9 +24,9 @@ import javax.xml.xpath.XPathFactory import okio.FileSystem import okio.Path import okio.Path.Companion.toPath -import org.gradle.internal.impldep.junit.framework.AssertionFailedError import org.gradle.tooling.BuildException import org.gradle.tooling.GradleConnector +import org.opentest4j.AssertionFailedError import org.w3c.dom.NodeList import org.xml.sax.InputSource @@ -174,27 +174,29 @@ open class Harness(subproject: String) { } } fun gradlew(task: String, vararg args: String): AssertionFailedError? { - val runner = - GradleConnector.newConnector() - .forProjectDirectory(subprojectFolder.parent!!.toFile()) - .connect() - - try { - val buildLauncher = - runner - .newBuild() - .forTasks(":${subprojectFolder.name}:$task") - .withArguments( - buildList { - addAll(args) - add("--configuration-cache") // ControlWR enabled vs disables is 11s vs 24s - add("--stacktrace") - }) - buildLauncher.run() - return null - } catch (e: BuildException) { - return parseBuildException(task, e) - } + return GradleConnector.newConnector() + .forProjectDirectory(subprojectFolder.parent!!.toFile()) + .connect() + .use { connection -> + try { + val buildLauncher = + connection + .newBuild() + // .setStandardError(System.err) + // .setStandardOutput(System.out) + .forTasks(":${subprojectFolder.name}:$task") + .withArguments( + buildList { + addAll(args) + add("--configuration-cache") // enabled vs disabled is 11s vs 24s + add("--stacktrace") + }) + buildLauncher.run() + return null + } catch (e: BuildException) { + return parseBuildException(task, e) + } + } } /** From e20ab7609066e5872c8dd2afc6373ba803d0d3dc Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sat, 16 Dec 2023 22:12:17 -0800 Subject: [PATCH 3/4] Make sure that the `selfie-runner-junit5` tests aren't marked up-to-date when their matching `undertest` data has changed. --- selfie-runner-junit5/build.gradle | 1 + 1 file changed, 1 insertion(+) diff --git a/selfie-runner-junit5/build.gradle b/selfie-runner-junit5/build.gradle index 8f2c597d..83f0bd22 100644 --- a/selfie-runner-junit5/build.gradle +++ b/selfie-runner-junit5/build.gradle @@ -33,6 +33,7 @@ dependencies { } test { useJUnitPlatform() + getInputs().dir('../undertest-junit5/src/test/kotlin') } // it all needs to get published and formatted From ee3d66a001a3d24cf9a266b9eeca86e1a876735f Mon Sep 17 00:00:00 2001 From: Ned Twigg Date: Sat, 16 Dec 2023 22:12:30 -0800 Subject: [PATCH 4/4] Bump the GitHub actions versions to latest. --- .github/workflows/ci.yml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index a2a3d9f9..ef748025 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -18,7 +18,7 @@ jobs: runs-on: ${{ matrix.os }} steps: - name: Checkout - uses: actions/checkout@v3 + uses: actions/checkout@v4 - name: Install JDK ${{ matrix.jre }} uses: actions/setup-java@v3 with: @@ -33,7 +33,7 @@ jobs: - name: gradlew build run: ./gradlew build - name: junit result - uses: mikepenz/action-junit-report@v3 + uses: mikepenz/action-junit-report@v4 if: always() # always run even if the previous step fails with: check_name: JUnit ${{ matrix.jre }} ${{ matrix.os }}