summaryrefslogtreecommitdiff
path: root/tools/aapt2
diff options
context:
space:
mode:
authorRyan Mitchell <rtmitchell@google.com>2020-05-08 17:46:11 +0000
committerAutomerger Merge Worker <android-build-automerger-merge-worker@system.gserviceaccount.com>2020-05-08 17:46:11 +0000
commit98b076b85d4980eb44ee74a7d6fa9129ace8e787 (patch)
tree781c88d9ac80be28d8c8feac83bd3d6feb5720ce /tools/aapt2
parent66df0db3831eb7c75f6584a35fb93ada3f508e92 (diff)
parent5c8dd641bae6ca09a61ba9b6dae76789d9b8e399 (diff)
Merge "Do not rename R.java package" into rvc-dev am: 5c8dd641ba
Change-Id: I4a15555cf1df7c81a4d4eea2c77ec0d71df5c44f
Diffstat (limited to 'tools/aapt2')
-rw-r--r--tools/aapt2/cmd/Link.cpp17
1 files changed, 12 insertions, 5 deletions
diff --git a/tools/aapt2/cmd/Link.cpp b/tools/aapt2/cmd/Link.cpp
index bf886c2f893f..3a3fb2826b74 100644
--- a/tools/aapt2/cmd/Link.cpp
+++ b/tools/aapt2/cmd/Link.cpp
@@ -1766,16 +1766,23 @@ class Linker {
return 1;
}
- // 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 =
+ // First extract the Package name without modifying it (via --rename-manifest-package).
+ 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);
}
+ // Determine the package name under which to merge resources.
+ if (options_.rename_resources_package) {
+ if (!options_.custom_java_package) {
+ // Generate the R.java under the original package name instead of the package name specified
+ // through --rename-resources-package.
+ options_.custom_java_package = context_->GetCompilationPackage();
+ }
+ context_->SetCompilationPackage(options_.rename_resources_package.value());
+ }
+
// Now that the compilation package is set, load the dependencies. This will also extract
// the Android framework's versionCode and versionName, if they exist.
if (!LoadSymbolsFromIncludePaths()) {