[gradle-plugin] Use registerJavaGeneratingTask
#6149
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Go back to
registerJavaGeneratingTask
as in 3.x instead ofkotlin.srcDir()
Some background:
kotlin.srcDir()
and switched toregisterJavaGeneratingTask
in 2022 (commit) because it works better with lint (it marks the sources as generated)a.
registerJavaGeneratingTask
wasn't working fromafterEvaluate {}
b. there was an issue with incremental compilation and tests (issuetracker/268218176)
kotlin.srcDir()
(commit)afterEvaluate {}
anymore because there is no default service anymorekotlin.srcDir()
doesn't seem to carry task dependencies for AGP source jar tasks (issuetracker/366293471)afterEvaluate
and test variants)Also took this opportunity to remove some reflexion that is not needed anymore now that we require Gradle 8.0.
All in all, I wish
kotlin.srcDir()
would just work as it's more consistent with how generated sources are added in non-Android cases but for the time being, I think we're good withregisterJavaGeneratingTask()
🤞Fixes #6146