Skip to content

Commit 21b3520

Browse files
committed
Tweak dependency analysis for Gradle plugin projects
1 parent 12ee0ba commit 21b3520

File tree

3 files changed

+26
-0
lines changed

3 files changed

+26
-0
lines changed

gradle-plugin-conventions/build.gradle.kts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,8 @@ dependencies {
2222
functionalTestImplementation(testFixtures(project(":common-conventions")))
2323
functionalTestImplementation(project(":libraries:gradle-test-kit"))
2424
functionalTestImplementation(libs.assertj.core)
25+
26+
compileOnly(libs.dependency.analysis.gradle.plugin)
2527
}
2628

2729
gradlePlugin {

gradle-plugin-conventions/src/main/kotlin/io/technoirlab/conventions/gradle/plugin/GradlePluginConventionPlugin.kt

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@ import io.technoirlab.conventions.common.configuration.configurePublishing
1515
import io.technoirlab.conventions.common.configuration.configureTestFixtures
1616
import io.technoirlab.conventions.common.configuration.configureTesting
1717
import io.technoirlab.conventions.gradle.plugin.api.GradlePluginExtension
18+
import io.technoirlab.conventions.gradle.plugin.configuration.configureDependencyAnalysis
1819
import io.technoirlab.conventions.gradle.plugin.configuration.configurePlugin
1920
import io.technoirlab.gradle.Environment
2021
import org.gradle.api.Plugin
@@ -65,5 +66,6 @@ class GradlePluginConventionPlugin : Plugin<Project> {
6566
configurePlugin(config.metadata, environment)
6667
configureTesting()
6768
configureTestFixtures()
69+
configureDependencyAnalysis()
6870
}
6971
}
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
package io.technoirlab.conventions.gradle.plugin.configuration
2+
3+
import com.autonomousapps.DependencyAnalysisSubExtension
4+
import org.gradle.api.Project
5+
import org.gradle.kotlin.dsl.configure
6+
7+
internal fun Project.configureDependencyAnalysis() {
8+
pluginManager.withPlugin("com.autonomousapps.dependency-analysis") {
9+
extensions.configure(DependencyAnalysisSubExtension::class) {
10+
issues {
11+
// Do not suggest changing the dependency on api feature variant from api to implementation
12+
onIncorrectConfiguration {
13+
exclude(path)
14+
}
15+
// Do not report the dependency on api feature variant as unused
16+
onUnusedDependencies {
17+
exclude(path)
18+
}
19+
}
20+
}
21+
}
22+
}

0 commit comments

Comments
 (0)