diff options
author | Adam Lesinski <adamlesinski@google.com> | 2017-05-10 14:56:36 -0700 |
---|---|---|
committer | Adam Lesinski <adamlesinski@google.com> | 2017-05-10 15:00:10 -0700 |
commit | 28e6c0bac2f22e63bc044fc44a82ec5282d2709c (patch) | |
tree | 9ab8474507a84ba0c4f84bf68be65a4f8d345528 /tools/aapt2/cmd/Compile.cpp | |
parent | f93dc8b6504200d0b6d502d924a70a743f9b1411 (diff) |
AAPT2: Add option to disable PNG crunching
When compiling, a developer may want to disable PNG crunching
for a specific set of PNGs.
Bug: 37729284
Test: manual
Change-Id: I134f208f8bb212df07a4eef65b467985a6443375
Diffstat (limited to 'tools/aapt2/cmd/Compile.cpp')
-rw-r--r-- | tools/aapt2/cmd/Compile.cpp | 5 |
1 files changed, 4 insertions, 1 deletions
diff --git a/tools/aapt2/cmd/Compile.cpp b/tools/aapt2/cmd/Compile.cpp index 5413b336ea90..c192d698b500 100644 --- a/tools/aapt2/cmd/Compile.cpp +++ b/tools/aapt2/cmd/Compile.cpp @@ -114,6 +114,7 @@ struct CompileOptions { std::string output_path; Maybe<std::string> res_dir; bool pseudolocalize = false; + bool no_png_crunch = false; bool legacy_mode = false; bool verbose = false; }; @@ -663,6 +664,7 @@ int Compile(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) { "Generate resources for pseudo-locales " "(en-XA and ar-XB)", &options.pseudolocalize) + .OptionalSwitch("--no-crunch", "Disables PNG processing", &options.no_png_crunch) .OptionalSwitch("--legacy", "Treat errors that used to be valid in AAPT as warnings", &options.legacy_mode) .OptionalSwitch("-v", "Enables verbose logging", &verbose); @@ -738,7 +740,8 @@ int Compile(const std::vector<StringPiece>& args, IDiagnostics* diagnostics) { if (!CompileXml(&context, options, path_data, archive_writer.get(), output_filename)) { error = true; } - } else if (path_data.extension == "png" || path_data.extension == "9.png") { + } else if (!options.no_png_crunch && + (path_data.extension == "png" || path_data.extension == "9.png")) { if (!CompilePng(&context, options, path_data, archive_writer.get(), output_filename)) { error = true; } |