autonomousapps / dependency-analysis-gradle-plugin

Gradle plugin for JVM projects written in Java, Kotlin, Groovy, or Scala; and Android projects written in Java or Kotlin. Provides advice for managing dependencies and other applied plugins
Apache License 2.0
1.67k stars 115 forks source link

Support Isolated Projects #1091

Open ZacSweers opened 6 months ago

ZacSweers commented 6 months ago

Is your feature request related to a problem? Please describe. Currently, project isolation doesn't appear to be supported (or at least it fails the build when project isolation is enabled). This is with 1.28.0 and Gradle 8.5.

org.gradle.api.InvalidUserCodeException: Cannot access project ':' from project ':app'
    ...
    at com.autonomousapps.DependencyAnalysisExtensionKt.getExtensionOrNull(DependencyAnalysisExtension.kt:92)
    at com.autonomousapps.DependencyAnalysisPlugin.checkPluginWasAppliedToRoot(DependencyAnalysisPlugin.kt:76)
    at com.autonomousapps.DependencyAnalysisPlugin.apply(DependencyAnalysisPlugin.kt:27)
    at com.autonomousapps.DependencyAnalysisPlugin.apply(DependencyAnalysisPlugin.kt:22)

Describe the solution you'd like

Project isolation support

Describe alternatives you've considered

Additional context

jjohannes commented 1 month ago

This already works for me if:

The improvement I would like to see next is to not having to use the dependency.analysis.autoapply property, but instead having a dedicated "root project" plugin – e.g. com.autonomousapps.dependency-analysis-root – only for the root project that never does the autoapply.

As a nice-to-have, I would also like to see the plugin working without applying anything to the root. Then you won't have the root tasks (buildHealth) but can still check each project individually (projectHealth) which is sufficient for certain setups (in my experience).