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