blob: 1e8d4db6f64d249457b56e661037cba22a003e64 [file] [log] [blame]
David Sehr334b9d72018-02-12 18:27:56 -08001//
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 Badour9150de62021-02-26 03:22:24 -080017package {
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 Sehr334b9d72018-02-12 18:27:56 -080026cc_defaults {
27 name: "libdexfile_defaults",
28 defaults: ["art_defaults"],
29 host_supported: true,
30 srcs: [
David Sehr1f010162018-05-15 08:59:32 -070031 "dex/art_dex_file_loader.cc",
David Sehr334b9d72018-02-12 18:27:56 -080032 "dex/compact_dex_file.cc",
Mathieu Chartier5e3cfa22018-02-20 16:53:37 -080033 "dex/compact_offset_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080034 "dex/descriptors_names.cc",
35 "dex/dex_file.cc",
36 "dex/dex_file_exception_helpers.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080037 "dex/dex_file_layout.cc",
David Sehr334b9d72018-02-12 18:27:56 -080038 "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 Sehr67bf42e2018-02-26 16:43:04 -080043 "dex/primitive.cc",
Andreas Gampead1aa632019-01-02 10:30:54 -080044 "dex/signature.cc",
David Sehr334b9d72018-02-12 18:27:56 -080045 "dex/standard_dex_file.cc",
David Sehr9c4a0152018-04-05 12:23:54 -070046 "dex/type_lookup_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080047 "dex/utf.cc",
48 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000049 header_libs: [
50 "jni_headers",
51 "libdexfile_external_headers",
52 ],
53 export_header_lib_headers: [
54 "jni_headers",
55 "libdexfile_external_headers",
56 ],
David Sehr334b9d72018-02-12 18:27:56 -080057 target: {
58 android: {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000059 srcs: [
60 "external/dex_file_ext.cc",
61 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000062 static_libs: [
63 "libziparchive",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000064 ],
David Sehr10db8fe2018-07-18 11:01:20 -070065 shared_libs: [
Jiyong Parkb1c8e162020-05-18 19:04:42 +090066 // libz provides a stub from platform, shouldn't be statically linked
67 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070068 // For MemMap.
69 "libartpalette",
70 "liblog",
71 // For common macros.
72 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -070073 ],
74 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070075 "libbase",
76 ],
David Sehr334b9d72018-02-12 18:27:56 -080077 },
David Sehr10db8fe2018-07-18 11:01:20 -070078 not_windows: {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000079 srcs: [
80 "external/dex_file_ext.cc",
81 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000082 shared_libs: [
83 "libziparchive",
84 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070085 // For MemMap.
86 "libartpalette",
87 "liblog",
88 // For common macros.
89 "libbase",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000090 ],
David Sehr10db8fe2018-07-18 11:01:20 -070091 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070092 "libbase",
93 ],
94 },
95 windows: {
96 static_libs: [
97 "libziparchive",
98 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070099 // For MemMap.
100 "libartpalette",
101 "liblog",
102 // For common macros.
103 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -0700104 ],
105 export_static_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -0700106 "libbase",
107 ],
108 cflags: ["-Wno-thread-safety"],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000109 },
David Srbeckyd53f6062019-03-22 14:55:21 +0000110 darwin: {
111 enabled: true,
112 },
David Sehr334b9d72018-02-12 18:27:56 -0800113 },
114 generated_sources: ["dexfile_operator_srcs"],
David Sehr334b9d72018-02-12 18:27:56 -0800115 export_include_dirs: ["."],
David Sehr334b9d72018-02-12 18:27:56 -0800116}
117
Andreas Gampeec5ed062018-01-26 16:20:02 -0800118cc_defaults {
119 name: "libdexfile_static_base_defaults",
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100120 whole_static_libs: [
Andreas Gampeec5ed062018-01-26 16:20:02 -0800121 "libbase",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800122 "liblog",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000123 "libz",
124 "libziparchive",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800125 ],
126}
127
128cc_defaults {
129 name: "libdexfile_static_defaults",
130 defaults: [
131 "libartbase_static_defaults",
132 "libdexfile_static_base_defaults",
133 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100134 defaults_visibility: [
135 "//art:__subpackages__",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100136 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100137 whole_static_libs: ["libdexfile"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800138}
139
140cc_defaults {
141 name: "libdexfiled_static_defaults",
142 defaults: [
143 "libartbased_static_defaults",
144 "libdexfile_static_base_defaults",
145 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100146 whole_static_libs: ["libdexfiled"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800147}
148
David Sehr334b9d72018-02-12 18:27:56 -0800149gensrcs {
150 name: "dexfile_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -0800151 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)",
152 tools: ["generate_operator_out"],
David Sehr334b9d72018-02-12 18:27:56 -0800153 srcs: [
154 "dex/dex_file.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800155 "dex/dex_file_layout.h",
David Sehr334b9d72018-02-12 18:27:56 -0800156 "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 Sehr334b9d72018-02-12 18:27:56 -0800163art_cc_library {
164 name: "libdexfile",
Christopher Ferrisac97f3e2021-06-17 20:59:10 +0000165 visibility: [
Martin Stjernholm315cf0c2021-08-26 21:34:52 +0100166 // 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 Ferrisac97f3e2021-06-17 20:59:10 +0000172 "//system/unwinding/libunwindstack",
173 ],
Christopher Ferris0d38e852019-12-11 09:37:19 -0800174 defaults: [
175 "libdexfile_defaults",
176 "libart_nativeunwind_defaults",
177 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700178 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100179 android: {
180 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700181 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100182 ],
183 export_shared_lib_headers: [
184 "libartbase",
185 ],
186 },
187 not_windows: {
188 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700189 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100190 ],
191 export_shared_lib_headers: [
192 "libartbase",
193 ],
194 },
David Sehr10db8fe2018-07-18 11:01:20 -0700195 windows: {
196 enabled: true,
197 shared: {
198 enabled: false,
199 },
David Srbecky7711c352019-04-10 17:50:12 +0100200 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700201 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100202 ],
203 export_static_lib_headers: [
204 "libartbase",
205 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700206 },
207 },
Jiyong Park066dd9022019-12-19 02:11:59 +0000208 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100209 "com.android.art",
Jiyong Park066dd9022019-12-19 02:11:59 +0000210 "com.android.art.debug",
Jiyong Park066dd9022019-12-19 02:11:59 +0000211 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000212 stubs: {
David Srbecky30d4d2f2021-03-24 16:11:49 +0000213 symbol_file: "libdexfile.map.txt",
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000214 versions: ["1"],
215 },
David Sehr334b9d72018-02-12 18:27:56 -0800216}
217
David Sehrfcbe15c2018-02-15 09:41:13 -0800218art_cc_library {
219 name: "libdexfiled",
220 defaults: [
221 "art_debug_defaults",
222 "libdexfile_defaults",
223 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700224 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100225 android: {
226 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700227 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100228 ],
229 export_shared_lib_headers: [
230 "libartbased",
231 ],
232 },
233 not_windows: {
234 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700235 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100236 ],
237 export_shared_lib_headers: [
238 "libartbased",
239 ],
240 },
David Sehr10db8fe2018-07-18 11:01:20 -0700241 windows: {
242 enabled: true,
243 shared: {
244 enabled: false,
245 },
David Srbecky7711c352019-04-10 17:50:12 +0100246 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700247 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100248 ],
249 export_static_lib_headers: [
250 "libartbased",
251 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700252 },
253 },
Jiyong Park066dd9022019-12-19 02:11:59 +0000254 apex_available: [
255 "com.android.art.debug",
Martin Stjernholma2f48a42021-04-09 13:23:21 +0100256 // 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 Park066dd9022019-12-19 02:11:59 +0000260 ],
David Sehrfcbe15c2018-02-15 09:41:13 -0800261}
262
Roland Levillainf0409142021-03-22 15:45:03 +0000263art_cc_defaults {
264 name: "art_libdexfile_tests_defaults",
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000265 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 Srbecky4a88a5a2020-05-05 16:21:57 +0100281 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 Hodson00cb81d2020-04-03 06:47:07 +0100288 header_libs: ["jni_headers"],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000289 shared_libs: [
290 "libbacktrace",
291 "libziparchive",
292 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000293}
294
Roland Levillainf0409142021-03-22 15:45:03 +0000295// 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.
297art_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.
306art_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 Stjernholmb3d2e832018-11-15 18:09:35 +0000315cc_library_headers {
316 name: "libdexfile_external_headers",
Martin Stjernholme10abe72021-10-28 03:49:55 +0100317 defaults: ["art_defaults"],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100318 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000319 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 Stjernholm7eba3772021-11-10 11:22:58 +0000328 darwin: {
329 enabled: true,
330 },
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000331 },
Jiyong Park71f661c2020-04-28 18:20:43 +0900332
333 apex_available: [
334 "//apex_available:platform",
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100335 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900336 "com.android.art.debug",
Martin Stjernholm694f0122020-10-30 02:23:24 +0000337 "com.android.media",
338 "com.android.runtime",
Jiyong Park71f661c2020-04-28 18:20:43 +0900339 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000340}
341
Paul Duffin4345aac2019-07-17 15:51:54 +0100342// Make dex_instruction_list.h available for tools/jvmti-agents/titrace
343cc_library_headers {
344 name: "libdexfile_all_headers",
Martin Stjernholme10abe72021-10-28 03:49:55 +0100345 defaults: ["art_defaults"],
Paul Duffin4345aac2019-07-17 15:51:54 +0100346 visibility: ["//art:__subpackages__"],
347 host_supported: true,
348 export_include_dirs: ["."],
Jiyong Park71f661c2020-04-28 18:20:43 +0900349
350 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100351 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900352 "com.android.art.debug",
Jiyong Park71f661c2020-04-28 18:20:43 +0900353 ],
Paul Duffin4345aac2019-07-17 15:51:54 +0100354}
355
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000356art_cc_test {
357 name: "art_libdexfile_external_tests",
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100358 defaults: [
359 "art_module_source_build_defaults",
360 "art_test_defaults",
361 ],
Martin Stjernholm842555d2020-03-23 14:38:47 +0000362 test_suites: ["general-tests"],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000363 srcs: [
364 "external/dex_file_ext_c_test.c",
David Srbecky30d4d2f2021-03-24 16:11:49 +0000365 "external/dex_file_ext_test.cc",
366 ],
367 shared_libs: [
368 "libartbase",
369 "libdexfile",
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000370 ],
Orion Hodson00cb81d2020-04-03 06:47:07 +0100371 header_libs: [
372 "jni_headers",
373 "libdexfile_external_headers",
374 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000375}
376
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000377// Support library with a C++ API for accessing the libdexfile API for external
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000378// (non-ART) users.
379//
Martin Stjernholm34b00fb2021-05-14 18:15:56 +0100380// 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 Stjernholmfe94b1c2019-01-31 17:40:39 +0000382// compiled without dex file support, given they won't encounter any dex file
383// stack frames.
Martin Stjernholm315cf0c2021-08-26 21:34:52 +0100384//
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 Stjernholm34b00fb2021-05-14 18:15:56 +0100392art_cc_library_static {
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000393 name: "libdexfile_support",
Martin Stjernholmf726d202021-10-28 03:52:25 +0100394 defaults: ["art_defaults"],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100395 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000396 host_supported: true,
397 srcs: [
398 "external/dex_file_supp.cc",
399 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000400 runtime_libs: ["libdexfile"],
David Srbecky2ddb98b2021-03-09 00:37:04 +0000401 shared_libs: [
402 "liblog",
403 "libbase",
404 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000405 header_libs: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000406 export_header_lib_headers: ["libdexfile_external_headers"],
Jiyong Park71f661c2020-04-28 18:20:43 +0900407
408 apex_available: [
409 "//apex_available:platform",
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100410 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900411 "com.android.art.debug",
Martin Stjernholm694f0122020-10-30 02:23:24 +0000412 "com.android.media",
413 "com.android.media.swcodec",
414 "com.android.runtime",
Jiyong Park71f661c2020-04-28 18:20:43 +0900415 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000416}
Martin Stjernholm750bf042019-01-09 22:51:12 +0000417
Roland Levillainf0409142021-03-22 15:45:03 +0000418art_cc_defaults {
419 name: "art_libdexfile_support_tests_defaults",
Roland Levillain61f07162019-06-26 12:44:04 +0100420 defaults: [
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100421 "art_module_source_build_defaults",
Roland Levillain61f07162019-06-26 12:44:04 +0100422 ],
Martin Stjernholm842555d2020-03-23 14:38:47 +0000423 test_suites: ["general-tests"],
Martin Stjernholm750bf042019-01-09 22:51:12 +0000424 srcs: [
425 "external/dex_file_supp_test.cc",
426 ],
427 shared_libs: [
428 "libartbase",
429 "libbase",
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000430 "libdexfile",
Martin Stjernholm34b00fb2021-05-14 18:15:56 +0100431 "liblog",
432 ],
433 static_libs: [
Martin Stjernholm750bf042019-01-09 22:51:12 +0000434 "libdexfile_support",
435 ],
436}
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000437
Roland Levillainf0409142021-03-22 15:45:03 +0000438// 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.
440art_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.
451art_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 Levillain6a2e6892021-07-04 14:21:07 +0100470
471 test_suites: [
472 "mts-art",
473 ],
Roland Levillainf0409142021-03-22 15:45:03 +0000474}
475
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100476cc_library_static {
477 name: "libdexfile_support_static",
Martin Stjernholme3878022021-11-23 16:29:52 +0000478 defaults: ["art_defaults"],
Martin Stjernholmd3ee98a2019-09-23 16:26:50 +0100479 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000480 srcs: [
481 "external/dex_file_supp.cc",
482 ],
483 cflags: ["-DSTATIC_LIB"],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000484 header_libs: ["libdexfile_external_headers"],
485 export_header_lib_headers: ["libdexfile_external_headers"],
486}
487
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100488cc_defaults {
489 name: "libdexfile_support_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100490 defaults: [
491 "libdexfile_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100492 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100493 whole_static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000494 "libdexfile",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100495 "libdexfile_support_static",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100496 ],
497}
498
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100499cc_defaults {
500 name: "libdexfiled_support_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100501 defaults: [
Martin Stjernholm621afb42019-09-23 22:01:36 +0100502 "libdexfiled_static_defaults",
503 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100504 whole_static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000505 "libdexfiled",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100506 "libdexfile_support_static",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100507 ],
508}
509
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000510art_cc_test {
511 name: "art_libdexfile_support_static_tests",
Martin Stjernholm842555d2020-03-23 14:38:47 +0000512 test_suites: ["general-tests"],
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100513 defaults: [
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100514 "art_module_source_build_defaults",
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100515 "art_test_defaults",
516 "libdexfile_support_static_defaults",
517 ],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000518 srcs: [
519 "external/dex_file_supp_test.cc",
520 ],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100521}
522
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100523// 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 Stjernholm68e5db52020-09-23 20:43:56 +0100526cc_library_static {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000527 name: "libdexfile_static",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100528 host_supported: true,
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100529 visibility: [
530 // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report
531 // in the NDK.
532 "//system/extras/simpleperf",
533 "//cts/tests/tests/simpleperf",
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000534 ],
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100535 // 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 Stjernholm68e5db52020-09-23 20:43:56 +0100543}
544
545art_cc_test {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000546 name: "art_libdexfile_static_tests",
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100547 defaults: ["art_test_defaults"],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100548 test_suites: ["general-tests"],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100549 srcs: [
550 "external/dex_file_supp_test.cc",
551 ],
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100552 static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000553 "libdexfile_static",
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100554 ],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100555 enabled: false,
556 target: {
557 linux: {
558 enabled: true,
559 },
560 },
Martin Stjernholm49e80cc2021-03-03 00:13:09 +0000561 // 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 Stjernholmd3e9ff32021-03-16 00:44:25 +0000563 // libdexfile_static.a, which contains libziparchive.a, which is
Martin Stjernholm49e80cc2021-03-03 00:13:09 +0000564 // 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 Stjernholm68e5db52020-09-23 20:43:56 +0100571}
Colin Cross7b550652020-11-17 10:12:52 -0800572
573filegroup {
574 name: "art_libdexfile_dex_instruction_list_header",
575 srcs: ["dex/dex_instruction_list.h"],
576}