From b019e5ea0957ec9e0e90fa40a685078e3608a936 Mon Sep 17 00:00:00 2001 From: Googler Date: Fri, 16 Oct 2015 21:00:41 +0000 Subject: 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 --- .../android/AndroidResourceProcessingAction.java | 26 +++++++++++++++++----- 1 file changed, 20 insertions(+), 6 deletions(-) (limited to 'src/tools/android/java') 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 data; + + "resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin" + + "[,resources[#resources]:assets[#assets]:manifest:r.txt:symbols.bin]") + public List 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 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 data = ImmutableList.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, -- cgit v1.2.3