Skip to content

Commit

Permalink
Improve build after Gradle 7.6 update (#5572)
Browse files Browse the repository at this point in the history
* Remove redundant configuration override

Fixed in Gradle 7.6

* Apply test fixtures dependency directly to test suite dependencies

* Enable stable configuration cache
  • Loading branch information
3flex committed Nov 26, 2022
1 parent b1b7a21 commit 01db248
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 28 deletions.
24 changes: 0 additions & 24 deletions code-coverage-report/build.gradle.kts
Expand Up @@ -43,27 +43,3 @@ dependencies {
tasks.check {
dependsOn(tasks.named("jacocoMergedReport"))
}

// The `allCodeCoverageReportClassDirectories` configuration provided by the jacoco-report-aggregation plugin actually
// resolves JARs and not class directories as the name suggests. Because the detekt-formatting JAR bundles ktlint and
// other dependencies in its JAR, they are incorrectly displayed on the coverage report even though they're external
// dependencies.
configurations.allCodeCoverageReportClassDirectories.get().attributes {
attributes.attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class, Category.LIBRARY))
attributes.attribute(
LibraryElements.LIBRARY_ELEMENTS_ATTRIBUTE,
objects.named(LibraryElements::class, LibraryElements.CLASSES)
)
}

val customClassDirectories = configurations.allCodeCoverageReportClassDirectories.get().incoming.artifactView {
componentFilter {
it is ProjectComponentIdentifier
}
lenient(true)
}

tasks.named("jacocoMergedReport", JacocoReport::class).configure {
this.classDirectories.setFrom(customClassDirectories.files)
mustRunAfter(rootProject.project("detekt-generator").tasks.named("generateDocumentation"))
}
5 changes: 1 addition & 4 deletions detekt-gradle-plugin/build.gradle.kts
Expand Up @@ -38,6 +38,7 @@ testing {

dependencies {
implementation(libs.assertj)
implementation(testFixtures(project(":")))
}

targets {
Expand Down Expand Up @@ -67,10 +68,6 @@ dependencies {
compileOnly(libs.kotlin.gradlePluginApi)
implementation(libs.sarif4k)

// Migrate to `implementation(testFixtures(project))` in test suite configuration when this issue is fixed:
// https://github.com/gradle/gradle/pull/19472
functionalTestImplementation(testFixtures(project))

pluginCompileOnly(libs.android.gradle)
pluginCompileOnly(libs.kotlin.gradle)

Expand Down
1 change: 1 addition & 0 deletions settings.gradle.kts
Expand Up @@ -40,6 +40,7 @@ include("detekt-tooling")
include("detekt-utils")

enableFeaturePreview("TYPESAFE_PROJECT_ACCESSORS")
enableFeaturePreview("STABLE_CONFIGURATION_CACHE")

// build scan plugin can only be applied in settings file
plugins {
Expand Down

0 comments on commit 01db248

Please sign in to comment.