From e00eafe44f1da25a094e66e888a036a296e63886 Mon Sep 17 00:00:00 2001 From: Matthew Haughton <3flex@users.noreply.github.com> Date: Wed, 9 Feb 2022 21:06:14 +1100 Subject: [PATCH] Enable Gradle's configuration cache by default (#4576) * Flag tasks known to be incompatible with Gradle's configuration cache * Enable Gradle's configuration cache by default --- .github/workflows/codecoverage.yaml | 2 +- .github/workflows/detekt-with-type-resolution.yaml | 4 ++-- .github/workflows/pre-merge.yaml | 6 +++--- build-logic/src/main/kotlin/module.gradle.kts | 4 ++++ detekt-api/build.gradle.kts | 4 ++++ detekt-generator/build.gradle.kts | 1 + detekt-gradle-plugin/build.gradle.kts | 4 ++++ gradle.properties | 1 + 8 files changed, 20 insertions(+), 6 deletions(-) diff --git a/.github/workflows/codecoverage.yaml b/.github/workflows/codecoverage.yaml index ea02c6d5b787..d6a3e9f53cc5 100644 --- a/.github/workflows/codecoverage.yaml +++ b/.github/workflows/codecoverage.yaml @@ -25,7 +25,7 @@ jobs: - name: Generate Coverage Report uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache jacocoMergedReport + arguments: jacocoMergedReport - name: Publish Coverage if: success() diff --git a/.github/workflows/detekt-with-type-resolution.yaml b/.github/workflows/detekt-with-type-resolution.yaml index 73ca4ac8022e..d0dc028331bc 100644 --- a/.github/workflows/detekt-with-type-resolution.yaml +++ b/.github/workflows/detekt-with-type-resolution.yaml @@ -25,7 +25,7 @@ jobs: - name: Run detekt-cli with argsfile uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache :detekt-cli:runWithArgsFile + arguments: :detekt-cli:runWithArgsFile - name: Upload SARIF to Github using the upload-sarif action uses: github/codeql-action/upload-sarif@v1 @@ -49,4 +49,4 @@ jobs: - name: Run analysis uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache detektMain detektTest + arguments: detektMain detektTest diff --git a/.github/workflows/pre-merge.yaml b/.github/workflows/pre-merge.yaml index c82c0ffa5754..6fd8f296104d 100644 --- a/.github/workflows/pre-merge.yaml +++ b/.github/workflows/pre-merge.yaml @@ -40,11 +40,11 @@ jobs: - name: Run detekt-cli --help uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache :detekt-cli:runWithHelpFlag + arguments: :detekt-cli:runWithHelpFlag - name: Run detekt-cli with argsfile uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache :detekt-cli:runWithArgsFile + arguments: :detekt-cli:runWithArgsFile verify-generated-config-file: if: ${{ !contains(github.event.head_commit.message, 'ci skip') }} @@ -76,4 +76,4 @@ jobs: - name: Build and compile test snippets uses: gradle/gradle-build-action@v2 with: - arguments: --configuration-cache test -x :detekt-gradle-plugin:test -Pcompile-test-snippets=true + arguments: test -x :detekt-gradle-plugin:test -Pcompile-test-snippets=true diff --git a/build-logic/src/main/kotlin/module.gradle.kts b/build-logic/src/main/kotlin/module.gradle.kts index 29c77146b2f4..d8fc4b606602 100644 --- a/build-logic/src/main/kotlin/module.gradle.kts +++ b/build-logic/src/main/kotlin/module.gradle.kts @@ -21,6 +21,10 @@ val versionCatalog = project.extensions.getByType().na jacoco.toolVersion = versionCatalog.findVersion("jacoco").get().requiredVersion +tasks.withType().configureEach { + notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13468") +} + tasks.withType().configureEach { useJUnitPlatform() systemProperty("spek2.jvm.cg.scan.concurrency", 1) // use one thread for classpath scanning diff --git a/detekt-api/build.gradle.kts b/detekt-api/build.gradle.kts index cd0280dd4bce..833d44a66b11 100644 --- a/detekt-api/build.gradle.kts +++ b/detekt-api/build.gradle.kts @@ -33,6 +33,10 @@ tasks.withType().configureEach { outputDirectory.set(rootDir.resolve("docs/pages/kdoc")) } +tasks.dokkaJekyll { + notCompatibleWithConfigurationCache("https://github.com/Kotlin/dokka/issues/1217") +} + apiValidation { ignoredPackages.add("io.gitlab.arturbosch.detekt.api.internal") } diff --git a/detekt-generator/build.gradle.kts b/detekt-generator/build.gradle.kts index de0cbafb0c79..996bc7d3fa0b 100644 --- a/detekt-generator/build.gradle.kts +++ b/detekt-generator/build.gradle.kts @@ -67,6 +67,7 @@ val generateDocumentation by tasks.registering(JavaExec::class) { } val verifyGeneratorOutput by tasks.registering(Exec::class) { + notCompatibleWithConfigurationCache("cannot serialize object of type java.io.ByteArrayOutputStream") dependsOn(generateDocumentation) description = "Verifies that the default-detekt-config.yml is up-to-date" val configDiff = ByteArrayOutputStream() diff --git a/detekt-gradle-plugin/build.gradle.kts b/detekt-gradle-plugin/build.gradle.kts index d468eb1bb747..d00fcb7bc4f3 100644 --- a/detekt-gradle-plugin/build.gradle.kts +++ b/detekt-gradle-plugin/build.gradle.kts @@ -136,6 +136,10 @@ tasks { check { dependsOn(testing.suites.named("functionalTest")) } + + ideaModule { + notCompatibleWithConfigurationCache("https://github.com/gradle/gradle/issues/13480") + } } // Skip publishing of test fixture API & runtime variants diff --git a/gradle.properties b/gradle.properties index 193696951207..6fb5d3e982a9 100644 --- a/gradle.properties +++ b/gradle.properties @@ -3,3 +3,4 @@ systemProp.sonar.host.url=http://localhost:9000 org.gradle.parallel=true org.gradle.caching=true org.gradle.jvmargs=-Xmx1g -XX:MaxMetaspaceSize=512m -Dfile.encoding=UTF-8 +org.gradle.unsafe.configuration-cache=true