Implement resource merging for flavored source sets #89
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.
This PR introduces new API in the previously introduced unified macro #87 for resource pre-processing.
In AGP land, we can have multiple resource directories for a variant and before calling
aapt
AGP would merge these sources based on priority orderBuildType -> Flavor -> main -> Dependencies
. This PR tries to implement the same functionality by introducing a new toolRESOURCE_MERGER
and a new android rule APIresources
to specify multiple source sets. Internally merging is performed using same code from theandroid_tools
package that bazel uses and then the result is passed toresource_files
as usual.The structure lays foundation for worker support, asset and manifest merging support later on.
Implementation notes
resource_files
APItools/aapt_lite/src/main/java/com/google/devtools/build/android/ResourceMerger.java
is in Java sinceandroid_tools
had trouble getting added as Kotlin dependencydict
so as to pass additional information like manifests in the future.Example usage