diff --git a/.github/workflows/broken_links_checker.yml b/.github/workflows/broken_links_checker.yml index 1d492e5..6ac4892 100644 --- a/.github/workflows/broken_links_checker.yml +++ b/.github/workflows/broken_links_checker.yml @@ -14,6 +14,8 @@ jobs: steps: - uses: actions/checkout@v6 + with: + persist-credentials: true - name: Configure broken links checker run: | mkdir -p ./target diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 308b630..26999e7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -31,6 +31,7 @@ jobs: - uses: actions/checkout@v6 with: fetch-depth: 0 + persist-credentials: false - uses: actions/setup-java@v5 with: @@ -41,17 +42,19 @@ jobs: uses: gradle/actions/setup-gradle@v6 - name: Cache SonarQube packages + if: ${{ env.DEFAULT_JAVA == matrix.java }} uses: actions/cache@v5 with: path: ~/.sonar/cache key: ${{ runner.os }}-java-${{ matrix.java }}-sonar restore-keys: ${{ runner.os }}-java-${{ matrix.java }}-sonar - - name: Build with Java ${{ matrix.java }} - run: ./gradlew build --info --warning-mode all -PjavaVersion=${{ matrix.java }} - env: - ORG_GRADLE_PROJECT_ossIndexUsername: ${{ secrets.OSSINDEX_USERNAME }} - ORG_GRADLE_PROJECT_ossIndexToken: ${{ secrets.OSSINDEX_TOKEN }} + - name: Build with Java ${{ matrix.java }} with configuration cache + run: ./gradlew build --warning-mode all --exclude-task ossIndexAudit -PenableConfigurationCache=true -PjavaVersion=${{ matrix.java }} + + - name: Build with Java ${{ matrix.java }} without configuration cache + # Required to get jacoco test coverage reports for SonarQube, which doesn't work with configuration cache enabled, see https://github.com/gradle/gradle/issues/25979 + run: ./gradlew clean build --warning-mode all --exclude-task ossIndexAudit -PenableConfigurationCache=false -PjavaVersion=${{ matrix.java }} - name: Upload reports uses: actions/upload-artifact@v7 @@ -62,13 +65,33 @@ jobs: - name: Sonar analysis if: ${{ env.DEFAULT_JAVA == matrix.java && env.SONAR_TOKEN != null }} - run: ./gradlew sonar --warning-mode all -Dsonar.token=$SONAR_TOKEN + run: ./gradlew sonar --info --warning-mode all -Dsonar.token=$SONAR_TOKEN env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} SONAR_TOKEN: ${{ secrets.SONAR_TOKEN }} - build: - needs: matrix-build + ossindex: runs-on: ubuntu-latest + steps: + - uses: actions/checkout@v6 + with: + persist-credentials: false + - uses: actions/setup-java@v5 + with: + distribution: temurin + java-version: 17 + - name: Setup Gradle + uses: gradle/actions/setup-gradle@v6 + - name: Ossindex + run: ./gradlew ossIndexAudit --warning-mode all --info + env: + ORG_GRADLE_PROJECT_ossIndexUsername: ${{ secrets.OSSINDEX_USERNAME }} + ORG_GRADLE_PROJECT_ossIndexToken: ${{ secrets.OSSINDEX_TOKEN }} + + build: + needs: + - matrix-build + - ossindex + runs-on: ubuntu-slim steps: - run: echo "Build successful" diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index e706d81..97c8686 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -25,6 +25,8 @@ jobs: steps: - name: Checkout repository uses: actions/checkout@v6 + with: + persist-credentials: false - uses: actions/setup-java@v5 with: diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index ad20a8b..736f3fa 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -23,10 +23,12 @@ jobs: steps: - name: Checkout uses: actions/checkout@v6 + with: + persist-credentials: true - name: Fail if not running on main branch if: ${{ github.ref != 'refs/heads/main' }} - uses: actions/github-script@v8 + uses: actions/github-script@v9 with: script: | core.setFailed('Not running on main branch, github.ref is ${{ github.ref }}. Please start this workflow only on main') diff --git a/CHANGELOG.md b/CHANGELOG.md index e89b073..528e16c 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,7 +6,14 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ## [Unreleased] -## [3.2.0] - 2026-02-14 +## [3.1.2] - 2026-05-17 + +- [PR #70](https://github.com/itsallcode/openfasttrace-gradle/pull/70) + - Upgrade to OpenFastTrace [4.4.0](https://github.com/itsallcode/openfasttrace/releases/tag/4.4.0) + - Upgrade integration tests to use Gradle 9.5.1 and 8.14.5 + - Add workaround for https://github.com/gradle/gradle/issues/25979 to calculate test coverage + +## [3.1.1] - 2026-02-14 - [PR #64](https://github.com/itsallcode/openfasttrace-gradle/pull/64) - Upgrade to OpenFastTrace [4.2.1](https://github.com/itsallcode/openfasttrace/releases/tag/4.2.1) diff --git a/README.md b/README.md index 02d12be..0d4038d 100644 --- a/README.md +++ b/README.md @@ -8,13 +8,14 @@ Gradle plugin for the requirement tracing suite [OpenFastTrace](https://github.c [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=org.itsallcode%3Aopenfasttrace-gradle&metric=coverage)](https://sonarcloud.io/dashboard?id=org.itsallcode%3Aopenfasttrace-gradle) * [Blog](https://blog.itsallcode.org/) +* [Gradle Plugin page](https://plugins.gradle.org/plugin/org.itsallcode.openfasttrace) * [Changelog](CHANGELOG.md) * [Contributing guide](CONTRIBUTING.md) * [OpenFastTrace stories](https://github.com/itsallcode/openfasttrace/wiki/OFT-Stories) ## Usage -1. Preconditions: Java 17 and Gradle 8.6 +1. Preconditions: Java 17 and Gradle 9.5 1. Add plugin [`org.itsallcode.openfasttrace`](https://plugins.gradle.org/plugin/org.itsallcode.openfasttrace) to your project: ```groovy diff --git a/build.gradle b/build.gradle index 85908b0..fb658da 100644 --- a/build.gradle +++ b/build.gradle @@ -2,12 +2,11 @@ plugins { id 'java-gradle-plugin' id 'jacoco' id 'signing' - id 'com.gradle.plugin-publish' version '2.0.0' - id 'org.sonarqube' version '7.2.2.6593' - // Deactivate testkit jacoco plugin for now due to https://github.com/gradle/gradle/issues/25979 - //id 'pl.droidsonroids.jacoco.testkit' version '1.0.12' - id 'com.github.ben-manes.versions' version '0.53.0' - id 'org.sonatype.gradle.plugins.scan' version '3.1.4' + id 'com.gradle.plugin-publish' version '2.1.1' + id 'org.sonarqube' version '7.3.0.8198' + id 'pl.droidsonroids.jacoco.testkit' version '1.0.12' + id 'com.github.ben-manes.versions' version '0.54.0' + id 'org.sonatype.gradle.plugins.scan' version '3.1.5' } repositories { @@ -16,13 +15,13 @@ repositories { apply from: 'gradle/workAroundJacocoGradleTestKitIssueOnWindows.gradle' -version = '3.1.1' +version = '3.1.2' group = 'org.itsallcode' ext { gradlePluginId = 'org.itsallcode.openfasttrace' - oftVersion = '4.2.1' - junitVersion = '6.0.2' + oftVersion = '4.4.0' + junitVersion = '6.0.3' if (project.hasProperty('oftSourceDir')) { oftSourceDir = file(project.oftSourceDir) useOftSources = oftSourceDir.exists() @@ -129,6 +128,17 @@ testing { implementation "org.hamcrest:hamcrest-core:3.0" implementation "com.jparams:to-string-verifier:1.4.8" } + targets { + all { + testTask.configure { + if (project.hasProperty('enableConfigurationCache')) { + def enableConfigurationCache = project.getProperty("enableConfigurationCache") + logger.lifecycle "Setting system property 'enableConfigurationCache' to $enableConfigurationCache for test task '${name}'" + systemProperty "enableConfigurationCache", enableConfigurationCache + } + } + } + } } } } diff --git a/gradle/wrapper/gradle-wrapper.jar b/gradle/wrapper/gradle-wrapper.jar index 61285a6..b1b8ef5 100644 Binary files a/gradle/wrapper/gradle-wrapper.jar and b/gradle/wrapper/gradle-wrapper.jar differ diff --git a/gradle/wrapper/gradle-wrapper.properties b/gradle/wrapper/gradle-wrapper.properties index 37f78a6..df6a6ad 100644 --- a/gradle/wrapper/gradle-wrapper.properties +++ b/gradle/wrapper/gradle-wrapper.properties @@ -1,7 +1,9 @@ distributionBase=GRADLE_USER_HOME distributionPath=wrapper/dists -distributionUrl=https\://services.gradle.org/distributions/gradle-9.3.1-bin.zip +distributionUrl=https\://services.gradle.org/distributions/gradle-9.5.1-bin.zip networkTimeout=10000 +retries=0 +retryBackOffMs=500 validateDistributionUrl=true zipStoreBase=GRADLE_USER_HOME zipStorePath=wrapper/dists diff --git a/gradlew b/gradlew index adff685..b9bb139 100755 --- a/gradlew +++ b/gradlew @@ -57,7 +57,7 @@ # Darwin, MinGW, and NonStop. # # (3) This script is generated from the Groovy template -# https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt +# https://github.com/gradle/gradle/blob/3d91ce3b8caaf77ad09f381f43615b715b53f72c/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt # within the Gradle project. # # You can find Gradle at https://github.com/gradle/gradle/. diff --git a/gradlew.bat b/gradlew.bat index e509b2d..aa5f10b 100644 --- a/gradlew.bat +++ b/gradlew.bat @@ -23,8 +23,8 @@ @rem @rem ########################################################################## -@rem Set local scope for the variables with windows NT shell -if "%OS%"=="Windows_NT" setlocal +@rem Set local scope for the variables, and ensure extensions are enabled +setlocal EnableExtensions set DIRNAME=%~dp0 if "%DIRNAME%"=="" set DIRNAME=. @@ -51,7 +51,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :findJavaFromJavaHome set JAVA_HOME=%JAVA_HOME:"=% @@ -65,7 +65,7 @@ echo. 1>&2 echo Please set the JAVA_HOME variable in your environment to match the 1>&2 echo location of your Java installation. 1>&2 -goto fail +"%COMSPEC%" /c exit 1 :execute @rem Setup the command line @@ -73,21 +73,10 @@ goto fail @rem Execute Gradle -"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* +@rem endlocal doesn't take effect until after the line is parsed and variables are expanded +@rem which allows us to clear the local environment before executing the java command +endlocal & "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -jar "%APP_HOME%\gradle\wrapper\gradle-wrapper.jar" %* & call :exitWithErrorLevel -:end -@rem End local scope for the variables with windows NT shell -if %ERRORLEVEL% equ 0 goto mainEnd - -:fail -rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of -rem the _cmd.exe /c_ return code! -set EXIT_CODE=%ERRORLEVEL% -if %EXIT_CODE% equ 0 set EXIT_CODE=1 -if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE% -exit /b %EXIT_CODE% - -:mainEnd -if "%OS%"=="Windows_NT" endlocal - -:omega +:exitWithErrorLevel +@rem Use "%COMSPEC%" /c exit to allow operators to work properly in scripts +"%COMSPEC%" /c exit %ERRORLEVEL% diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java index 7e0751b..ca4719c 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/CollectTask.java @@ -1,7 +1,6 @@ package org.itsallcode.openfasttrace.gradle.task; import static java.util.stream.Collectors.joining; -import static java.util.stream.Collectors.toList; import java.io.File; import java.nio.file.Path; @@ -20,6 +19,7 @@ import org.itsallcode.openfasttrace.core.*; import org.itsallcode.openfasttrace.gradle.task.config.SerializableTagPathConfig; +@CacheableTask public class CollectTask extends DefaultTask { // Possible 'this' escape before subclass is fully initialized @@ -33,6 +33,7 @@ public class CollectTask extends DefaultTask .listProperty(SerializableTagPathConfig.class); @InputFiles + @PathSensitive(PathSensitivity.ABSOLUTE) public SetProperty getInputDirectories() { return inputDirectories; @@ -92,13 +93,13 @@ private List getAllImportFiles() .flatMap(SerializableTagPathConfig::getPaths); getLogger().info("Importing from {} configured paths: {}", pathConfig.get().size(), pathConfig.get()); - return Stream.concat(inputDirPaths, inputTagPaths).collect(toList()); + return Stream.concat(inputDirPaths, inputTagPaths).toList(); } private List getPathConfigInternal() { final List paths = pathConfig.get().stream() - .flatMap(SerializableTagPathConfig::getPathConfig).collect(toList()); + .flatMap(SerializableTagPathConfig::getPathConfig).toList(); if (getLogger().isInfoEnabled()) { getLogger().info("Got {} path configurations:\n{}", paths.size(), diff --git a/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java b/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java index a1af6fd..bb4612c 100644 --- a/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java +++ b/src/main/java/org/itsallcode/openfasttrace/gradle/task/TraceTask.java @@ -21,6 +21,7 @@ import org.itsallcode.openfasttrace.core.OftRunner; @SuppressWarnings("this-escape") +@CacheableTask public class TraceTask extends DefaultTask { private final RegularFileProperty requirementsFile = getProject().getObjects().fileProperty(); @@ -41,6 +42,7 @@ public class TraceTask extends DefaultTask private final Property failBuild = getProject().getObjects().property(Boolean.class); @InputFile + @PathSensitive(PathSensitivity.ABSOLUTE) public RegularFileProperty getRequirementsFile() { return requirementsFile; diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java b/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java index 356ea8c..af6a56d 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/GradleTestConfig.java @@ -7,7 +7,7 @@ public enum GradleTestConfig * We support the latest Gradle version and the previous two. Older Gradle * versions do not work with Java 21 and above. */ - PREVIOUS_VERSION("8.14.4"), CURRENT_VERSION("9.3.1"); + PREVIOUS_VERSION("8.14.5"), CURRENT_VERSION("9.5.1"); public final String gradleVersion; diff --git a/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java b/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java index 0cf70be..c5ca11a 100644 --- a/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java +++ b/src/test/java/org/itsallcode/openfasttrace/gradle/OpenFastTracePluginTest.java @@ -4,7 +4,9 @@ import static org.hamcrest.CoreMatchers.*; import static org.hamcrest.MatcherAssert.assertThat; import static org.hamcrest.Matchers.allOf; +import static org.hamcrest.Matchers.either; import static org.junit.jupiter.api.Assertions.*; +import static org.junit.jupiter.api.Assumptions.assumeTrue; import java.io.*; import java.nio.charset.StandardCharsets; @@ -57,6 +59,7 @@ void pluginUsesConfigurationCacheWithMultiModuleProject(final GradleTestConfig c private void testConfigurationCache(final GradleTestConfig config, final Path projectDir) { + assumeTrue(configurationCacheEnabled(), "Configuration cache is not enabled"); BuildResult buildResult = runBuild(config, projectDir, "tasks"); assertThat(buildResult.getOutput(), containsString( "traceRequirements - Trace requirements and generate tracing report")); @@ -73,7 +76,8 @@ void testTraceExampleProjectWithDefaultConfig(final GradleTestConfig config) thr { final BuildResult buildResult = runBuild(config, PROJECT_DEFAULT_CONFIG_DIR, "clean", "traceRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(PROJECT_DEFAULT_CONFIG_DIR.resolve("build/reports/tracing.txt"), "ok - 0 total"); } @@ -84,7 +88,8 @@ void testCollectExampleProjectWithCustomConfig(final GradleTestConfig config) th { final BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "collectRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":collectRequirements").getOutcome()); + assertThat(buildResult.task(":collectRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(PROJECT_CUSTOM_CONFIG_DIR.resolve("build/reports/requirements.xml"), "\n" + // "", // @@ -137,7 +142,10 @@ void testCollectIsUpToDateWhenAlreadyRunBefore(final GradleTestConfig config) { BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "collectRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":collectRequirements").getOutcome()); + assertThat(buildResult.task(":clean").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); + assertThat(buildResult.task(":collectRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "collectRequirements"); assertEquals(TaskOutcome.UP_TO_DATE, buildResult.task(":collectRequirements").getOutcome()); } @@ -148,7 +156,8 @@ void testHtmlReportConfig(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, HTML_REPORT_CONFIG_DIR, "clean", "traceRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(HTML_REPORT_CONFIG_DIR.resolve("build/reports/tracing.html"), "", "", @@ -161,7 +170,8 @@ void testTraceTaskUpToDateWhenAlreadyRun(final GradleTestConfig config) { BuildResult buildResult = runBuild(config, HTML_REPORT_CONFIG_DIR, "clean", "traceRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); buildResult = runBuild(config, HTML_REPORT_CONFIG_DIR, "traceRequirements"); assertEquals(TaskOutcome.UP_TO_DATE, buildResult.task(":traceRequirements").getOutcome()); } @@ -172,7 +182,8 @@ void testTraceExampleProjectWithCustomConfig(final GradleTestConfig config) thro { final BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "traceRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(PROJECT_CUSTOM_CONFIG_DIR.resolve("build/custom-report.txt"), "not ok [ in: 1 / 1 ✔ | out: 0 / 0 ] dsn~exampleB~1 (impl, -utest)", // "not ok - 2 total, 1 defect"); @@ -197,7 +208,8 @@ void filteredArtifactTypes(final GradleTestConfig config) { final BuildResult buildResult = runBuild(config, PROJECT_CUSTOM_CONFIG_DIR, "clean", "traceRequirements", "-PfailBuild=true", "-PfilteredArtifactTypes=dsn"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); } @ParameterizedTest(name = "testTraceExampleProjectWithCustomConfigFailBuild {0}") @@ -227,7 +239,8 @@ void testTraceMultiProject(final GradleTestConfig config) throws IOException { final BuildResult buildResult = runBuild(config, MULTI_PROJECT_DIR, "clean", "traceRequirements"); - assertEquals(TaskOutcome.SUCCESS, buildResult.task(":traceRequirements").getOutcome()); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(MULTI_PROJECT_DIR.resolve("build/custom-report.txt"), "ok - 6 total"); } @@ -242,7 +255,8 @@ void traceDependencyProject(final GradleTestConfig config) throws IOException createDependencyZip(dependencyZip); buildResult = runBuild(config, DEPENDENCY_CONFIG_DIR, "traceRequirements"); - assertThat(buildResult.task(":traceRequirements").getOutcome(), is(TaskOutcome.SUCCESS)); + assertThat(buildResult.task(":traceRequirements").getOutcome(), + either(is(TaskOutcome.SUCCESS)).or(is(TaskOutcome.FROM_CACHE))); assertFileContent(DEPENDENCY_CONFIG_DIR.resolve("build/reports/tracing.txt"), "requirements-1.0.zip!spec.md:2", // "requirements-1.0.zip!source.java:1", // @@ -340,7 +354,11 @@ private static GradleRunner createGradleRunner(final GradleTestConfig config, configureJacoco(projectDir); final List allArgs = new ArrayList<>(); allArgs.addAll(List.of(arguments)); - allArgs.addAll(List.of("--info", "--stacktrace", "--configuration-cache", "--build-cache")); + allArgs.addAll(List.of("--info", "--stacktrace", "--build-cache")); + if (configurationCacheEnabled()) + { + allArgs.add("--configuration-cache"); + } if (ENABLE_WARNINGS) { allArgs.addAll(List.of("--warning-mode", "all")); @@ -357,8 +375,19 @@ private static GradleRunner createGradleRunner(final GradleTestConfig config, return runner; } + private static boolean configurationCacheEnabled() + { + return System.getProperty("enableConfigurationCache", "false").equalsIgnoreCase("true"); + } + private static void configureJacoco(final Path projectDir) { + if (configurationCacheEnabled()) + { + LOG.info( + "Configuration cache enabled. Skipping jacoco configuration for testkit: https://github.com/gradle/gradle/issues/25979"); + return; + } final Optional testkitGradleConfig = TestUtil .readResource(OpenFastTracePluginTest.class, "/testkit-gradle.properties"); if (testkitGradleConfig.isEmpty())