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 17cc_defaults { 18 name: "libdexfile_defaults", 19 defaults: ["art_defaults"], 20 visibility: [ 21 // Visibility for prebuilt dex2oat(d) from the prebuilt of this module. 22 // TODO(b/155921753): Restrict this when prebuilts are in their proper 23 // locations. 24 "//prebuilts:__subpackages__", 25 ], 26 host_supported: true, 27 srcs: [ 28 "dex/art_dex_file_loader.cc", 29 "dex/compact_dex_file.cc", 30 "dex/compact_offset_table.cc", 31 "dex/descriptors_names.cc", 32 "dex/dex_file.cc", 33 "dex/dex_file_exception_helpers.cc", 34 "dex/dex_file_layout.cc", 35 "dex/dex_file_loader.cc", 36 "dex/dex_file_tracking_registrar.cc", 37 "dex/dex_file_verifier.cc", 38 "dex/dex_instruction.cc", 39 "dex/modifiers.cc", 40 "dex/primitive.cc", 41 "dex/signature.cc", 42 "dex/standard_dex_file.cc", 43 "dex/type_lookup_table.cc", 44 "dex/utf.cc", 45 ], 46 header_libs: ["jni_headers"], 47 export_header_lib_headers: ["jni_headers"], 48 target: { 49 android: { 50 static_libs: [ 51 "libziparchive", 52 ], 53 shared_libs: [ 54 // libz provides a stub from platform, shouldn't be statically linked 55 "libz", 56 // For MemMap. 57 "libartpalette", 58 "liblog", 59 // For common macros. 60 "libbase", 61 ], 62 export_shared_lib_headers: [ 63 "libbase", 64 ], 65 }, 66 not_windows: { 67 shared_libs: [ 68 "libziparchive", 69 "libz", 70 // For MemMap. 71 "libartpalette", 72 "liblog", 73 // For common macros. 74 "libbase", 75 ], 76 export_shared_lib_headers: [ 77 "libbase", 78 ], 79 }, 80 windows: { 81 static_libs: [ 82 "libziparchive", 83 "libz", 84 // For MemMap. 85 "libartpalette", 86 "liblog", 87 // For common macros. 88 "libbase", 89 ], 90 export_static_lib_headers: [ 91 "libbase", 92 ], 93 cflags: ["-Wno-thread-safety"], 94 }, 95 darwin: { 96 enabled: true, 97 }, 98 }, 99 generated_sources: ["dexfile_operator_srcs"], 100 export_include_dirs: ["."], 101} 102 103cc_defaults { 104 name: "libdexfile_static_base_defaults", 105 static_libs: [ 106 "libbase", 107 "liblog", 108 "libz", 109 "libziparchive", 110 ], 111} 112 113cc_defaults { 114 name: "libdexfile_static_defaults", 115 defaults: [ 116 "libartbase_static_defaults", 117 "libdexfile_static_base_defaults", 118 ], 119 defaults_visibility: [ 120 "//art:__subpackages__", 121 ], 122 static_libs: ["libdexfile"], 123} 124 125cc_defaults { 126 name: "libdexfiled_static_defaults", 127 defaults: [ 128 "libartbased_static_defaults", 129 "libdexfile_static_base_defaults", 130 ], 131 static_libs: ["libdexfiled"], 132} 133 134gensrcs { 135 name: "dexfile_operator_srcs", 136 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)", 137 tools: ["generate_operator_out"], 138 srcs: [ 139 "dex/dex_file.h", 140 "dex/dex_file_layout.h", 141 "dex/dex_instruction.h", 142 "dex/dex_instruction_utils.h", 143 "dex/invoke_type.h", 144 ], 145 output_extension: "operator_out.cc", 146} 147 148art_cc_library { 149 name: "libdexfile", 150 defaults: [ 151 "libdexfile_defaults", 152 "libart_nativeunwind_defaults", 153 ], 154 target: { 155 android: { 156 shared_libs: [ 157 "libartbase", 158 ], 159 export_shared_lib_headers: [ 160 "libartbase", 161 ], 162 }, 163 not_windows: { 164 shared_libs: [ 165 "libartbase", 166 ], 167 export_shared_lib_headers: [ 168 "libartbase", 169 ], 170 }, 171 windows: { 172 enabled: true, 173 shared: { 174 enabled: false, 175 }, 176 static_libs: [ 177 "libartbase", 178 ], 179 export_static_lib_headers: [ 180 "libartbase", 181 ], 182 }, 183 }, 184 apex_available: [ 185 "com.android.art.release", 186 "com.android.art.debug", 187 ], 188} 189 190art_cc_library { 191 name: "libdexfiled", 192 defaults: [ 193 "art_debug_defaults", 194 "libdexfile_defaults", 195 ], 196 target: { 197 android: { 198 shared_libs: [ 199 "libartbased", 200 ], 201 export_shared_lib_headers: [ 202 "libartbased", 203 ], 204 }, 205 not_windows: { 206 shared_libs: [ 207 "libartbased", 208 ], 209 export_shared_lib_headers: [ 210 "libartbased", 211 ], 212 }, 213 windows: { 214 enabled: true, 215 shared: { 216 enabled: false, 217 }, 218 static_libs: [ 219 "libartbased", 220 ], 221 export_static_lib_headers: [ 222 "libartbased", 223 ], 224 }, 225 }, 226 apex_available: [ 227 "com.android.art.debug", 228 ], 229} 230 231art_cc_test { 232 name: "art_libdexfile_tests", 233 defaults: [ 234 "art_gtest_defaults", 235 ], 236 srcs: [ 237 "dex/art_dex_file_loader_test.cc", 238 "dex/class_accessor_test.cc", 239 "dex/code_item_accessors_test.cc", 240 "dex/compact_dex_file_test.cc", 241 "dex/compact_offset_table_test.cc", 242 "dex/descriptors_names_test.cc", 243 "dex/test_dex_file_builder_test.cc", 244 "dex/dex_file_loader_test.cc", 245 "dex/dex_file_verifier_test.cc", 246 "dex/dex_instruction_test.cc", 247 "dex/primitive_test.cc", 248 "dex/string_reference_test.cc", 249 "dex/type_lookup_table_test.cc", 250 "dex/utf_test.cc", 251 ], 252 data: [ 253 ":art-gtest-jars-GetMethodSignature", 254 ":art-gtest-jars-Lookup", 255 ":art-gtest-jars-Main", 256 ":art-gtest-jars-MultiDex", 257 ":art-gtest-jars-Nested", 258 ], 259 header_libs: ["jni_headers"], 260 shared_libs: [ 261 "libbacktrace", 262 "libziparchive", 263 ], 264} 265 266cc_library_headers { 267 name: "libdexfile_external_headers", 268 visibility: ["//visibility:public"], 269 host_supported: true, 270 header_libs: ["libbase_headers"], 271 export_header_lib_headers: ["libbase_headers"], 272 export_include_dirs: ["external/include"], 273 274 target: { 275 windows: { 276 enabled: true, 277 }, 278 }, 279 280 apex_available: [ 281 "//apex_available:platform", 282 "com.android.art.debug", 283 "com.android.art.release", 284 ], 285} 286 287// Make dex_instruction_list.h available for tools/jvmti-agents/titrace 288cc_library_headers { 289 name: "libdexfile_all_headers", 290 visibility: ["//art:__subpackages__"], 291 host_supported: true, 292 export_include_dirs: ["."], 293 294 apex_available: [ 295 "com.android.art.debug", 296 "com.android.art.release", 297 ], 298} 299 300cc_defaults { 301 name: "libdexfile_external-defaults", 302 host_supported: true, 303 srcs: [ 304 "external/dex_file_ext.cc", 305 ], 306 header_libs: [ 307 "jni_headers", 308 "libdexfile_external_headers", 309 ], 310 shared_libs: [ 311 "libbase", 312 ], 313 stubs: { 314 symbol_file: "external/libdexfile_external.map.txt", 315 versions: ["1"], 316 }, 317 export_header_lib_headers: [ 318 "jni_headers", 319 "libdexfile_external_headers", 320 ], 321} 322 323art_cc_library { 324 name: "libdexfile_external", 325 defaults: [ 326 "art_defaults", 327 "libdexfile_external-defaults", 328 ], 329 visibility: ["//visibility:public"], 330 target: { 331 darwin: { 332 enabled: true, 333 }, 334 }, 335 shared_libs: [ 336 "libdexfile", 337 ], 338 apex_available: [ 339 "com.android.art.release", 340 "com.android.art.debug", 341 ], 342} 343 344art_cc_library { 345 name: "libdexfiled_external", 346 defaults: [ 347 "art_debug_defaults", 348 "libdexfile_external-defaults", 349 ], 350 target: { 351 darwin: { 352 enabled: true, 353 }, 354 }, 355 shared_libs: [ 356 "libdexfiled", 357 ], 358 apex_available: [ 359 "com.android.art.debug", 360 ], 361} 362 363art_cc_test { 364 name: "art_libdexfile_external_tests", 365 host_supported: true, 366 test_suites: ["general-tests"], 367 srcs: [ 368 "external/dex_file_ext_c_test.c", 369 ], 370 header_libs: [ 371 "jni_headers", 372 "libdexfile_external_headers", 373 ], 374} 375 376// Support library with a C++ API for accessing the libdexfile API for external 377// (non-ART) users. 378// 379// This library dlopens libdexfile_external on first use, so there is no build 380// time dependency on dex file logic. It is therefore safe to use from binaries 381// compiled without dex file support, given they won't encounter any dex file 382// stack frames. 383art_cc_library { 384 name: "libdexfile_support", 385 visibility: ["//visibility:public"], 386 host_supported: true, 387 srcs: [ 388 "external/dex_file_supp.cc", 389 ], 390 runtime_libs: ["libdexfile_external"], 391 shared_libs: ["liblog"], 392 header_libs: ["libdexfile_external_headers"], 393 export_header_lib_headers: ["libdexfile_external_headers"], 394 395 apex_available: [ 396 "//apex_available:platform", 397 "com.android.art.debug", 398 "com.android.art.release", 399 ], 400} 401 402// The same source file is used in two tests here. 403// Its test target is test-art-{host,target}-gtest-art_libdexfile_support_tests. 404art_cc_test { 405 name: "art_libdexfile_support_tests", 406 defaults: [ 407 "art_test_defaults", 408 ], 409 host_supported: true, 410 test_suites: ["general-tests"], 411 srcs: [ 412 "external/dex_file_supp_test.cc", 413 ], 414 shared_libs: [ 415 "libartbase", 416 "libbase", 417 "libdexfile_external", 418 "libdexfile_support", 419 ], 420} 421 422cc_defaults { 423 name: "libdexfile_support_static_defaults", 424 host_supported: true, 425 srcs: [ 426 "external/dex_file_supp.cc", 427 ], 428 cflags: ["-DSTATIC_LIB"], 429 // Using whole_static_libs here only as an "approximate transitivity" kludge. 430 whole_static_libs: [ 431 "libbase", 432 "liblog", 433 "libz", 434 "libziparchive", 435 ], 436 header_libs: ["libdexfile_external_headers"], 437 export_header_lib_headers: ["libdexfile_external_headers"], 438} 439 440cc_library_static { 441 name: "libdexfile_support_static", 442 visibility: [ 443 "//art:__subpackages__", 444 // Required for the simpleperf binary in the NDK. No other modules than 445 // //system/extras/simpleperf:simpleperf_ndk are allowed to use it. 446 "//system/extras/simpleperf", 447 "//cts/tests/tests/simpleperf", 448 ], 449 defaults: [ 450 "libdexfile_static_defaults", 451 "libdexfile_support_static_defaults", 452 ], 453 whole_static_libs: [ 454 "libdexfile", 455 "libdexfile_external", 456 ], 457} 458 459cc_library_static { 460 name: "libdexfiled_support_static", 461 defaults: [ 462 "libdexfile_support_static_defaults", 463 "libdexfiled_static_defaults", 464 ], 465 whole_static_libs: [ 466 "libdexfiled", 467 "libdexfiled_external", 468 ], 469} 470 471// The same source file is used in two tests here. 472// Its test target is test-art-{host,target}-gtest-art_libdexfile_support_static_tests. 473art_cc_test { 474 name: "art_libdexfile_support_static_tests", 475 host_supported: true, 476 test_suites: ["general-tests"], 477 srcs: [ 478 "external/dex_file_supp_test.cc", 479 ], 480 static_libs: [ 481 "libbase", 482 "libdexfile_support_static", 483 ], 484} 485