Skip to content

Commit

Permalink
Enable gradle worker api
Browse files Browse the repository at this point in the history
  • Loading branch information
BraisGabin committed Feb 2, 2024
1 parent 7465bd4 commit b88e93e
Show file tree
Hide file tree
Showing 5 changed files with 12 additions and 8 deletions.
Expand Up @@ -55,13 +55,15 @@ class DetektReportMergeSpec {
assertThat(result.output).containsIgnoringWhitespaces(
"""
Execution failed for task ':child1:detekt'.
> Analysis failed with 2 issues.
> A failure occurred while executing io.gitlab.arturbosch.detekt.invoke.DetektWorkAction
> Analysis failed with 2 issues.
""".trimIndent()
)
assertThat(result.output).containsIgnoringWhitespaces(
"""
Execution failed for task ':child2:detekt'.
> Analysis failed with 4 issues.
> A failure occurred while executing io.gitlab.arturbosch.detekt.invoke.DetektWorkAction
> Analysis failed with 4 issues.
""".trimIndent()
)
assertThat(projectFile("build/reports/detekt/detekt.sarif")).doesNotExist()
Expand Down Expand Up @@ -121,13 +123,15 @@ class DetektReportMergeSpec {
assertThat(result.output).containsIgnoringWhitespaces(
"""
Execution failed for task ':child1:detekt'.
> Analysis failed with 2 issues.
> A failure occurred while executing io.gitlab.arturbosch.detekt.invoke.DetektWorkAction
> Analysis failed with 2 issues.
""".trimIndent()
)
assertThat(result.output).containsIgnoringWhitespaces(
"""
Execution failed for task ':child2:detekt'.
> Analysis failed with 4 issues.
> A failure occurred while executing io.gitlab.arturbosch.detekt.invoke.DetektWorkAction
> Analysis failed with 4 issues.
""".trimIndent()
)
assertThat(projectFile("build/reports/detekt/detekt.xml")).doesNotExist()
Expand Down
Expand Up @@ -214,7 +214,7 @@ abstract class Detekt @Inject constructor(

@TaskAction
fun check() {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("false") == "true") {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down
Expand Up @@ -143,7 +143,7 @@ abstract class DetektCreateBaselineTask @Inject constructor(

@TaskAction
fun baseline() {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("false") == "true") {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down
Expand Up @@ -57,7 +57,7 @@ abstract class DetektGenerateConfigTask @Inject constructor(

Files.createDirectories(configFile.get().asFile.parentFile.toPath())

if (providers.gradleProperty(USE_WORKER_API).getOrElse("false") == "true") {
if (providers.gradleProperty(USE_WORKER_API).getOrElse("true").toBoolean()) {
logger.info("Executing $name using Worker API")
val workQueue = workerExecutor.processIsolation { workerSpec ->
workerSpec.classpath.from(detektClasspath)
Expand Down
2 changes: 1 addition & 1 deletion website/docs/gettingstarted/gradle.mdx
Expand Up @@ -310,7 +310,7 @@ detekt {
### <a name="gradle-properties">Options for detekt Gradle properties</a>

```groovy
// If set to true, enables Gradle Worker API for Detekt tasks. `false` by default.
// If set to true, enables Gradle Worker API for Detekt tasks. `true` by default.
// See the doc for the Worker API at https://docs.gradle.org/8.1/userguide/worker_api.html
detekt.use.worker.api = false
```
Expand Down

0 comments on commit b88e93e

Please sign in to comment.