AAPT2: Automatic Static Library Namespacing.
Introduces a link flag --auto-namespace-static-lib for use when linking
static libraries.
When linking a static library with compiled sources that have references
to resources in provided libraries without an explicit package name,
the flag enables automatic inference of the package.
If a resource is present in the package that is being compiled, that is
used, otherwise the reference is rewritten to the highest precedence
resource with matching name and type.
Test: m out/host/linux-x86/nativetest64/aapt2_tests/aapt2_tests && \
$ANDROID_HOST_OUT/nativetest64/aapt2_tests/aapt2_tests
Test: m frameworks/base/tools/aapt2/integration-tests
Change-Id: I6c6017e054654d1f60782d0a428a7a2a47f8952b
diff --git a/tools/aapt2/link/XmlReferenceLinker.cpp b/tools/aapt2/link/XmlReferenceLinker.cpp
index 160ff92..420a127 100644
--- a/tools/aapt2/link/XmlReferenceLinker.cpp
+++ b/tools/aapt2/link/XmlReferenceLinker.cpp
@@ -97,8 +97,8 @@
attr_ref.private_reference = maybe_package.value().private_namespace;
std::string err_str;
- attr.compiled_attribute =
- ReferenceLinker::CompileXmlAttribute(attr_ref, callsite_, symbols_, &err_str);
+ attr.compiled_attribute = ReferenceLinker::CompileXmlAttribute(
+ attr_ref, callsite_, symbols_, context_->IsAutoNamespace(), &err_str);
if (!attr.compiled_attribute) {
DiagMessage error_msg(source);