Skip to content

Commit

Permalink
Ensure pluginCompileOnly participates in variant-aware selection
Browse files Browse the repository at this point in the history
Two variants of KGP are published as of KGP 1.7. Without specifying an
attribute to match on the consuming configuration Gradle will refuse to
match either one. Adding an attribute to match on will make Gradle select
a variant when resolving dependencies for the manually created
pluginCompileOnly configuration.

https://kotlinlang.org/docs/whatsnew17.html#support-for-gradle-plugin-variants
  • Loading branch information
3flex committed Jun 12, 2022
1 parent 2502f97 commit 14fab75
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions detekt-gradle-plugin/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,10 @@ val functionalTestImplementation: Configuration by configurations.getting

configurations.compileOnly { extendsFrom(pluginCompileOnly) }

pluginCompileOnly.attributes {
attribute(Category.CATEGORY_ATTRIBUTE, objects.named(Category::class.java, "library"))
}

dependencies {
compileOnly(libs.kotlin.gradlePluginApi)
implementation(libs.sarif4k)
Expand Down

0 comments on commit 14fab75

Please sign in to comment.