Proposal: Port plugin to AndroidComponentsExtension #369
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.
I took some time to debug #349 with AGP 7.3.x and I think the root of the problem is that AGP now ignores the addition of the source set. It seems one can set it fine, but it is just silently ignored. I verified this by setting some break points inside the AGP code during the merge resources task and the easylauncher source set is not there. Any other attempts to fix this failed.
I then stumbled over the AndroidComponentsExtension (https://developer.android.com/reference/tools/gradle-api/4.2/com/android/build/api/extension/AndroidComponentsExtension) which provides an API for what easylauncher actually wants to achieve: create a new source set, use a task to generate some new assets and hook task execution and source set merging into the build process.
This required some refactorings (summarized below), but now the implementation no longer relies on implicit assumptions (such as the name of the merge resources task). As far as I can tell, there are only two regressions for which I have not yet found a solution:
android.disableResourceValidation=true
Following is a brief summary of changes:
The sample projects now work again with AGP 7.3.x. Was hoping to get some feedback on this approach and especially the two remaining issues before continuing.