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} 25 26cc_defaults { 27 name: "libartbase_defaults", 28 defaults: ["art_defaults"], 29 host_supported: true, 30 srcs: [ 31 "arch/instruction_set.cc", 32 "base/allocator.cc", 33 "base/arena_allocator.cc", 34 "base/arena_bit_vector.cc", 35 "base/bit_vector.cc", 36 "base/compiler_filter.cc", 37 "base/enums.cc", 38 "base/file_magic.cc", 39 "base/file_utils.cc", 40 "base/flags.cc", 41 "base/hex_dump.cc", 42 "base/hiddenapi_flags.cc", 43 "base/logging.cc", 44 "base/malloc_arena_pool.cc", 45 "base/membarrier.cc", 46 "base/memfd.cc", 47 "base/memory_region.cc", 48 "base/mem_map.cc", 49 // "base/mem_map_fuchsia.cc", put in target when fuchsia supported by soong 50 "base/metrics/metrics_common.cc", 51 "base/os_linux.cc", 52 "base/runtime_debug.cc", 53 "base/safe_copy.cc", 54 "base/scoped_arena_allocator.cc", 55 "base/scoped_flock.cc", 56 "base/socket_peer_is_trusted.cc", 57 "base/time_utils.cc", 58 "base/unix_file/fd_file.cc", 59 "base/unix_file/random_access_file_utils.cc", 60 "base/utils.cc", 61 "base/zip_archive.cc", 62 ], 63 target: { 64 android: { 65 srcs: [ 66 "base/globals_unix.cc", 67 "base/mem_map_unix.cc", 68 ], 69 static_libs: [ 70 // ZipArchive support, the order matters here to get all symbols. 71 "libziparchive", 72 ], 73 shared_libs: [ 74 "libz", 75 "liblog", 76 // For ashmem. 77 "libartpalette", 78 // For common macros. 79 "libbase", 80 ], 81 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 82 }, 83 not_windows: { 84 srcs: [ 85 "base/globals_unix.cc", 86 "base/mem_map_unix.cc", 87 ], 88 static: { 89 cflags: ["-DART_STATIC_LIBARTBASE"], 90 }, 91 shared_libs: [ 92 "libziparchive", 93 "libz", 94 "liblog", 95 // For ashmem. 96 "libartpalette", 97 // For common macros. 98 "libbase", 99 ], 100 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 101 }, 102 windows: { 103 srcs: [ 104 "base/mem_map_windows.cc", 105 ], 106 static_libs: [ 107 "libziparchive", 108 "libz", 109 "liblog", 110 // For ashmem. 111 "libartpalette", 112 // For common macros. 113 "libbase", 114 ], 115 export_static_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h. 116 117 cflags: ["-Wno-thread-safety"], 118 }, 119 darwin: { 120 enabled: true, // for libdexfile. 121 }, 122 }, 123 generated_sources: ["art_libartbase_operator_srcs"], 124 125 export_include_dirs: ["."], 126} 127 128cc_defaults { 129 name: "libartbase_static_base_defaults", 130 whole_static_libs: [ 131 "libbase", 132 "libartpalette", 133 "liblog", 134 "libz", 135 "libziparchive", 136 ], 137} 138 139cc_defaults { 140 name: "libartbase_static_defaults", 141 defaults: ["libartbase_static_base_defaults"], 142 whole_static_libs: ["libartbase"], 143} 144 145cc_defaults { 146 name: "libartbased_static_defaults", 147 defaults: ["libartbase_static_base_defaults"], 148 whole_static_libs: ["libartbased"], 149} 150 151gensrcs { 152 name: "art_libartbase_operator_srcs", 153 cmd: "$(location generate_operator_out) art/libartbase $(in) > $(out)", 154 tools: ["generate_operator_out"], 155 srcs: [ 156 "arch/instruction_set.h", 157 "base/allocator.h", 158 "base/unix_file/fd_file.h", 159 ], 160 output_extension: "operator_out.cc", 161} 162 163art_cc_library { 164 name: "libartbase", 165 defaults: [ 166 "libartbase_defaults", 167 "libart_nativeunwind_defaults", 168 "art_pgo_defaults", 169 ], 170 visibility: [ 171 // TODO(b/183483755): Please visibility checks when the prebuilt 172 // libartbase is present but not preferred, and the prebuilt libdexfile 173 // hence depends on the source instead. 174 // TODO(b/172480617): Alternatively, clean up when we no longer need to 175 // support both prebuilts and sources present simultaneously. 176 "//prebuilts/module_sdk/art/current/host-exports", 177 // TODO(b/133140750): Clean this up. 178 "//packages/modules/NetworkStack/tests:__subpackages__", 179 ], 180 apex_available: [ 181 "com.android.art", 182 "com.android.art.debug", 183 ], 184 185 shared_libs: [ 186 "libbase", 187 "libziparchive", 188 ], 189 export_shared_lib_headers: ["libbase"], 190 target: { 191 windows: { 192 enabled: true, 193 shared: { 194 enabled: false, 195 }, 196 }, 197 }, 198} 199 200art_cc_library { 201 name: "libartbased", 202 defaults: [ 203 "art_debug_defaults", 204 "libartbase_defaults", 205 ], 206 apex_available: [ 207 "com.android.art.debug", 208 ], 209 shared_libs: [ 210 "libbase", 211 "libziparchive", 212 ], 213 export_shared_lib_headers: ["libbase"], 214 target: { 215 windows: { 216 enabled: true, 217 shared: { 218 enabled: false, 219 }, 220 }, 221 }, 222} 223 224art_cc_defaults { 225 name: "libartbase-art-gtest-defaults", 226 srcs: [ 227 "base/common_art_test.cc", 228 ], 229 shared_libs: [ 230 "libbase", 231 "libbacktrace", 232 ], 233 header_libs: [ 234 "libnativehelper_header_only", 235 ], 236 static: { 237 whole_static_libs: ["libc++fs"], 238 }, 239 shared: { 240 static_libs: ["libc++fs"], 241 }, 242} 243 244art_cc_library { 245 name: "libartbase-art-gtest", 246 defaults: [ 247 "libart-gtest-defaults", 248 "libartbase-art-gtest-defaults", 249 ], 250 shared_libs: [ 251 "libartbase", 252 "libdexfile", 253 ], 254} 255 256art_cc_library { 257 name: "libartbased-art-gtest", 258 defaults: [ 259 "libartd-gtest-defaults", 260 "libartbase-art-gtest-defaults", 261 ], 262 shared_libs: [ 263 "libartbased", 264 "libdexfiled", 265 ], 266} 267 268art_cc_defaults { 269 name: "art_libartbase_tests_defaults", 270 srcs: [ 271 "arch/instruction_set_test.cc", 272 "base/arena_allocator_test.cc", 273 "base/bit_field_test.cc", 274 "base/bit_memory_region_test.cc", 275 "base/bit_string_test.cc", 276 "base/bit_struct_test.cc", 277 "base/bit_table_test.cc", 278 "base/bit_utils_test.cc", 279 "base/bit_vector_test.cc", 280 "base/compiler_filter_test.cc", 281 "base/file_utils_test.cc", 282 "base/flags_test.cc", 283 "base/hash_map_test.cc", 284 "base/hash_set_test.cc", 285 "base/hex_dump_test.cc", 286 "base/histogram_test.cc", 287 "base/indenter_test.cc", 288 "base/intrusive_forward_list_test.cc", 289 "base/leb128_test.cc", 290 "base/logging_test.cc", 291 "base/memfd_test.cc", 292 "base/membarrier_test.cc", 293 "base/memory_region_test.cc", 294 "base/mem_map_test.cc", 295 "base/metrics/metrics_test.cc", 296 "base/safe_copy_test.cc", 297 "base/scoped_flock_test.cc", 298 "base/time_utils_test.cc", 299 "base/transform_array_ref_test.cc", 300 "base/transform_iterator_test.cc", 301 "base/unix_file/fd_file_test.cc", 302 "base/utils_test.cc", 303 "base/variant_map_test.cc", 304 "base/zip_archive_test.cc", 305 ], 306 shared_libs: [ 307 "libbase", 308 ], 309 static_libs: [ 310 "libgmock", 311 ], 312} 313 314// Version of ART gtest `art_libartbase_tests` bundled with the ART APEX on target. 315// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. 316art_cc_test { 317 name: "art_libartbase_tests", 318 defaults: [ 319 "art_gtest_defaults", 320 "art_libartbase_tests_defaults", 321 ], 322} 323 324// Standalone version of ART gtest `art_libartbase_tests`, not bundled with the ART APEX on target. 325art_cc_test { 326 name: "art_standalone_libartbase_tests", 327 defaults: [ 328 "art_standalone_gtest_defaults", 329 "art_libartbase_tests_defaults", 330 ], 331} 332 333cc_library_headers { 334 name: "art_libartbase_headers", 335 host_supported: true, 336 export_include_dirs: ["."], 337 shared_libs: ["libbase"], 338 export_shared_lib_headers: ["libbase"], 339 340 apex_available: [ 341 "com.android.art", 342 "com.android.art.debug", 343 ], 344 min_sdk_version: "S", 345} 346