Hey! I’m trying to apply the <Compose Rules >plugi...
# gradle
e
Hey! I’m trying to apply the Compose Rules plugin to my project, but I’m having some issues. Both my detekt and ktlint configurations are precompiled Gradle scripts in KTS. How could I add a plugin here?
Copy code
// detekt.gradle.kts
apply<DetektPlugin>()

configure<DetektExtension> {
    config = files("$rootDir/config/filters/detekt.yml")
    allRules = true
}

tasks.withType<Detekt>().configureEach {
    exclude("**/resources/**,**/build/**")
}
j
you shouldn’t use apply, instead use plugins block as usual. Then you get the same experience you would get in a normal build file
if I remember correctly, the function was called
detektPlugin(“…”)
, you can get the same by using string extension function
Copy code
“detektPlugin”(“…”)
e
Thanks a ton, it worked! The last thing I imagined is that I could hardcode the function as a string. 😂
j
that string ext work with all kinds of configurations, so if the plugin is not applied via plugins block and the configuration accessors are not generated you can use it,
”api”
,
”implementation”
, etc