summaryrefslogtreecommitdiff
path: root/tools/aapt2/cmd/Link.cpp
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-02-26 12:45:39 -0800
committerLiz Kammer <eakammer@google.com>2020-05-07 17:03:12 -0700
commit940ae504984a15cb72dc40ad1e12adc7442b7f13 (patch)
treeee3787ae2326a30b0eb322feb82e413f9bfe92c7 /tools/aapt2/cmd/Link.cpp
parent04e78abfd4d5a2c7d79262189e95fe79cacd6e61 (diff)
Add --rename-resources-package to aapt2
There is currently no way to change the package name encoded in the resources table. This change adds a flag that controls rewriting the package name encoded into the resources table. This flag does not rewrite the package name in the manifest xml. (This is a cherry pick.) Bug: 147434671 Test: manual Merged-In: I435ba07e29df0522c3a44cc5f2c460004a02d71c Change-Id: I435ba07e29df0522c3a44cc5f2c460004a02d71c
Diffstat (limited to 'tools/aapt2/cmd/Link.cpp')
-rw-r--r--tools/aapt2/cmd/Link.cpp7
1 files changed, 5 insertions, 2 deletions
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index f354bb610224..77e2a6bb21de 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -1659,9 +1659,12 @@ class Linker {
return 1;
}
- // First extract the Package name without modifying it (via --rename-manifest-package).
- if (Maybe<AppInfo> maybe_app_info =
+ // Determine the package name under which to merge resources.
+ if (options_.rename_resources_package) {
+ context_->SetCompilationPackage(options_.rename_resources_package.value());
+ } else if (Maybe<AppInfo> maybe_app_info =
ExtractAppInfoFromManifest(manifest_xml.get(), context_->GetDiagnostics())) {
+ // Extract the package name from the manifest ignoring the value of --rename-manifest-package.
const AppInfo& app_info = maybe_app_info.value();
context_->SetCompilationPackage(app_info.package);
}