diff options
author | 2015-10-16 21:00:41 +0000 | |
---|---|---|
committer | 2015-10-19 08:20:43 +0000 | |
commit | b019e5ea0957ec9e0e90fa40a685078e3608a936 (patch) | |
tree | 368d1841a0c1401aecb97810fed5cdb57b8a4276 /src/tools/android/java/com/google | |
parent | 7637f9cba731e1c93ad3be637f94612a581efe5e (diff) |
Trying again with checking for the presence of the "resources" attribute.
Change the resource dependency handling to separate between the transitive and direct resources from libraries.
This slightly increases the complexity of resource propagation. The initial algorithm was to simply merge all transitive ResourceContainers together with any new ResourceContainer and propagate them via the AndroidResourcesProvider. The new algorithm is encapsulated inside a new ResourceDependencies class which works as follows:
1. Collect resources from the deps into transitive and direct NestedSets
2. If a rule provides a ResourceContainer, merge the transitive and direct into a new transitive set
3. Export the provider
This results having a rule without resources "forward" the merged sets of transitive and direct resources to the next rule.
--
MOS_MIGRATED_REVID=105631635
Diffstat (limited to 'src/tools/android/java/com/google')
-rw-r--r-- | src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java | 26 |
1 files changed, 20 insertions, 6 deletions
diff --git a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java index 5d8ef6c27c..c9a25b26d6 100644 --- a/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java +++ b/src/tools/android/java/com/google/devtools/build/android/AndroidResourceProcessingAction.java @@ -137,11 +137,21 @@ public class AndroidResourceProcessingAction { defaultValue = "", converter = DependencyAndroidDataListConverter.class, category = "input", - help = "Additional Data dependencies. These values will be used if not defined in the " + help = "Transitive Data dependencies. These values will be used if not defined in the " + "primary resources. The expected format is " - + "resources[#resources]:assets[#assets]:manifest:r.txt:symbols.txt" - + "[,resources[#resources]:assets[#assets]:manifest:r.txt:symbols.txt]") - public List<DependencyAndroidData> data; + + "resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin" + + "[,resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin]") + public List<DependencyAndroidData> transitiveData; + + @Option(name = "directData", + defaultValue = "", + converter = DependencyAndroidDataListConverter.class, + category = "input", + help = "Direct Data dependencies. These values will be used if not defined in the " + + "primary resources. The expected format is " + + "resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin" + + "[,resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin]") + public List<DependencyAndroidData> directData; @Option(name = "rOutput", defaultValue = "null", @@ -298,11 +308,15 @@ public class AndroidResourceProcessingAction { new PackedResourceTarExpander(expandedOut, working), new FileDeDuplicator(Hashing.murmur3_128(), deduplicatedOut, working)); + List<DependencyAndroidData> data = ImmutableList.<DependencyAndroidData>builder() + .addAll(options.directData) + .addAll(options.transitiveData) + .build(); final AndroidBuilder builder = sdkTools.createAndroidBuilder(); final MergedAndroidData mergedData = resourceProcessor.mergeData( options.primaryData, - options.data, + data, mergedResources, mergedAssets, modifiers, @@ -329,7 +343,7 @@ public class AndroidResourceProcessingAction { options.versionCode, options.versionName, filteredData, - options.data, + data, working.resolve("manifest"), generatedSources, options.packagePath, |