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

fix: ugly workaround for issue 1116. #1128

Closed autonomousapps closed 4 months ago

autonomousapps commented 4 months ago

Basic hypothesis is that tasks.whenTaskAdded eagerly realizes all tasks, which forces DAGP tasks to be configured too soon. Some of them have dependencies on AGP tasks that are registered later in the build lifecycle. This workaround uses afterEvaluate as a bandaid. Preferable would be using some Android- specific version of SourceSetContainer to get lazy access to compiled class files, instead of relying on tasks directly.

Resolves https://github.com/autonomousapps/dependency-analysis-gradle-plugin/issues/1116