Merge "AAPT2: Add option to disable PNG crunching" into oc-dev
This commit is contained in:
committed by
Android (Google) Code Review
commit
fb194bb81c
@@ -27,7 +27,7 @@ namespace aapt {
|
||||
static const char* sMajorVersion = "2";
|
||||
|
||||
// Update minor version whenever a feature or flag is added.
|
||||
static const char* sMinorVersion = "14";
|
||||
static const char* sMinorVersion = "15";
|
||||
|
||||
int PrintVersion() {
|
||||
std::cerr << "Android Asset Packaging Tool (aapt) " << sMajorVersion << "."
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,13 @@
|
||||
# Android Asset Packaging Tool 2.0 (AAPT2) release notes
|
||||
|
||||
## Version 2.15
|
||||
### `aapt2 compile ...`
|
||||
- Add `--no-crunch` option to avoid processing PNGs during the compile phase. Note that this
|
||||
shouldn't be used as a performance optimization, as once the PNG is processed, its result is
|
||||
cached for incremental linking. This should only be used if the developer has specially
|
||||
pre-processed the PNG and wants it byte-for-byte identical to the input.
|
||||
NOTE: 9-patches will not be processed correctly with this flag set.
|
||||
|
||||
## Version 2.14
|
||||
### `aapt2 link ...`
|
||||
- If an app is building with a minSdkVersion < 26 and a --package-id XX where XX > 7F, aapt2
|
||||
|
||||
Reference in New Issue
Block a user