Merge "Add --rename-resources-package to aapt2" into rvc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
57ee107188
@@ -1766,9 +1766,12 @@ class Linker {
|
|||||||
return 1;
|
return 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
// First extract the Package name without modifying it (via --rename-manifest-package).
|
// Determine the package name under which to merge resources.
|
||||||
if (Maybe<AppInfo> maybe_app_info =
|
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())) {
|
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();
|
const AppInfo& app_info = maybe_app_info.value();
|
||||||
context_->SetCompilationPackage(app_info.package);
|
context_->SetCompilationPackage(app_info.package);
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -45,6 +45,7 @@ struct LinkOptions {
|
|||||||
bool auto_add_overlay = false;
|
bool auto_add_overlay = false;
|
||||||
bool override_styles_instead_of_overlaying = false;
|
bool override_styles_instead_of_overlaying = false;
|
||||||
OutputFormat output_format = OutputFormat::kApk;
|
OutputFormat output_format = OutputFormat::kApk;
|
||||||
|
Maybe<std::string> rename_resources_package;
|
||||||
|
|
||||||
// Java/Proguard options.
|
// Java/Proguard options.
|
||||||
Maybe<std::string> generate_java_class_path;
|
Maybe<std::string> generate_java_class_path;
|
||||||
@@ -256,6 +257,8 @@ class LinkCommand : public Command {
|
|||||||
&options_.override_styles_instead_of_overlaying);
|
&options_.override_styles_instead_of_overlaying);
|
||||||
AddOptionalFlag("--rename-manifest-package", "Renames the package in AndroidManifest.xml.",
|
AddOptionalFlag("--rename-manifest-package", "Renames the package in AndroidManifest.xml.",
|
||||||
&options_.manifest_fixer_options.rename_manifest_package);
|
&options_.manifest_fixer_options.rename_manifest_package);
|
||||||
|
AddOptionalFlag("--rename-resources-package", "Renames the package in resources table",
|
||||||
|
&options_.rename_resources_package);
|
||||||
AddOptionalFlag("--rename-instrumentation-target-package",
|
AddOptionalFlag("--rename-instrumentation-target-package",
|
||||||
"Changes the name of the target package for instrumentation. Most useful\n"
|
"Changes the name of the target package for instrumentation. Most useful\n"
|
||||||
"when used in conjunction with --rename-manifest-package.",
|
"when used in conjunction with --rename-manifest-package.",
|
||||||
|
|||||||
Reference in New Issue
Block a user