diff options
author | 2024-04-16 16:43:49 +0100 | |
---|---|---|
committer | 2024-04-18 10:44:48 +0000 | |
commit | bda11bd68212f6a03381a849b0ee44bebf3ca5ba (patch) | |
tree | da41e18160919cfbe4c251176659631d33a2076e /test/generate-boot-image | |
parent | 16567ac3d6925c0b84c819f2e475c2cadbde5dc3 (diff) |
Add instructions for generating boot images for local Compiler Explorer.
Also, update the instructions to build Compiler Explorer only once.
Bug: 330519779
Test: Follow the instructions.
Change-Id: I9ca1a7de1b81237ff78faff73a277e5504f580a4
Diffstat (limited to 'test/generate-boot-image')
-rw-r--r-- | test/generate-boot-image/generate-boot-image.cc | 12 |
1 files changed, 11 insertions, 1 deletions
diff --git a/test/generate-boot-image/generate-boot-image.cc b/test/generate-boot-image/generate-boot-image.cc index 671aa379f1..3cd992f0c6 100644 --- a/test/generate-boot-image/generate-boot-image.cc +++ b/test/generate-boot-image/generate-boot-image.cc @@ -20,6 +20,7 @@ #include <algorithm> #include <cstdlib> #include <iostream> +#include <iterator> #include <string> #include <vector> @@ -50,7 +51,7 @@ using ::art::testing::GetLibCoreDexLocations; constexpr const char* kUsage = R"( A commandline tool to generate a primary boot image for testing. -Usage: generate-boot-image --output-dir=OUTPUT_DIR [OPTIONS]... +Usage: generate-boot-image --output-dir=OUTPUT_DIR [OPTIONS]... [-- [DEX2OAT_OPTIONS]...] Supported options: --help: Print this text. @@ -79,6 +80,7 @@ Supported options: host. The default on target is based on the ISA of this binary. --core-only=true|false: If true, only compile ART jars. Otherwise, also compile core-icu4j and conscrypt. Default: false + --: Arguments following '--' are directly passed to dex2oat. )"; struct Options { @@ -92,6 +94,7 @@ struct Options { std::string profile_file = ""; std::string instruction_set = ""; bool core_only = false; + std::vector<std::string> dex2oat_options; }; [[noreturn]] void Usage(const std::string& message) { @@ -162,6 +165,9 @@ int GenerateBootImage(const Options& options) { args.push_back(StringPrintf("--image=%s/boot.art", path.c_str())); args.push_back(StringPrintf("--oat-file=%s/boot.oat", path.c_str())); + std::move( + options.dex2oat_options.begin(), options.dex2oat_options.end(), std::back_inserter(args)); + int exit_code = system(BuildCommand(args).c_str()); if (exit_code != 0) { LOG(ERROR) << "dex2oat invocation failed. Exit code: " << exit_code; @@ -203,6 +209,10 @@ int Main(int argc, char** argv) { Usage(ART_FORMAT("Unrecognized --core-only value: '{}'", arg)); } options.core_only = result == ParseBoolResult::kTrue; + } else if (arg == "--") { + for (i++; i < argc; i++) { + options.dex2oat_options.push_back(argv[i]); + } } else { Usage(ART_FORMAT("Unrecognized argument: '{}'", argv[i])); } |