diff --git a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java index 465bf7c606d5b6..778561bfb9ff1e 100644 --- a/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java +++ b/src/tools/android/java/com/google/devtools/build/android/Aapt2ResourcePackagingAction.java @@ -13,6 +13,7 @@ // limitations under the License. package com.google.devtools.build.android; +import static com.google.common.collect.ImmutableList.toImmutableList; import static com.google.common.collect.Streams.concat; import static java.util.stream.Collectors.toList; @@ -344,6 +345,16 @@ public static final class Options extends OptionsBase { effectTags = {OptionEffectTag.AFFECTS_OUTPUTS}, help = "When generating proguard configurations, include location references.") public boolean includeProguardLocationReferences; + + @Option( + name = "resourceApks", + defaultValue = "null", + category = "input", + converter = PathListConverter.class, + documentationCategory = OptionDocumentationCategory.UNCATEGORIZED, + effectTags = {OptionEffectTag.UNKNOWN}, + help = "List of reource only APK files to link against.") + public List resourceApks; } public static void main(String[] args) throws Exception { @@ -474,6 +485,12 @@ public static void main(String[] args) throws Exception { .collect(toList())); } + ImmutableList resourceApks = ImmutableList.of(); + if (options.resourceApks != null) { + resourceApks = + options.resourceApks.stream().map(StaticLibrary::from).collect(toImmutableList()); + } + final PackagedResources packagedResources = ResourceLinker.create(aaptConfigOptions.aapt2, executorService, linkedOut) .profileUsing(profiler) @@ -482,6 +499,7 @@ public static void main(String[] args) throws Exception { options.packageId != -1 ? Optional.of(options.packageId) : Optional.empty()) .outputAsProto(aaptConfigOptions.resourceTableAsProto) .dependencies(ImmutableList.copyOf(dependencies)) + .resourceApks(resourceApks) .include(compiledResourceDeps) .withAssets(assetDirs) .buildVersion(aaptConfigOptions.buildToolsVersion)