1// 2// Copyright (C) 2011 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_performance", 25} 26 27cc_defaults { 28 name: "libartbase_defaults", 29 defaults: ["art_defaults"], 30 host_supported: true, 31 srcs: [ 32 "arch/instruction_set.cc", 33 "base/allocator.cc", 34 "base/arena_allocator.cc", 35 "base/arena_bit_vector.cc", 36 "base/bit_vector.cc", 37 "base/compiler_filter.cc", 38 "base/file_magic.cc", 39 "base/file_utils.cc", 40 "base/flags.cc", 41 "base/hex_dump.cc", 42 "base/logging.cc", 43 "base/malloc_arena_pool.cc", 44 "base/membarrier.cc", 45 "base/memfd.cc", 46 "base/memory_region.cc", 47 "base/mem_map.cc", 48 // "base/mem_map_fuchsia.cc", put in target when fuchsia supported by soong 49 "base/metrics/metrics_common.cc", 50 "base/os_linux.cc", 51 "base/pointer_size.cc", 52 "base/runtime_debug.cc", 53 "base/scoped_arena_allocator.cc", 54 "base/scoped_flock.cc", 55 "base/socket_peer_is_trusted.cc", 56 "base/time_utils.cc", 57 "base/unix_file/fd_file.cc", 58 "base/unix_file/random_access_file_utils.cc", 59 "base/utils.cc", 60 "base/zip_archive.cc", 61 ], 62 target: { 63 android: { 64 srcs: [ 65 "base/globals_unix.cc", 66 "base/mem_map_unix.cc", 67 ], 68 static: { 69 cflags: ["-DART_STATIC_LIBARTBASE"], 70 }, 71 static_libs: [ 72 "libcap", 73 "libmodules-utils-build", 74 // ZipArchive support, the order matters here to get all symbols. 75 "libziparchive", 76 ], 77 whole_static_libs: ["libtinyxml2"], 78 shared_libs: [ 79 "libz", 80 "liblog", 81 // For ashmem. 82 "libartpalette", 83 // For common macros. 84 "libbase", 85 ], 86 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 87 export_static_lib_headers: [ 88 "libcap", 89 ], 90 }, 91 not_windows: { 92 srcs: [ 93 "base/globals_unix.cc", 94 "base/mem_map_unix.cc", 95 ], 96 static: { 97 cflags: ["-DART_STATIC_LIBARTBASE"], 98 }, 99 whole_static_libs: ["libtinyxml2"], 100 shared_libs: [ 101 "libziparchive", 102 "libz", 103 "liblog", 104 // For ashmem. 105 "libartpalette", 106 // For common macros. 107 "libbase", 108 ], 109 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 110 }, 111 linux_glibc: { 112 static_libs: [ 113 "libcap", 114 ], 115 export_static_lib_headers: [ 116 "libcap", 117 ], 118 }, 119 windows: { 120 srcs: [ 121 "base/mem_map_windows.cc", 122 ], 123 static_libs: [ 124 "libziparchive", 125 "libz", 126 "liblog", 127 // For ashmem. 128 "libartpalette", 129 // For common macros. 130 "libbase", 131 ], 132 whole_static_libs: ["libtinyxml2"], 133 export_static_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 134 135 cflags: ["-Wno-thread-safety"], 136 }, 137 darwin: { 138 enabled: true, // for libdexfile. 139 // TODO(b/350967139): Move art-aconfig-flags-lib to the top level 140 // when aconfig supports windows. Until then it's harder to use 141 // flags in code that needs to build for them, e.g. libartbase, 142 // libdexfile, and dexdump. 143 static_libs: [ 144 "art-aconfig-flags-lib", 145 ], 146 export_static_lib_headers: [ 147 "art-aconfig-flags-lib", 148 ], 149 }, 150 linux: { 151 // TODO(b/350967139): Move art-aconfig-flags-lib to the top level 152 // when aconfig supports windows. Until then it's harder to use 153 // flags in code that needs to build for them, e.g. libartbase, 154 // libdexfile, and dexdump. 155 static_libs: [ 156 "art-aconfig-flags-lib", 157 ], 158 export_static_lib_headers: [ 159 "art-aconfig-flags-lib", 160 ], 161 }, 162 }, 163 generated_sources: ["art_libartbase_operator_srcs"], 164 165 export_include_dirs: ["."], 166} 167 168cc_defaults { 169 name: "libartbase_static_base_defaults", 170 whole_static_libs: [ 171 "libbase", 172 "libartpalette", 173 "liblog", 174 "libz", 175 "libziparchive", 176 ], 177 target: { 178 android: { 179 whole_static_libs: [ 180 "libcap", 181 ], 182 }, 183 linux_glibc: { 184 whole_static_libs: [ 185 "libcap", 186 ], 187 }, 188 }, 189} 190 191cc_defaults { 192 name: "libartbase_static_defaults", 193 defaults: ["libartbase_static_base_defaults"], 194 whole_static_libs: ["libartbase"], 195} 196 197cc_defaults { 198 name: "libartbased_static_defaults", 199 defaults: ["libartbase_static_base_defaults"], 200 whole_static_libs: ["libartbased"], 201} 202 203gensrcs { 204 name: "art_libartbase_operator_srcs", 205 cmd: "$(location generate_operator_out) art/libartbase $(in) > $(out)", 206 tools: ["generate_operator_out"], 207 srcs: [ 208 "arch/instruction_set.h", 209 "base/allocator.h", 210 "base/unix_file/fd_file.h", 211 ], 212 output_extension: "operator_out.cc", 213} 214 215art_cc_library { 216 name: "libartbase", 217 defaults: [ 218 "libartbase_defaults", 219 "libart_nativeunwind_defaults", 220 ], 221 visibility: [ 222 // TODO(b/183483755): Please visibility checks when the prebuilt 223 // libartbase is present but not preferred, and the prebuilt libdexfile 224 // hence depends on the source instead. 225 // TODO(b/172480617): Alternatively, clean up when we no longer need to 226 // support both prebuilts and sources present simultaneously. 227 "//prebuilts/module_sdk/art/current/host-exports", 228 // TODO(b/133140750): Clean this up. 229 "//packages/modules/NetworkStack/tests:__subpackages__", 230 ], 231 apex_available: [ 232 "com.android.art", 233 "com.android.art.debug", 234 ], 235 236 target: { 237 windows: { 238 // Control the enabled property here rather than in 239 // libartbase_defaults, to ensure it overrides properties inherited 240 // from other defaults. 241 enabled: true, 242 shared: { 243 enabled: false, 244 }, 245 }, 246 }, 247 afdo: true, 248} 249 250art_cc_library { 251 name: "libartbased", 252 defaults: [ 253 "art_debug_defaults", 254 "libartbase_defaults", 255 ], 256 apex_available: [ 257 "com.android.art.debug", 258 ], 259 260 target: { 261 windows: { 262 // Control the enabled property here rather than in 263 // libartbase_defaults, to ensure it overrides properties inherited 264 // from other defaults, in particular any inherited via 265 // art_debug_defaults. 266 enabled: true, 267 shared: { 268 enabled: false, 269 }, 270 }, 271 }, 272} 273 274art_cc_defaults { 275 name: "libartbase-art-gtest-defaults", 276 srcs: [ 277 "base/common_art_test.cc", 278 ], 279 header_libs: [ 280 "libnativehelper_header_only", 281 // Required for "base/mutex.h" in common_art_test.cc 282 "libart_headers", 283 ], 284 static: { 285 whole_static_libs: [ 286 "libcap", 287 ], 288 }, 289 shared: { 290 static_libs: [ 291 "libcap", 292 ], 293 }, 294} 295 296art_cc_library_static { 297 name: "libartbase-art-gtest", 298 defaults: [ 299 "libart-gtest-defaults", 300 "libartbase-art-gtest-defaults", 301 "libartbase_static_defaults", 302 "libdexfile_static_defaults", 303 ], 304} 305 306art_cc_library_static { 307 name: "libartbased-art-gtest", 308 defaults: [ 309 "art_debug_defaults", 310 "libart-gtest-defaults", 311 "libartbase-art-gtest-defaults", 312 "libartbased_static_defaults", 313 "libdexfiled_static_defaults", 314 ], 315} 316 317art_cc_library_static { 318 name: "libartbase-testing", 319 defaults: [ 320 "art_defaults", 321 ], 322 host_supported: true, 323 srcs: [ 324 "base/testing.cc", 325 ], 326 header_libs: [ 327 "libbase_headers", 328 "art_libartbase_headers", 329 ], 330} 331 332art_cc_defaults { 333 name: "art_libartbase_tests_defaults", 334 tidy_timeout_srcs: [ 335 "base/bit_utils_test.cc", 336 "base/intrusive_forward_list_test.cc", 337 ], 338 srcs: [ 339 "arch/instruction_set_test.cc", 340 "base/arena_allocator_test.cc", 341 "base/bit_field_test.cc", 342 "base/bit_memory_region_test.cc", 343 "base/bit_string_test.cc", 344 "base/bit_struct_test.cc", 345 "base/bit_table_test.cc", 346 "base/bit_utils_test.cc", 347 "base/bit_vector_test.cc", 348 "base/compiler_filter_test.cc", 349 "base/file_utils_test.cc", 350 "base/flags_test.cc", 351 "base/hash_map_test.cc", 352 "base/hash_set_test.cc", 353 "base/hex_dump_test.cc", 354 "base/histogram_test.cc", 355 "base/indenter_test.cc", 356 "base/intrusive_forward_list_test.cc", 357 "base/leb128_test.cc", 358 "base/logging_test.cc", 359 "base/memfd_test.cc", 360 "base/membarrier_test.cc", 361 "base/memory_region_test.cc", 362 "base/mem_map_test.cc", 363 "base/metrics/metrics_test.cc", 364 "base/scoped_flock_test.cc", 365 "base/time_utils_test.cc", 366 "base/transform_array_ref_test.cc", 367 "base/transform_iterator_test.cc", 368 "base/unix_file/fd_file_test.cc", 369 "base/utils_test.cc", 370 "base/variant_map_test.cc", 371 "base/zip_archive_test.cc", 372 ], 373 static_libs: [ 374 "libgmock", 375 ], 376} 377 378// Version of ART gtest `art_libartbase_tests` bundled with the ART APEX on target. 379// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. 380art_cc_test { 381 name: "art_libartbase_tests", 382 defaults: [ 383 "art_gtest_defaults", 384 "art_libartbase_tests_defaults", 385 ], 386} 387 388// Standalone version of ART gtest `art_libartbase_tests`, not bundled with the ART APEX on target. 389art_cc_test { 390 name: "art_standalone_libartbase_tests", 391 defaults: [ 392 "art_standalone_gtest_defaults", 393 "art_libartbase_tests_defaults", 394 ], 395 data: [":generate-boot-image"], 396 test_config_template: ":art-gtests-target-standalone-with-boot-image-template", 397} 398 399cc_library_headers { 400 name: "art_libartbase_headers", 401 defaults: ["art_defaults"], 402 host_supported: true, 403 export_include_dirs: ["."], 404 shared_libs: ["libbase"], 405 export_shared_lib_headers: ["libbase"], 406 407 whole_static_libs: ["libtinyxml2"], 408 409 apex_available: [ 410 "com.android.art", 411 "com.android.art.debug", 412 ], 413} 414