1// 2// Copyright (C) 2020 The Android Open Source Project 3// 4// Licensed under the Apache License, Version 2.0 (the "License"); 5// you may not use this file except in compliance with the License. 6// You may obtain a copy of the License at 7// 8// http://www.apache.org/licenses/LICENSE-2.0 9// 10// Unless required by applicable law or agreed to in writing, software 11// distributed under the License is distributed on an "AS IS" BASIS, 12// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 13// See the License for the specific language governing permissions and 14// limitations under the License. 15// 16 17package { 18 // See: http://go/android-license-faq 19 // A large-scale-change added 'default_applicable_licenses' to import 20 // all of the 'license_kinds' from "art_license" 21 // to get the below license kinds: 22 // SPDX-license-identifier-Apache-2.0 23 default_applicable_licenses: ["art_license"], 24 default_team: "trendy_team_art_mainline", 25} 26 27cc_defaults { 28 name: "odrefresh-defaults", 29 srcs: [ 30 "odrefresh.cc", 31 "odr_common.cc", 32 "odr_compilation_log.cc", 33 "odr_fs_utils.cc", 34 "odr_metrics.cc", 35 "odr_metrics_record.cc", 36 ], 37 local_include_dirs: ["include"], 38 header_libs: ["dexoptanalyzer_headers"], 39 generated_sources: [ 40 "apex-info-list-tinyxml", 41 "art-apex-cache-info", 42 "art-odrefresh-operator-srcs", 43 ], 44 shared_libs: [ 45 "liblog", 46 "libselinux", 47 ], 48 static_libs: [ 49 "libmodules-utils-build", 50 ], 51 tidy: true, 52 tidy_disabled_srcs: [":art-apex-cache-info"], 53 tidy_flags: [ 54 "-format-style=file", 55 "-header-filter=(art/odrefresh/|system/apex/)", 56 ], 57} 58 59cc_defaults { 60 name: "odrefresh_binary_defaults", 61 defaults: [ 62 "art_defaults", 63 "odrefresh-defaults", 64 ], 65 srcs: ["odrefresh_main.cc"], 66 shared_libs: [ 67 "libarttools", 68 "libbase", 69 "libdexfile", 70 ], 71 target: { 72 android: { 73 compile_multilib: "first", 74 }, 75 }, 76} 77 78cc_defaults { 79 name: "odrefresh_headers_defaults", 80 defaults: ["art_defaults"], 81 export_include_dirs: ["include"], 82 host_supported: true, 83 stl: "none", 84 system_shared_libs: [], 85 sdk_version: "minimum", // The minimum sdk version required by users of this module. 86} 87 88cc_library_headers { 89 name: "odrefresh_headers", 90 defaults: ["odrefresh_headers_defaults"], 91 apex_available: [ 92 "//apex_available:platform", // For odsign. 93 ], 94 visibility: ["//visibility:public"], 95} 96 97// Same header as above, but for use within the ART module. This is separated 98// from above so that the build system doesn't incorrectly recognize it as a 99// dependency of the ART module exported by the platform. 100cc_library_headers { 101 name: "odrefresh_headers_art", 102 defaults: ["odrefresh_headers_defaults"], 103 apex_available: [ 104 "com.android.art", 105 "com.android.art.debug", 106 ], 107 visibility: [ 108 "//art:__subpackages__", 109 ], 110} 111 112gensrcs { 113 name: "art-odrefresh-operator-srcs", 114 cmd: "$(location generate_operator_out) art/odrefresh $(in) > $(out)", 115 tools: ["generate_operator_out"], 116 srcs: [ 117 "odr_metrics.h", 118 ], 119 output_extension: "operator_out.cc", 120} 121 122art_cc_binary { 123 name: "odrefresh", 124 defaults: ["odrefresh_binary_defaults"], 125 required: [ 126 "dexoptanalyzer", 127 "dex2oat", 128 ], 129 shared_libs: [ 130 "libart", 131 "libartbase", 132 ], 133 apex_available: [ 134 "com.android.art", 135 "com.android.art.debug", 136 "test_broken_com.android.art", 137 ], 138} 139 140// A no-op version of the odrefresh binary. 141art_cc_binary { 142 name: "odrefresh_broken", 143 defaults: ["art_defaults"], 144 stem: "odrefresh", 145 local_include_dirs: ["include"], 146 header_libs: ["libbase_headers"], 147 srcs: ["odrefresh_broken.cc"], 148 installable: false, 149 apex_available: ["test_jitzygote_com.android.art"], 150} 151 152art_cc_binary { 153 name: "odrefreshd", 154 defaults: [ 155 "art_debug_defaults", 156 "odrefresh_binary_defaults", 157 ], 158 required: [ 159 "dexoptanalyzerd", 160 "dex2oatd", 161 ], 162 shared_libs: [ 163 "libartd", 164 "libartbased", 165 ], 166 apex_available: [ 167 "com.android.art.debug", 168 // TODO(b/183882457): This binary doesn't go into com.android.art, but 169 // apex_available lists need to be the same for internal libs to avoid 170 // stubs, and this depends on libartd. 171 "com.android.art", 172 "test_broken_com.android.art", 173 ], 174} 175 176cc_library_static { 177 name: "libodrstatslog", 178 defaults: ["art_defaults"], 179 host_supported: true, 180 export_include_dirs: ["include"], 181 local_include_dirs: ["include"], 182 header_libs: ["libart_headers"], 183 shared_libs: ["libartbase"], 184 target: { 185 android: { 186 generated_headers: ["statslog_odrefresh.h"], 187 generated_sources: ["statslog_odrefresh.cpp"], 188 srcs: [ 189 "odr_metrics_record.cc", 190 "odr_statslog_android.cc", 191 ], 192 shared_libs: [ 193 "libstatspull", 194 "libstatssocket", 195 ], 196 }, 197 host: { 198 srcs: ["odr_statslog_host.cc"], 199 }, 200 }, 201 apex_available: [ 202 "com.android.art", 203 "com.android.art.debug", 204 ], 205} 206 207art_cc_defaults { 208 name: "art_odrefresh_tests_defaults", 209 defaults: ["odrefresh-defaults"], 210 header_libs: ["odrefresh_headers"], 211 srcs: [ 212 "odr_artifacts_test.cc", 213 "odr_common_test.cc", 214 "odr_compilation_log_test.cc", 215 "odr_fs_utils_test.cc", 216 "odr_metrics_test.cc", 217 "odr_metrics_record_test.cc", 218 "odrefresh_test.cc", 219 ], 220 static_libs: [ 221 "libgmock", 222 ], 223} 224 225// Version of ART gtest `art_odrefresh_tests` bundled with the ART APEX on target. 226// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. 227art_cc_test { 228 name: "art_odrefresh_tests", 229 defaults: [ 230 "art_gtest_defaults", 231 "art_odrefresh_tests_defaults", 232 ], 233 host_supported: false, 234 shared_libs: [ 235 "libarttools", 236 "libbase", 237 ], 238 // The test config template is needed even though it's not used by the test 239 // runner. Otherwise, Soong will generate a test config, which is adding 240 // `art-host-test` as a test tag, while this test does not support running 241 // on host. 242 // TODO(b/214016626): Remove this line once the bug is fixed. 243 test_config_template: "//art/test:art-gtests-target-standalone-template", 244} 245 246// Standalone version of ART gtest `art_odrefresh_tests`, not bundled with the ART APEX on target. 247art_cc_test { 248 name: "art_standalone_odrefresh_tests", 249 defaults: [ 250 "art_standalone_gtest_defaults", 251 "art_odrefresh_tests_defaults", 252 ], 253 static_libs: [ 254 "libarttools", 255 "libbase", 256 ], 257} 258 259genrule { 260 name: "statslog_odrefresh.h", 261 tools: ["stats-log-api-gen"], 262 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_odrefresh.h --module art --namespace art,metrics,statsd", 263 out: [ 264 "statslog_odrefresh.h", 265 ], 266} 267 268genrule { 269 name: "statslog_odrefresh.cpp", 270 tools: ["stats-log-api-gen"], 271 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_odrefresh.cpp --module art --namespace art,metrics,statsd --importHeader statslog_odrefresh.h", 272 out: [ 273 "statslog_odrefresh.cpp", 274 ], 275} 276 277xsd_config { 278 name: "art-apex-cache-info", 279 srcs: ["CacheInfo.xsd"], 280 package_name: "com.android.art", 281 api_dir: "schema", 282 gen_writer: true, 283 tinyxml: true, 284} 285