diff options
-rw-r--r-- | odrefresh/Android.bp | 24 | ||||
-rw-r--r-- | odrefresh/odr_config.h | 4 | ||||
-rw-r--r-- | odrefresh/odrefresh.cc | 3 | ||||
-rw-r--r-- | odrefresh/odrefresh_main.cc | 3 | ||||
-rw-r--r-- | odrefresh/odrefresh_test.cc | 17 |
5 files changed, 48 insertions, 3 deletions
diff --git a/odrefresh/Android.bp b/odrefresh/Android.bp index 8b6ea8de6f..761c8eff0b 100644 --- a/odrefresh/Android.bp +++ b/odrefresh/Android.bp @@ -74,20 +74,40 @@ cc_defaults { }, } -cc_library_headers { - name: "odrefresh_headers", +cc_defaults { + name: "odrefresh_headers_defaults", defaults: ["art_defaults"], export_include_dirs: ["include"], host_supported: true, stl: "none", system_shared_libs: [], sdk_version: "minimum", // The minimum sdk version required by users of this module. +} + +cc_library_headers { + name: "odrefresh_headers", + defaults: ["odrefresh_headers_defaults"], apex_available: [ "//apex_available:platform", // For odsign. ], visibility: ["//visibility:public"], } +// Same header as above, but for use within the ART module. This is separated +// from above so that the build system doesn't incorrectly recognize it as a +// dependency of the ART module exported by the platform. +cc_library_headers { + name: "odrefresh_headers_art", + defaults: ["odrefresh_headers_defaults"], + apex_available: [ + "com.android.art", + "com.android.art.debug", + ], + visibility: [ + "//art:__subpackages__", + ], +} + gensrcs { name: "art-odrefresh-operator-srcs", cmd: "$(location generate_operator_out) art/odrefresh $(in) > $(out)", diff --git a/odrefresh/odr_config.h b/odrefresh/odr_config.h index e8f44e181a..20eca87898 100644 --- a/odrefresh/odr_config.h +++ b/odrefresh/odr_config.h @@ -136,6 +136,7 @@ class OdrConfig final { std::string standalone_system_server_jars_; bool compilation_os_mode_ = false; bool minimal_ = false; + bool only_boot_images_ = false; // The current values of system properties listed in `kSystemProperties`. std::unordered_map<std::string, std::string> system_properties_; @@ -230,6 +231,7 @@ class OdrConfig final { } bool GetCompilationOsMode() const { return compilation_os_mode_; } bool GetMinimal() const { return minimal_; } + bool GetOnlyBootImages() const { return only_boot_images_; } const OdrSystemProperties& GetSystemProperties() const { return odr_system_properties_; } void SetApexInfoListFile(const std::string& file_path) { apex_info_list_file_ = file_path; } @@ -281,6 +283,8 @@ class OdrConfig final { void SetMinimal(bool value) { minimal_ = value; } + void SetOnlyBootImages(bool value) { only_boot_images_ = value; } + std::unordered_map<std::string, std::string>* MutableSystemProperties() { return &system_properties_; } diff --git a/odrefresh/odrefresh.cc b/odrefresh/odrefresh.cc index 4b9688781b..7dda0b043a 100644 --- a/odrefresh/odrefresh.cc +++ b/odrefresh/odrefresh.cc @@ -2178,7 +2178,8 @@ WARN_UNUSED ExitCode OnDeviceRefresh::Compile(OdrMetrics& metrics, } // Don't compile system server if the compilation of BCP failed. - if (!system_server_isa_failed && !compilation_options.system_server_jars_to_compile.empty()) { + if (!system_server_isa_failed && !compilation_options.system_server_jars_to_compile.empty() && + !config_.GetOnlyBootImages()) { OdrMetrics::Stage stage = OdrMetrics::Stage::kSystemServerClasspath; CompilationResult ss_result = CompileSystemServer( staging_dir, compilation_options.system_server_jars_to_compile, advance_animation_progress); diff --git a/odrefresh/odrefresh_main.cc b/odrefresh/odrefresh_main.cc index 85bcf5c48d..144a9e97ae 100644 --- a/odrefresh/odrefresh_main.cc +++ b/odrefresh/odrefresh_main.cc @@ -165,6 +165,8 @@ int InitializeConfig(int argc, char** argv, OdrConfig* config) { config->SetRefresh(false); } else if (ArgumentEquals(arg, "--minimal")) { config->SetMinimal(true); + } else if (ArgumentEquals(arg, "--only-boot-images")) { + config->SetOnlyBootImages(true); } else { ArgumentError("Unrecognized argument: '%s'", arg); } @@ -247,6 +249,7 @@ NO_RETURN void UsageHelp(const char* argv0) { UsageMsg(" Compiler filter that overrides"); UsageMsg(" dalvik.vm.systemservercompilerfilter"); UsageMsg("--minimal Generate a minimal boot image only."); + UsageMsg("--only-boot-images Generate boot images only."); exit(EX_USAGE); } diff --git a/odrefresh/odrefresh_test.cc b/odrefresh/odrefresh_test.cc index 91e1f66803..424b606ff8 100644 --- a/odrefresh/odrefresh_test.cc +++ b/odrefresh/odrefresh_test.cc @@ -994,5 +994,22 @@ TEST_F(OdRefreshTest, CompileSystemServerChoosesBootImage_OnSystem) { ExitCode::kCompilationSuccess); } +TEST_F(OdRefreshTest, OnlyBootImages) { + config_.SetOnlyBootImages(true); + + // Primary. + EXPECT_CALL(*mock_exec_utils_, DoExecAndReturnCode(Contains(Flag("--dex-file=", core_oj_jar_)))) + .Times(2) + .WillRepeatedly(Return(0)); + + // Mainline extension. + EXPECT_CALL(*mock_exec_utils_, DoExecAndReturnCode(Contains(Flag("--dex-file=", conscrypt_jar_)))) + .Times(2) + .WillRepeatedly(Return(0)); + + EXPECT_EQ(odrefresh_->Compile(*metrics_, CompilationOptions::CompileAll(*odrefresh_)), + ExitCode::kCompilationSuccess); +} + } // namespace odrefresh } // namespace art |