Closed hfhbd closed 1 year ago
afterEvaluate
is used because you could apply the licensee plugin before the Kotlin and/or Android plugins are applied. If removed, it would mean hasPlugin
would return false. We used to use plugins.withId
and then set state as to whether you have a plugin applied, but you still need an afterEvaluate
to know when the user's build script is done running such that no more plugins will be applied (at least not by the user). There's probably no test for this behavior, but it would basically be the same as the existing ones except with our plugin applied first. Perhaps we should switch all the tests to this form to ensure it remains working.
Okay, I added a test Personally, I like failing more, but let's keep this behavior.
Without afterEvaluate the tasks are not created at begin of the configuration stage, so Gradle does not generate the kotlin tasks accessors (the typed shortcuts).
In a normal case when we depend only on one plugin we can fail. But in this case you could apply the Android plugin, then Licensee, and then the Kotlin plugin. Without afterEvaluate
we would miss the fact that the Kotlin plugin was applied and only set up the project for the Android variants.
Just a test whether it is needed for
dependency-substitution-replace-remote-with-include-build-ignored
see #141