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 | |
Bob Badour | 9150de6 | 2021-02-26 03:22:24 -0800 | [diff] [blame] | 17 | package { |
| 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 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 26 | cc_defaults { |
| 27 | name: "libdexfile_defaults", |
| 28 | defaults: ["art_defaults"], |
| 29 | host_supported: true, |
| 30 | srcs: [ |
David Sehr | 1f01016 | 2018-05-15 08:59:32 -0700 | [diff] [blame] | 31 | "dex/art_dex_file_loader.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 32 | "dex/compact_dex_file.cc", |
Mathieu Chartier | 5e3cfa2 | 2018-02-20 16:53:37 -0800 | [diff] [blame] | 33 | "dex/compact_offset_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 34 | "dex/descriptors_names.cc", |
| 35 | "dex/dex_file.cc", |
| 36 | "dex/dex_file_exception_helpers.cc", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 37 | "dex/dex_file_layout.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 38 | "dex/dex_file_loader.cc", |
| 39 | "dex/dex_file_tracking_registrar.cc", |
| 40 | "dex/dex_file_verifier.cc", |
| 41 | "dex/dex_instruction.cc", |
| 42 | "dex/modifiers.cc", |
David Sehr | 67bf42e | 2018-02-26 16:43:04 -0800 | [diff] [blame] | 43 | "dex/primitive.cc", |
Andreas Gampe | ad1aa63 | 2019-01-02 10:30:54 -0800 | [diff] [blame] | 44 | "dex/signature.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 45 | "dex/standard_dex_file.cc", |
David Sehr | 9c4a015 | 2018-04-05 12:23:54 -0700 | [diff] [blame] | 46 | "dex/type_lookup_table.cc", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 47 | "dex/utf.cc", |
| 48 | ], |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 49 | header_libs: [ |
| 50 | "jni_headers", |
| 51 | "libdexfile_external_headers", |
| 52 | ], |
| 53 | export_header_lib_headers: [ |
| 54 | "jni_headers", |
| 55 | "libdexfile_external_headers", |
| 56 | ], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 57 | target: { |
| 58 | android: { |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 59 | srcs: [ |
| 60 | "external/dex_file_ext.cc", |
| 61 | ], |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 62 | static_libs: [ |
| 63 | "libziparchive", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 64 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 65 | shared_libs: [ |
Jiyong Park | b1c8e16 | 2020-05-18 19:04:42 +0900 | [diff] [blame] | 66 | // libz provides a stub from platform, shouldn't be statically linked |
| 67 | "libz", |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 68 | // For MemMap. |
| 69 | "libartpalette", |
| 70 | "liblog", |
| 71 | // For common macros. |
| 72 | "libbase", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 73 | ], |
| 74 | export_shared_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 75 | "libbase", |
| 76 | ], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 77 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 78 | not_windows: { |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 79 | srcs: [ |
| 80 | "external/dex_file_ext.cc", |
| 81 | ], |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 82 | shared_libs: [ |
| 83 | "libziparchive", |
| 84 | "libz", |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 85 | // For MemMap. |
| 86 | "libartpalette", |
| 87 | "liblog", |
| 88 | // For common macros. |
| 89 | "libbase", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 90 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 91 | export_shared_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 92 | "libbase", |
| 93 | ], |
| 94 | }, |
| 95 | windows: { |
| 96 | static_libs: [ |
| 97 | "libziparchive", |
| 98 | "libz", |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 99 | // For MemMap. |
| 100 | "libartpalette", |
| 101 | "liblog", |
| 102 | // For common macros. |
| 103 | "libbase", |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 104 | ], |
| 105 | export_static_lib_headers: [ |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 106 | "libbase", |
| 107 | ], |
| 108 | cflags: ["-Wno-thread-safety"], |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 109 | }, |
David Srbecky | d53f606 | 2019-03-22 14:55:21 +0000 | [diff] [blame] | 110 | darwin: { |
| 111 | enabled: true, |
| 112 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 113 | }, |
| 114 | generated_sources: ["dexfile_operator_srcs"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 115 | export_include_dirs: ["."], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 116 | } |
| 117 | |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 118 | cc_defaults { |
| 119 | name: "libdexfile_static_base_defaults", |
Martin Stjernholm | 35f765b | 2020-09-23 00:38:38 +0100 | [diff] [blame] | 120 | whole_static_libs: [ |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 121 | "libbase", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 122 | "liblog", |
Nicolas Geoffray | 65ed42a | 2018-10-30 12:33:04 +0000 | [diff] [blame] | 123 | "libz", |
| 124 | "libziparchive", |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 125 | ], |
| 126 | } |
| 127 | |
| 128 | cc_defaults { |
| 129 | name: "libdexfile_static_defaults", |
| 130 | defaults: [ |
| 131 | "libartbase_static_defaults", |
| 132 | "libdexfile_static_base_defaults", |
| 133 | ], |
Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 134 | defaults_visibility: [ |
| 135 | "//art:__subpackages__", |
Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 136 | ], |
Martin Stjernholm | 35f765b | 2020-09-23 00:38:38 +0100 | [diff] [blame] | 137 | whole_static_libs: ["libdexfile"], |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 138 | } |
| 139 | |
| 140 | cc_defaults { |
| 141 | name: "libdexfiled_static_defaults", |
| 142 | defaults: [ |
| 143 | "libartbased_static_defaults", |
| 144 | "libdexfile_static_base_defaults", |
| 145 | ], |
Martin Stjernholm | 35f765b | 2020-09-23 00:38:38 +0100 | [diff] [blame] | 146 | whole_static_libs: ["libdexfiled"], |
Andreas Gampe | ec5ed06 | 2018-01-26 16:20:02 -0800 | [diff] [blame] | 147 | } |
| 148 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 149 | gensrcs { |
| 150 | name: "dexfile_operator_srcs", |
Alex Light | b69d2d3 | 2018-02-21 13:37:17 -0800 | [diff] [blame] | 151 | cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)", |
| 152 | tools: ["generate_operator_out"], |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 153 | srcs: [ |
| 154 | "dex/dex_file.h", |
David Sehr | c431b9d | 2018-03-02 12:01:51 -0800 | [diff] [blame] | 155 | "dex/dex_file_layout.h", |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 156 | "dex/dex_instruction.h", |
| 157 | "dex/dex_instruction_utils.h", |
| 158 | "dex/invoke_type.h", |
| 159 | ], |
| 160 | output_extension: "operator_out.cc", |
| 161 | } |
| 162 | |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 163 | art_cc_library { |
| 164 | name: "libdexfile", |
Christopher Ferris | ac97f3e | 2021-06-17 20:59:10 +0000 | [diff] [blame] | 165 | visibility: [ |
Martin Stjernholm | 315cf0c | 2021-08-26 21:34:52 +0100 | [diff] [blame] | 166 | // Allow libdexfile_support users to list this as a runtime_libs |
| 167 | // dependency - see comment for libdexfile_support. It shouldn't be used |
| 168 | // for any other purpose. |
| 169 | "//external/perfetto", |
| 170 | "//system/core/debuggerd", |
| 171 | "//system/extras/simpleperf", |
Christopher Ferris | ac97f3e | 2021-06-17 20:59:10 +0000 | [diff] [blame] | 172 | "//system/unwinding/libunwindstack", |
| 173 | ], |
Christopher Ferris | 0d38e85 | 2019-12-11 09:37:19 -0800 | [diff] [blame] | 174 | defaults: [ |
| 175 | "libdexfile_defaults", |
| 176 | "libart_nativeunwind_defaults", |
| 177 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 178 | target: { |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 179 | android: { |
| 180 | shared_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 181 | "libartbase", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 182 | ], |
| 183 | export_shared_lib_headers: [ |
| 184 | "libartbase", |
| 185 | ], |
| 186 | }, |
| 187 | not_windows: { |
| 188 | shared_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 189 | "libartbase", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 190 | ], |
| 191 | export_shared_lib_headers: [ |
| 192 | "libartbase", |
| 193 | ], |
| 194 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 195 | windows: { |
| 196 | enabled: true, |
| 197 | shared: { |
| 198 | enabled: false, |
| 199 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 200 | static_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 201 | "libartbase", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 202 | ], |
| 203 | export_static_lib_headers: [ |
| 204 | "libartbase", |
| 205 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 206 | }, |
| 207 | }, |
Jiyong Park | 066dd902 | 2019-12-19 02:11:59 +0000 | [diff] [blame] | 208 | apex_available: [ |
Martin Stjernholm | 3e9abfc | 2020-10-09 22:17:51 +0100 | [diff] [blame] | 209 | "com.android.art", |
Jiyong Park | 066dd902 | 2019-12-19 02:11:59 +0000 | [diff] [blame] | 210 | "com.android.art.debug", |
Jiyong Park | 066dd902 | 2019-12-19 02:11:59 +0000 | [diff] [blame] | 211 | ], |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 212 | stubs: { |
David Srbecky | 30d4d2f | 2021-03-24 16:11:49 +0000 | [diff] [blame] | 213 | symbol_file: "libdexfile.map.txt", |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 214 | versions: ["1"], |
| 215 | }, |
David Sehr | 334b9d7 | 2018-02-12 18:27:56 -0800 | [diff] [blame] | 216 | } |
| 217 | |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 218 | art_cc_library { |
| 219 | name: "libdexfiled", |
| 220 | defaults: [ |
| 221 | "art_debug_defaults", |
| 222 | "libdexfile_defaults", |
| 223 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 224 | target: { |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 225 | android: { |
| 226 | shared_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 227 | "libartbased", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 228 | ], |
| 229 | export_shared_lib_headers: [ |
| 230 | "libartbased", |
| 231 | ], |
| 232 | }, |
| 233 | not_windows: { |
| 234 | shared_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 235 | "libartbased", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 236 | ], |
| 237 | export_shared_lib_headers: [ |
| 238 | "libartbased", |
| 239 | ], |
| 240 | }, |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 241 | windows: { |
| 242 | enabled: true, |
| 243 | shared: { |
| 244 | enabled: false, |
| 245 | }, |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 246 | static_libs: [ |
Andreas Gampe | 0dc93b1 | 2019-05-15 10:30:22 -0700 | [diff] [blame] | 247 | "libartbased", |
David Srbecky | 7711c35 | 2019-04-10 17:50:12 +0100 | [diff] [blame] | 248 | ], |
| 249 | export_static_lib_headers: [ |
| 250 | "libartbased", |
| 251 | ], |
David Sehr | 10db8fe | 2018-07-18 11:01:20 -0700 | [diff] [blame] | 252 | }, |
| 253 | }, |
Jiyong Park | 066dd902 | 2019-12-19 02:11:59 +0000 | [diff] [blame] | 254 | apex_available: [ |
| 255 | "com.android.art.debug", |
Martin Stjernholm | a2f48a4 | 2021-04-09 13:23:21 +0100 | [diff] [blame] | 256 | // TODO(b/183882457): This lib doesn't go into com.android.art, but |
| 257 | // apex_available lists need to be the same for internal libs to avoid |
| 258 | // stubs, and libartd depends on this. |
| 259 | "com.android.art", |
Jiyong Park | 066dd902 | 2019-12-19 02:11:59 +0000 | [diff] [blame] | 260 | ], |
David Sehr | fcbe15c | 2018-02-15 09:41:13 -0800 | [diff] [blame] | 261 | } |
| 262 | |
Roland Levillain | f040914 | 2021-03-22 15:45:03 +0000 | [diff] [blame] | 263 | art_cc_defaults { |
| 264 | name: "art_libdexfile_tests_defaults", |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 265 | srcs: [ |
| 266 | "dex/art_dex_file_loader_test.cc", |
| 267 | "dex/class_accessor_test.cc", |
| 268 | "dex/code_item_accessors_test.cc", |
| 269 | "dex/compact_dex_file_test.cc", |
| 270 | "dex/compact_offset_table_test.cc", |
| 271 | "dex/descriptors_names_test.cc", |
| 272 | "dex/test_dex_file_builder_test.cc", |
| 273 | "dex/dex_file_loader_test.cc", |
| 274 | "dex/dex_file_verifier_test.cc", |
| 275 | "dex/dex_instruction_test.cc", |
| 276 | "dex/primitive_test.cc", |
| 277 | "dex/string_reference_test.cc", |
| 278 | "dex/type_lookup_table_test.cc", |
| 279 | "dex/utf_test.cc", |
| 280 | ], |
David Srbecky | 4a88a5a | 2020-05-05 16:21:57 +0100 | [diff] [blame] | 281 | data: [ |
| 282 | ":art-gtest-jars-GetMethodSignature", |
| 283 | ":art-gtest-jars-Lookup", |
| 284 | ":art-gtest-jars-Main", |
| 285 | ":art-gtest-jars-MultiDex", |
| 286 | ":art-gtest-jars-Nested", |
| 287 | ], |
Orion Hodson | 00cb81d | 2020-04-03 06:47:07 +0100 | [diff] [blame] | 288 | header_libs: ["jni_headers"], |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 289 | shared_libs: [ |
| 290 | "libbacktrace", |
| 291 | "libziparchive", |
| 292 | ], |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 293 | } |
| 294 | |
Roland Levillain | f040914 | 2021-03-22 15:45:03 +0000 | [diff] [blame] | 295 | // Version of ART gtest `art_libdexfile_tests` bundled with the ART APEX on target. |
| 296 | // TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. |
| 297 | art_cc_test { |
| 298 | name: "art_libdexfile_tests", |
| 299 | defaults: [ |
| 300 | "art_gtest_defaults", |
| 301 | "art_libdexfile_tests_defaults", |
| 302 | ], |
| 303 | } |
| 304 | |
| 305 | // Standalone version of ART gtest `art_libdexfile_tests`, not bundled with the ART APEX on target. |
| 306 | art_cc_test { |
| 307 | name: "art_standalone_libdexfile_tests", |
| 308 | defaults: [ |
| 309 | "art_standalone_gtest_defaults", |
| 310 | "art_libdexfile_tests_defaults", |
| 311 | ], |
| 312 | test_config: "art_standalone_libdexfile_tests.xml", |
| 313 | } |
| 314 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 315 | cc_library_headers { |
| 316 | name: "libdexfile_external_headers", |
Martin Stjernholm | e10abe7 | 2021-10-28 03:49:55 +0100 | [diff] [blame] | 317 | defaults: ["art_defaults"], |
Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 318 | visibility: ["//visibility:public"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 319 | host_supported: true, |
| 320 | header_libs: ["libbase_headers"], |
| 321 | export_header_lib_headers: ["libbase_headers"], |
| 322 | export_include_dirs: ["external/include"], |
| 323 | |
| 324 | target: { |
| 325 | windows: { |
| 326 | enabled: true, |
| 327 | }, |
Martin Stjernholm | 7eba377 | 2021-11-10 11:22:58 +0000 | [diff] [blame] | 328 | darwin: { |
| 329 | enabled: true, |
| 330 | }, |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 331 | }, |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 332 | |
| 333 | apex_available: [ |
| 334 | "//apex_available:platform", |
Martin Stjernholm | 3e9abfc | 2020-10-09 22:17:51 +0100 | [diff] [blame] | 335 | "com.android.art", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 336 | "com.android.art.debug", |
Martin Stjernholm | 694f012 | 2020-10-30 02:23:24 +0000 | [diff] [blame] | 337 | "com.android.media", |
| 338 | "com.android.runtime", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 339 | ], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 340 | } |
| 341 | |
Paul Duffin | 4345aac | 2019-07-17 15:51:54 +0100 | [diff] [blame] | 342 | // Make dex_instruction_list.h available for tools/jvmti-agents/titrace |
| 343 | cc_library_headers { |
| 344 | name: "libdexfile_all_headers", |
Martin Stjernholm | e10abe7 | 2021-10-28 03:49:55 +0100 | [diff] [blame] | 345 | defaults: ["art_defaults"], |
Paul Duffin | 4345aac | 2019-07-17 15:51:54 +0100 | [diff] [blame] | 346 | visibility: ["//art:__subpackages__"], |
| 347 | host_supported: true, |
| 348 | export_include_dirs: ["."], |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 349 | |
| 350 | apex_available: [ |
Martin Stjernholm | 3e9abfc | 2020-10-09 22:17:51 +0100 | [diff] [blame] | 351 | "com.android.art", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 352 | "com.android.art.debug", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 353 | ], |
Paul Duffin | 4345aac | 2019-07-17 15:51:54 +0100 | [diff] [blame] | 354 | } |
| 355 | |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 356 | art_cc_test { |
| 357 | name: "art_libdexfile_external_tests", |
Martin Stjernholm | 1dc77ab | 2021-05-10 17:44:05 +0100 | [diff] [blame] | 358 | defaults: [ |
| 359 | "art_module_source_build_defaults", |
| 360 | "art_test_defaults", |
| 361 | ], |
Martin Stjernholm | 842555d | 2020-03-23 14:38:47 +0000 | [diff] [blame] | 362 | test_suites: ["general-tests"], |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 363 | srcs: [ |
| 364 | "external/dex_file_ext_c_test.c", |
David Srbecky | 30d4d2f | 2021-03-24 16:11:49 +0000 | [diff] [blame] | 365 | "external/dex_file_ext_test.cc", |
| 366 | ], |
| 367 | shared_libs: [ |
| 368 | "libartbase", |
| 369 | "libdexfile", |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 370 | ], |
Orion Hodson | 00cb81d | 2020-04-03 06:47:07 +0100 | [diff] [blame] | 371 | header_libs: [ |
| 372 | "jni_headers", |
| 373 | "libdexfile_external_headers", |
| 374 | ], |
Martin Stjernholm | fdb2f60 | 2019-01-09 14:47:00 +0000 | [diff] [blame] | 375 | } |
| 376 | |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 377 | // 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] | 378 | // (non-ART) users. |
| 379 | // |
Martin Stjernholm | 34b00fb | 2021-05-14 18:15:56 +0100 | [diff] [blame] | 380 | // This library dlopens libdexfile(d).so on first use, so there is no build time |
| 381 | // dependency on dex file logic. It is therefore safe to use from binaries |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 382 | // compiled without dex file support, given they won't encounter any dex file |
| 383 | // stack frames. |
Martin Stjernholm | 315cf0c | 2021-08-26 21:34:52 +0100 | [diff] [blame] | 384 | // |
| 385 | // IMPORTANT: When adding a static_libs dependency on this library, please |
| 386 | // remember to also add a corresponding |
| 387 | // |
| 388 | // runtime_libs: ["libdexfile"], |
| 389 | // |
| 390 | // That is necessary since Soong doesn't propagate dependencies transitively for |
| 391 | // static libraries (b/169779783). |
Martin Stjernholm | 34b00fb | 2021-05-14 18:15:56 +0100 | [diff] [blame] | 392 | art_cc_library_static { |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 393 | name: "libdexfile_support", |
Martin Stjernholm | f726d20 | 2021-10-28 03:52:25 +0100 | [diff] [blame] | 394 | defaults: ["art_defaults"], |
Martin Stjernholm | b4abe0a | 2019-05-17 19:22:55 +0100 | [diff] [blame] | 395 | visibility: ["//visibility:public"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 396 | host_supported: true, |
| 397 | srcs: [ |
| 398 | "external/dex_file_supp.cc", |
| 399 | ], |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 400 | runtime_libs: ["libdexfile"], |
David Srbecky | 2ddb98b | 2021-03-09 00:37:04 +0000 | [diff] [blame] | 401 | shared_libs: [ |
| 402 | "liblog", |
| 403 | "libbase", |
| 404 | ], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 405 | header_libs: ["libdexfile_external_headers"], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 406 | export_header_lib_headers: ["libdexfile_external_headers"], |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 407 | |
| 408 | apex_available: [ |
| 409 | "//apex_available:platform", |
Martin Stjernholm | 3e9abfc | 2020-10-09 22:17:51 +0100 | [diff] [blame] | 410 | "com.android.art", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 411 | "com.android.art.debug", |
Martin Stjernholm | 694f012 | 2020-10-30 02:23:24 +0000 | [diff] [blame] | 412 | "com.android.media", |
| 413 | "com.android.media.swcodec", |
| 414 | "com.android.runtime", |
Jiyong Park | 71f661c | 2020-04-28 18:20:43 +0900 | [diff] [blame] | 415 | ], |
Martin Stjernholm | b3d2e83 | 2018-11-15 18:09:35 +0000 | [diff] [blame] | 416 | } |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 417 | |
Roland Levillain | f040914 | 2021-03-22 15:45:03 +0000 | [diff] [blame] | 418 | art_cc_defaults { |
| 419 | name: "art_libdexfile_support_tests_defaults", |
Roland Levillain | 61f0716 | 2019-06-26 12:44:04 +0100 | [diff] [blame] | 420 | defaults: [ |
Martin Stjernholm | 1dc77ab | 2021-05-10 17:44:05 +0100 | [diff] [blame] | 421 | "art_module_source_build_defaults", |
Roland Levillain | 61f0716 | 2019-06-26 12:44:04 +0100 | [diff] [blame] | 422 | ], |
Martin Stjernholm | 842555d | 2020-03-23 14:38:47 +0000 | [diff] [blame] | 423 | test_suites: ["general-tests"], |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 424 | srcs: [ |
| 425 | "external/dex_file_supp_test.cc", |
| 426 | ], |
| 427 | shared_libs: [ |
| 428 | "libartbase", |
| 429 | "libbase", |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 430 | "libdexfile", |
Martin Stjernholm | 34b00fb | 2021-05-14 18:15:56 +0100 | [diff] [blame] | 431 | "liblog", |
| 432 | ], |
| 433 | static_libs: [ |
Martin Stjernholm | 750bf04 | 2019-01-09 22:51:12 +0000 | [diff] [blame] | 434 | "libdexfile_support", |
| 435 | ], |
| 436 | } |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 437 | |
Roland Levillain | f040914 | 2021-03-22 15:45:03 +0000 | [diff] [blame] | 438 | // Version of ART gtest `art_libdexfile_support_tests` bundled with the ART APEX on target. |
| 439 | // TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete. |
| 440 | art_cc_test { |
| 441 | name: "art_libdexfile_support_tests", |
| 442 | host_supported: true, |
| 443 | defaults: [ |
| 444 | "art_test_defaults", |
| 445 | "art_libdexfile_support_tests_defaults", |
| 446 | ], |
| 447 | } |
| 448 | |
| 449 | // Standalone version of ART gtest `art_libdexfile_support_tests`, not bundled with the ART APEX on |
| 450 | // target. |
| 451 | art_cc_test { |
| 452 | name: "art_standalone_libdexfile_support_tests", |
| 453 | defaults: [ |
| 454 | "art_standalone_test_defaults", |
| 455 | "art_libdexfile_support_tests_defaults", |
| 456 | ], |
| 457 | |
| 458 | // Support multilib variants (using different suffix per sub-architecture), which is needed on |
| 459 | // build targets with secondary architectures, as the MTS test suite packaging logic flattens |
| 460 | // all test artifacts into a single `testcases` directory. |
| 461 | compile_multilib: "both", |
| 462 | multilib: { |
| 463 | lib32: { |
| 464 | suffix: "32", |
| 465 | }, |
| 466 | lib64: { |
| 467 | suffix: "64", |
| 468 | }, |
| 469 | }, |
Roland Levillain | 6a2e689 | 2021-07-04 14:21:07 +0100 | [diff] [blame] | 470 | |
| 471 | test_suites: [ |
| 472 | "mts-art", |
| 473 | ], |
Roland Levillain | f040914 | 2021-03-22 15:45:03 +0000 | [diff] [blame] | 474 | } |
| 475 | |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 476 | cc_library_static { |
| 477 | name: "libdexfile_support_static", |
Martin Stjernholm | e387802 | 2021-11-23 16:29:52 +0000 | [diff] [blame^] | 478 | defaults: ["art_defaults"], |
Martin Stjernholm | d3ee98a | 2019-09-23 16:26:50 +0100 | [diff] [blame] | 479 | host_supported: true, |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 480 | srcs: [ |
| 481 | "external/dex_file_supp.cc", |
| 482 | ], |
| 483 | cflags: ["-DSTATIC_LIB"], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 484 | header_libs: ["libdexfile_external_headers"], |
| 485 | export_header_lib_headers: ["libdexfile_external_headers"], |
| 486 | } |
| 487 | |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 488 | cc_defaults { |
| 489 | name: "libdexfile_support_static_defaults", |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 490 | defaults: [ |
| 491 | "libdexfile_static_defaults", |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 492 | ], |
Martin Stjernholm | 35f765b | 2020-09-23 00:38:38 +0100 | [diff] [blame] | 493 | whole_static_libs: [ |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 494 | "libdexfile", |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 495 | "libdexfile_support_static", |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 496 | ], |
| 497 | } |
| 498 | |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 499 | cc_defaults { |
| 500 | name: "libdexfiled_support_static_defaults", |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 501 | defaults: [ |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 502 | "libdexfiled_static_defaults", |
| 503 | ], |
Martin Stjernholm | 35f765b | 2020-09-23 00:38:38 +0100 | [diff] [blame] | 504 | whole_static_libs: [ |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 505 | "libdexfiled", |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 506 | "libdexfile_support_static", |
Martin Stjernholm | 621afb4 | 2019-09-23 22:01:36 +0100 | [diff] [blame] | 507 | ], |
| 508 | } |
| 509 | |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 510 | art_cc_test { |
| 511 | name: "art_libdexfile_support_static_tests", |
Martin Stjernholm | 842555d | 2020-03-23 14:38:47 +0000 | [diff] [blame] | 512 | test_suites: ["general-tests"], |
Martin Stjernholm | 0da7dfc | 2021-05-12 00:38:05 +0100 | [diff] [blame] | 513 | defaults: [ |
Martin Stjernholm | 1dc77ab | 2021-05-10 17:44:05 +0100 | [diff] [blame] | 514 | "art_module_source_build_defaults", |
Martin Stjernholm | 0da7dfc | 2021-05-12 00:38:05 +0100 | [diff] [blame] | 515 | "art_test_defaults", |
| 516 | "libdexfile_support_static_defaults", |
| 517 | ], |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 518 | srcs: [ |
| 519 | "external/dex_file_supp_test.cc", |
| 520 | ], |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 521 | } |
| 522 | |
Martin Stjernholm | cbbc8df | 2020-09-30 22:02:32 +0100 | [diff] [blame] | 523 | // For use by external packages allowed to link in static libdexfile_support. |
| 524 | // This is not allowed in any module that may end up in an APEX or platform |
| 525 | // image, so visibility is restrictive. |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 526 | cc_library_static { |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 527 | name: "libdexfile_static", |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 528 | host_supported: true, |
Martin Stjernholm | cbbc8df | 2020-09-30 22:02:32 +0100 | [diff] [blame] | 529 | visibility: [ |
| 530 | // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report |
| 531 | // in the NDK. |
| 532 | "//system/extras/simpleperf", |
| 533 | "//cts/tests/tests/simpleperf", |
Martin Stjernholm | fe94b1c | 2019-01-31 17:40:39 +0000 | [diff] [blame] | 534 | ], |
Martin Stjernholm | cbbc8df | 2020-09-30 22:02:32 +0100 | [diff] [blame] | 535 | // Using libdexfile_support_static_defaults will link in external libs like |
| 536 | // libbase and libz statically as well, which are likely to cause duplicate |
| 537 | // copies in the depending module. |
| 538 | // TODO(b/169885605): Avoid exposing symbols from those libs. |
| 539 | defaults: [ |
| 540 | "art_defaults", |
| 541 | "libdexfile_support_static_defaults", |
| 542 | ], |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 543 | } |
| 544 | |
| 545 | art_cc_test { |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 546 | name: "art_libdexfile_static_tests", |
Martin Stjernholm | 0da7dfc | 2021-05-12 00:38:05 +0100 | [diff] [blame] | 547 | defaults: ["art_test_defaults"], |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 548 | test_suites: ["general-tests"], |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 549 | srcs: [ |
| 550 | "external/dex_file_supp_test.cc", |
| 551 | ], |
Martin Stjernholm | cbbc8df | 2020-09-30 22:02:32 +0100 | [diff] [blame] | 552 | static_libs: [ |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 553 | "libdexfile_static", |
Martin Stjernholm | cbbc8df | 2020-09-30 22:02:32 +0100 | [diff] [blame] | 554 | ], |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 555 | enabled: false, |
| 556 | target: { |
| 557 | linux: { |
| 558 | enabled: true, |
| 559 | }, |
| 560 | }, |
Martin Stjernholm | 49e80cc | 2021-03-03 00:13:09 +0000 | [diff] [blame] | 561 | // TODO(b/181740144): Enable a ubsan check to create a dependency on |
| 562 | // ubsan_minimal. It's needed to be able to link with the prebuilt |
Martin Stjernholm | d3e9ff3 | 2021-03-16 00:44:25 +0000 | [diff] [blame] | 563 | // libdexfile_static.a, which contains libziparchive.a, which is |
Martin Stjernholm | 49e80cc | 2021-03-03 00:13:09 +0000 | [diff] [blame] | 564 | // built with some ubsan checks |
| 565 | // (https://cs.android.com/android/platform/superproject/+/master:system/libziparchive/Android.bp;l=47-59;drc=c7b498fdf2002194709e40ea58ce39f43684fc14) |
| 566 | // that the SDK snapshots currently don't propagate properly for static |
| 567 | // libs. |
| 568 | sanitize: { |
| 569 | misc_undefined: ["shift"], |
| 570 | }, |
Martin Stjernholm | 68e5db5 | 2020-09-23 20:43:56 +0100 | [diff] [blame] | 571 | } |
Colin Cross | 7b55065 | 2020-11-17 10:12:52 -0800 | [diff] [blame] | 572 | |
| 573 | filegroup { |
| 574 | name: "art_libdexfile_dex_instruction_list_header", |
| 575 | srcs: ["dex/dex_instruction_list.h"], |
| 576 | } |