diff options
Diffstat (limited to 'dex2oat/dex2oat.cc')
| -rw-r--r-- | dex2oat/dex2oat.cc | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/dex2oat/dex2oat.cc b/dex2oat/dex2oat.cc index c4e53987eb..64db7be79c 100644 --- a/dex2oat/dex2oat.cc +++ b/dex2oat/dex2oat.cc @@ -456,6 +456,12 @@ NO_RETURN static void Usage(const char* fmt, ...) { UsageError(" --deduplicate-code=true|false: enable|disable code deduplication. Deduplicated"); UsageError(" code will have an arbitrary symbol tagged with [DEDUPED]."); UsageError(""); + UsageError(" --compilation-reason=<string>: optional metadata specifying the reason for"); + UsageError(" compiling the apk. If specified, the string will be embedded verbatim in"); + UsageError(" the key value store of the oat file."); + UsageError(""); + UsageError(" Example: --compilation-reason=install"); + UsageError(""); std::cerr << "See log for usage error information\n"; exit(EXIT_FAILURE); } @@ -1212,6 +1218,7 @@ class Dex2Oat FINAL { AssignIfExists(args, M::ClasspathDir, &classpath_dir_); AssignIfExists(args, M::DirtyImageObjects, &dirty_image_objects_filename_); AssignIfExists(args, M::ImageFormat, &image_storage_mode_); + AssignIfExists(args, M::CompilationReason, &compilation_reason_); AssignIfExists(args, M::Backend, &compiler_kind_); parser_options->requested_specific_compiler = args.Exists(M::Backend); @@ -1512,6 +1519,10 @@ class Dex2Oat FINAL { return dex2oat::ReturnCode::kOther; } + if (!compilation_reason_.empty()) { + key_value_store_->Put(OatHeader::kCompilationReasonKey, compilation_reason_); + } + if (IsBootImage() && image_filenames_.size() > 1) { // If we're compiling the boot image, store the boot classpath into the Key-Value store. // We need this for the multi-image case. @@ -2907,6 +2918,9 @@ class Dex2Oat FINAL { // Whether the given input vdex is also the output. bool update_input_vdex_ = false; + // The reason for invoking the compiler. + std::string compilation_reason_; + DISALLOW_IMPLICIT_CONSTRUCTORS(Dex2Oat); }; |