David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 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 | |
| 17 | cc_defaults { |
| 18 | name: "libdexfile_defaults", |
| 19 | defaults: ["art_defaults"], |
| 20 | host_supported: true, |
| 21 | srcs: [ |
David Sehr | 1f01016 | 2018-05-15 08:59:32 -0700 | [diff] [blame] | 22 | "dex/art_dex_file_loader.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 23 | "dex/compact_dex_file.cc", |
Mathieu Chartier | 5e3cfa2 | 2018-02-20 16:53:37 -0800 | [diff] [blame] | 24 | "dex/compact_offset_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 25 | "dex/descriptors_names.cc", |
| 26 | "dex/dex_file.cc", |
| 27 | "dex/dex_file_exception_helpers.cc", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 28 | "dex/dex_file_layout.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 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", |
David Sehr | 67bf42e | 2018-02-26 16:43:04 -0800 | [diff] [blame] | 34 | "dex/primitive.cc", |
Andreas Gampe | ad1aa63 | 2019-01-02 10:30:54 -0800 | [diff] [blame] | 35 | "dex/signature.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 36 | "dex/standard_dex_file.cc", |
David Sehr | 9c4a015 | 2018-04-05 12:23:54 -0700 | [diff] [blame] | 37 | "dex/type_lookup_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 38 | "dex/utf.cc", |
| 39 | ], |
| 40 | |
| 41 | target: { |
| 42 | android: { |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 43 | static_libs: [ |
| 44 | "libziparchive", |
| 45 | "libz", |
| 46 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 47 | shared_libs: [ |
| 48 | // For MemMap. |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 49 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 50 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 51 | // For common macros. |
| 52 | "libbase", |
| 53 | ], |
| 54 | export_shared_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 55 | "libbase", |
| 56 | ], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 57 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 58 | not_windows: { |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 59 | shared_libs: [ |
| 60 | "libziparchive", |
| 61 | "libz", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 62 | // For MemMap. |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 63 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 64 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 65 | // For common macros. |
| 66 | "libbase", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 67 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 68 | export_shared_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 69 | "libbase", |
| 70 | ], |
| 71 | }, |
| 72 | windows: { |
| 73 | static_libs: [ |
| 74 | "libziparchive", |
| 75 | "libz", |
| 76 | // For MemMap. |
Orion Hodson | 119733d | 2019-01-30 15:14:41 +0000 | [diff] [blame] | 77 | "libartpalette", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 78 | "liblog", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 79 | // For common macros. |
| 80 | "libbase", |
| 81 | ], |
| 82 | export_static_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 83 | "libbase", |
| 84 | ], |
| 85 | cflags: ["-Wno-thread-safety"], |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 86 | }, |
David Srbecky | d53f606 | 2019-03-22 14:55:21 +0000 | [diff] [blame] | 87 | darwin: { |
| 88 | enabled: true, |
| 89 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 90 | }, |
| 91 | generated_sources: ["dexfile_operator_srcs"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 92 | export_include_dirs: ["."], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 93 | } |
| 94 | |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 95 | cc_defaults { |
| 96 | name: "libdexfile_static_base_defaults", |
| 97 | static_libs: [ |
| 98 | "libbase", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 99 | "liblog", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 100 | "libz", |
| 101 | "libziparchive", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 102 | ], |
| 103 | } |
| 104 | |
| 105 | cc_defaults { |
| 106 | name: "libdexfile_static_defaults", |
| 107 | defaults: [ |
| 108 | "libartbase_static_defaults", |
| 109 | "libdexfile_static_base_defaults", |
| 110 | ], |
| 111 | static_libs: ["libdexfile"], |
| 112 | } |
| 113 | |
| 114 | cc_defaults { |
| 115 | name: "libdexfiled_static_defaults", |
| 116 | defaults: [ |
| 117 | "libartbased_static_defaults", |
| 118 | "libdexfile_static_base_defaults", |
| 119 | ], |
| 120 | static_libs: ["libdexfiled"], |
| 121 | } |
| 122 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 123 | gensrcs { |
| 124 | name: "dexfile_operator_srcs", |
Alex Light | b69d2d3 | 2018-02-21 13:37:17 -0800 | [diff] [blame] | 125 | cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)", |
| 126 | tools: ["generate_operator_out"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 127 | srcs: [ |
| 128 | "dex/dex_file.h", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 129 | "dex/dex_file_layout.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 130 | "dex/dex_instruction.h", |
| 131 | "dex/dex_instruction_utils.h", |
| 132 | "dex/invoke_type.h", |
David Sehr | 312f3b2 | 2018-03-19 08:39:26 -0700 | [diff] [blame] | 133 | "dex/method_reference.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 134 | ], |
| 135 | output_extension: "operator_out.cc", |
| 136 | } |
| 137 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 138 | art_cc_library { |
| 139 | name: "libdexfile", |
| 140 | defaults: ["libdexfile_defaults"], |
| 141 | // Leave the symbols in the shared library so that stack unwinders can |
| 142 | // produce meaningful name resolution. |
| 143 | strip: { |
| 144 | keep_symbols: true, |
| 145 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 146 | target: { |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 147 | android: { |
| 148 | shared_libs: [ |
| 149 | "libartbase", |
| 150 | ], |
| 151 | export_shared_lib_headers: [ |
| 152 | "libartbase", |
| 153 | ], |
| 154 | }, |
| 155 | not_windows: { |
| 156 | shared_libs: [ |
| 157 | "libartbase", |
| 158 | ], |
| 159 | export_shared_lib_headers: [ |
| 160 | "libartbase", |
| 161 | ], |
| 162 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 163 | windows: { |
| 164 | enabled: true, |
| 165 | shared: { |
| 166 | enabled: false, |
| 167 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 168 | static_libs: [ |
| 169 | "libartbase", |
| 170 | ], |
| 171 | export_static_lib_headers: [ |
| 172 | "libartbase", |
| 173 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 174 | }, |
| 175 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 176 | } |
| 177 | |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 178 | art_cc_library { |
| 179 | name: "libdexfiled", |
| 180 | defaults: [ |
| 181 | "art_debug_defaults", |
| 182 | "libdexfile_defaults", |
| 183 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 184 | target: { |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 185 | android: { |
| 186 | shared_libs: [ |
| 187 | "libartbased", |
| 188 | ], |
| 189 | export_shared_lib_headers: [ |
| 190 | "libartbased", |
| 191 | ], |
| 192 | }, |
| 193 | not_windows: { |
| 194 | shared_libs: [ |
| 195 | "libartbased", |
| 196 | ], |
| 197 | export_shared_lib_headers: [ |
| 198 | "libartbased", |
| 199 | ], |
| 200 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 201 | windows: { |
| 202 | enabled: true, |
| 203 | shared: { |
| 204 | enabled: false, |
| 205 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 206 | static_libs: [ |
| 207 | "libartbased", |
| 208 | ], |
| 209 | export_static_lib_headers: [ |
| 210 | "libartbased", |
| 211 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 212 | }, |
| 213 | }, |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 214 | } |
| 215 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 216 | art_cc_test { |
| 217 | name: "art_libdexfile_tests", |
| 218 | defaults: [ |
| 219 | "art_gtest_defaults", |
| 220 | ], |
| 221 | srcs: [ |
| 222 | "dex/art_dex_file_loader_test.cc", |
| 223 | "dex/class_accessor_test.cc", |
| 224 | "dex/code_item_accessors_test.cc", |
| 225 | "dex/compact_dex_file_test.cc", |
| 226 | "dex/compact_offset_table_test.cc", |
| 227 | "dex/descriptors_names_test.cc", |
| 228 | "dex/test_dex_file_builder_test.cc", |
| 229 | "dex/dex_file_loader_test.cc", |
| 230 | "dex/dex_file_verifier_test.cc", |
| 231 | "dex/dex_instruction_test.cc", |
| 232 | "dex/primitive_test.cc", |
| 233 | "dex/string_reference_test.cc", |
| 234 | "dex/type_lookup_table_test.cc", |
| 235 | "dex/utf_test.cc", |
| 236 | ], |
| 237 | shared_libs: [ |
| 238 | "libbacktrace", |
| 239 | "libziparchive", |
| 240 | ], |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 241 | } |
| 242 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 243 | cc_library_headers { |
| 244 | name: "libdexfile_external_headers", |
| 245 | host_supported: true, |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 246 | vendor_available: true, |
| 247 | recovery_available: true, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 248 | header_libs: ["libbase_headers"], |
| 249 | export_header_lib_headers: ["libbase_headers"], |
| 250 | export_include_dirs: ["external/include"], |
| 251 | |
| 252 | target: { |
| 253 | windows: { |
| 254 | enabled: true, |
| 255 | }, |
| 256 | }, |
| 257 | } |
| 258 | |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 259 | cc_defaults { |
| 260 | name: "libdexfile_external-defaults", |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 261 | host_supported: true, |
| 262 | srcs: [ |
| 263 | "external/dex_file_ext.cc", |
| 264 | ], |
| 265 | header_libs: ["libdexfile_external_headers"], |
| 266 | shared_libs: [ |
| 267 | "libbase", |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 268 | ], |
Martin Stjernholm | 84bf698 | 2019-02-05 15:07:57 +0000 | [diff] [blame] | 269 | stubs: { |
| 270 | symbol_file: "external/libdexfile_external.map.txt", |
| 271 | versions: ["1"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 272 | }, |
| 273 | } |
| 274 | |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 275 | cc_library { |
| 276 | name: "libdexfile_external", |
| 277 | defaults: [ |
| 278 | "art_defaults", |
| 279 | "libdexfile_external-defaults", |
| 280 | ], |
David Srbecky | 52fc7ab | 2019-05-03 11:03:52 +0100 | [diff] [blame] | 281 | target: { |
| 282 | darwin: { |
| 283 | enabled: true, |
| 284 | }, |
| 285 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 286 | shared_libs: [ |
| 287 | "libdexfile", |
| 288 | ], |
| 289 | } |
| 290 | |
| 291 | cc_library { |
| 292 | name: "libdexfiled_external", |
| 293 | defaults: [ |
| 294 | "art_debug_defaults", |
| 295 | "libdexfile_external-defaults", |
| 296 | ], |
David Srbecky | 52fc7ab | 2019-05-03 11:03:52 +0100 | [diff] [blame] | 297 | target: { |
| 298 | darwin: { |
| 299 | enabled: true, |
| 300 | }, |
| 301 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 302 | shared_libs: [ |
| 303 | "libdexfiled", |
| 304 | ], |
| 305 | } |
| 306 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 307 | art_cc_test { |
| 308 | name: "art_libdexfile_external_tests", |
| 309 | host_supported: true, |
| 310 | test_per_src: true, // For consistency with other ART gtests. |
| 311 | srcs: [ |
| 312 | "external/dex_file_ext_c_test.c", |
| 313 | ], |
| 314 | header_libs: ["libdexfile_external_headers"], |
| 315 | } |
| 316 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 317 | // Support library with a C++ API for accessing the libdexfile API for external |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 318 | // (non-ART) users. |
| 319 | // |
| 320 | // This library dlopens libdexfile_external on first use, so there is no build |
| 321 | // time dependency on dex file logic. It is therefore safe to use from binaries |
| 322 | // compiled without dex file support, given they won't encounter any dex file |
| 323 | // stack frames. |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 324 | cc_library { |
| 325 | name: "libdexfile_support", |
| 326 | host_supported: true, |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 327 | vendor_available: true, |
| 328 | recovery_available: true, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 329 | srcs: [ |
| 330 | "external/dex_file_supp.cc", |
| 331 | ], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 332 | required: ["libdexfile_external"], |
| 333 | shared_libs: ["liblog"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 334 | header_libs: ["libdexfile_external_headers"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 335 | export_header_lib_headers: ["libdexfile_external_headers"], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 336 | target: { |
| 337 | recovery: { |
| 338 | cflags: ["-DNO_DEXFILE_SUPPORT"], |
| 339 | }, |
| 340 | vendor: { |
| 341 | cflags: ["-DNO_DEXFILE_SUPPORT"], |
| 342 | }, |
| 343 | }, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 344 | } |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 345 | |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 346 | // The same source file is used in two tests here, so unlike other ART gtests it |
| 347 | // doesn't use test_per_src. Its test target is |
| 348 | // test-art-{host,target}-gtest-art_libdexfile_support_tests. |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 349 | art_cc_test { |
| 350 | name: "art_libdexfile_support_tests", |
| 351 | host_supported: true, |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 352 | srcs: [ |
| 353 | "external/dex_file_supp_test.cc", |
| 354 | ], |
| 355 | shared_libs: [ |
| 356 | "libartbase", |
| 357 | "libbase", |
| 358 | "libdexfile_external", |
| 359 | "libdexfile_support", |
| 360 | ], |
| 361 | } |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 362 | |
| 363 | cc_library_static { |
| 364 | name: "libdexfile_support_static", |
| 365 | host_supported: true, |
| 366 | defaults: ["libdexfile_static_defaults"], |
| 367 | srcs: [ |
| 368 | "external/dex_file_supp.cc", |
| 369 | ], |
| 370 | cflags: ["-DSTATIC_LIB"], |
| 371 | // Using whole_static_libs here only as a "poor man's transitivity" kludge. |
| 372 | whole_static_libs: [ |
| 373 | "libbase", |
| 374 | "libdexfile", |
| 375 | "libdexfile_external", |
| 376 | "liblog", |
| 377 | "libz", |
| 378 | "libziparchive", |
| 379 | ], |
| 380 | header_libs: ["libdexfile_external_headers"], |
| 381 | export_header_lib_headers: ["libdexfile_external_headers"], |
| 382 | } |
| 383 | |
Martin Stjernholm | 70ae00d | 2019-02-15 22:41:14 +0000 | [diff] [blame] | 384 | // The same source file is used in two tests here, so unlike other ART gtests it |
| 385 | // doesn't use test_per_src. Its test target is |
| 386 | // test-art-{host,target}-gtest-art_libdexfile_support_static_tests. |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 387 | art_cc_test { |
| 388 | name: "art_libdexfile_support_static_tests", |
| 389 | host_supported: true, |
| 390 | srcs: [ |
| 391 | "external/dex_file_supp_test.cc", |
| 392 | ], |
| 393 | static_libs: [ |
| 394 | "libbase", |
| 395 | "libdexfile_support_static", |
| 396 | ], |
| 397 | } |