blob: c6f18b62afc263921d10c5b67db5935fae02e3c6 [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,
Chih-Hung Hsieha0a5f002022-02-17 21:14:37 -080030 tidy_timeout_srcs: [
31 "dex/dex_file_verifier.cc",
32 ],
David Sehr334b9d72018-02-12 18:27:56 -080033 srcs: [
David Sehr1f010162018-05-15 08:59:32 -070034 "dex/art_dex_file_loader.cc",
David Sehr334b9d72018-02-12 18:27:56 -080035 "dex/compact_dex_file.cc",
Mathieu Chartier5e3cfa22018-02-20 16:53:37 -080036 "dex/compact_offset_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080037 "dex/descriptors_names.cc",
38 "dex/dex_file.cc",
39 "dex/dex_file_exception_helpers.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080040 "dex/dex_file_layout.cc",
David Sehr334b9d72018-02-12 18:27:56 -080041 "dex/dex_file_loader.cc",
42 "dex/dex_file_tracking_registrar.cc",
43 "dex/dex_file_verifier.cc",
44 "dex/dex_instruction.cc",
45 "dex/modifiers.cc",
David Sehr67bf42e2018-02-26 16:43:04 -080046 "dex/primitive.cc",
Andreas Gampead1aa632019-01-02 10:30:54 -080047 "dex/signature.cc",
David Sehr334b9d72018-02-12 18:27:56 -080048 "dex/standard_dex_file.cc",
David Sehr9c4a0152018-04-05 12:23:54 -070049 "dex/type_lookup_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080050 "dex/utf.cc",
51 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000052 header_libs: [
53 "jni_headers",
54 "libdexfile_external_headers",
55 ],
56 export_header_lib_headers: [
57 "jni_headers",
58 "libdexfile_external_headers",
59 ],
David Sehr334b9d72018-02-12 18:27:56 -080060 target: {
61 android: {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000062 srcs: [
63 "external/dex_file_ext.cc",
64 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000065 static_libs: [
66 "libziparchive",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000067 ],
David Sehr10db8fe2018-07-18 11:01:20 -070068 shared_libs: [
Jiyong Parkb1c8e162020-05-18 19:04:42 +090069 // libz provides a stub from platform, shouldn't be statically linked
70 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070071 // For MemMap.
72 "libartpalette",
73 "liblog",
74 // For common macros.
75 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -070076 ],
77 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070078 "libbase",
79 ],
David Sehr334b9d72018-02-12 18:27:56 -080080 },
David Sehr10db8fe2018-07-18 11:01:20 -070081 not_windows: {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +000082 srcs: [
83 "external/dex_file_ext.cc",
84 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000085 shared_libs: [
86 "libziparchive",
87 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070088 // For MemMap.
89 "libartpalette",
90 "liblog",
91 // For common macros.
92 "libbase",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000093 ],
David Sehr10db8fe2018-07-18 11:01:20 -070094 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070095 "libbase",
96 ],
97 },
98 windows: {
99 static_libs: [
100 "libziparchive",
101 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700102 // For MemMap.
103 "libartpalette",
104 "liblog",
105 // For common macros.
106 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -0700107 ],
108 export_static_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -0700109 "libbase",
110 ],
111 cflags: ["-Wno-thread-safety"],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000112 },
David Srbeckyd53f6062019-03-22 14:55:21 +0000113 darwin: {
114 enabled: true,
115 },
David Sehr334b9d72018-02-12 18:27:56 -0800116 },
117 generated_sources: ["dexfile_operator_srcs"],
David Sehr334b9d72018-02-12 18:27:56 -0800118 export_include_dirs: ["."],
David Sehr334b9d72018-02-12 18:27:56 -0800119}
120
Andreas Gampeec5ed062018-01-26 16:20:02 -0800121cc_defaults {
122 name: "libdexfile_static_base_defaults",
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100123 whole_static_libs: [
Andreas Gampeec5ed062018-01-26 16:20:02 -0800124 "libbase",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800125 "liblog",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000126 "libz",
127 "libziparchive",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800128 ],
129}
130
131cc_defaults {
132 name: "libdexfile_static_defaults",
133 defaults: [
134 "libartbase_static_defaults",
135 "libdexfile_static_base_defaults",
136 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100137 defaults_visibility: [
138 "//art:__subpackages__",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100139 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100140 whole_static_libs: ["libdexfile"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800141}
142
143cc_defaults {
144 name: "libdexfiled_static_defaults",
145 defaults: [
146 "libartbased_static_defaults",
147 "libdexfile_static_base_defaults",
148 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100149 whole_static_libs: ["libdexfiled"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800150}
151
David Sehr334b9d72018-02-12 18:27:56 -0800152gensrcs {
153 name: "dexfile_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -0800154 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)",
155 tools: ["generate_operator_out"],
David Sehr334b9d72018-02-12 18:27:56 -0800156 srcs: [
157 "dex/dex_file.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800158 "dex/dex_file_layout.h",
David Sehr334b9d72018-02-12 18:27:56 -0800159 "dex/dex_instruction.h",
160 "dex/dex_instruction_utils.h",
161 "dex/invoke_type.h",
162 ],
163 output_extension: "operator_out.cc",
164}
165
David Sehr334b9d72018-02-12 18:27:56 -0800166art_cc_library {
167 name: "libdexfile",
Christopher Ferrisac97f3e2021-06-17 20:59:10 +0000168 visibility: [
Martin Stjernholm315cf0c2021-08-26 21:34:52 +0100169 // Allow libdexfile_support users to list this as a runtime_libs
170 // dependency - see comment for libdexfile_support. It shouldn't be used
171 // for any other purpose.
172 "//external/perfetto",
173 "//system/core/debuggerd",
174 "//system/extras/simpleperf",
Christopher Ferrisac97f3e2021-06-17 20:59:10 +0000175 "//system/unwinding/libunwindstack",
176 ],
Christopher Ferris0d38e852019-12-11 09:37:19 -0800177 defaults: [
178 "libdexfile_defaults",
179 "libart_nativeunwind_defaults",
180 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700181 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100182 android: {
183 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700184 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100185 ],
186 export_shared_lib_headers: [
187 "libartbase",
188 ],
189 },
190 not_windows: {
191 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700192 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100193 ],
194 export_shared_lib_headers: [
195 "libartbase",
196 ],
197 },
David Sehr10db8fe2018-07-18 11:01:20 -0700198 windows: {
199 enabled: true,
200 shared: {
201 enabled: false,
202 },
David Srbecky7711c352019-04-10 17:50:12 +0100203 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700204 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100205 ],
206 export_static_lib_headers: [
207 "libartbase",
208 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700209 },
210 },
Jiyong Park066dd9022019-12-19 02:11:59 +0000211 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100212 "com.android.art",
Jiyong Park066dd9022019-12-19 02:11:59 +0000213 "com.android.art.debug",
Jiyong Park066dd9022019-12-19 02:11:59 +0000214 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000215 stubs: {
David Srbecky30d4d2f2021-03-24 16:11:49 +0000216 symbol_file: "libdexfile.map.txt",
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000217 versions: ["1"],
218 },
David Sehr334b9d72018-02-12 18:27:56 -0800219}
220
David Sehrfcbe15c2018-02-15 09:41:13 -0800221art_cc_library {
222 name: "libdexfiled",
223 defaults: [
224 "art_debug_defaults",
225 "libdexfile_defaults",
226 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700227 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100228 android: {
229 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700230 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100231 ],
232 export_shared_lib_headers: [
233 "libartbased",
234 ],
235 },
236 not_windows: {
237 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700238 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100239 ],
240 export_shared_lib_headers: [
241 "libartbased",
242 ],
243 },
David Sehr10db8fe2018-07-18 11:01:20 -0700244 windows: {
245 enabled: true,
246 shared: {
247 enabled: false,
248 },
David Srbecky7711c352019-04-10 17:50:12 +0100249 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700250 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100251 ],
252 export_static_lib_headers: [
253 "libartbased",
254 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700255 },
256 },
Jiyong Park066dd9022019-12-19 02:11:59 +0000257 apex_available: [
258 "com.android.art.debug",
Martin Stjernholma2f48a42021-04-09 13:23:21 +0100259 // TODO(b/183882457): This lib doesn't go into com.android.art, but
260 // apex_available lists need to be the same for internal libs to avoid
261 // stubs, and libartd depends on this.
262 "com.android.art",
Jiyong Park066dd9022019-12-19 02:11:59 +0000263 ],
David Sehrfcbe15c2018-02-15 09:41:13 -0800264}
265
Roland Levillainf0409142021-03-22 15:45:03 +0000266art_cc_defaults {
267 name: "art_libdexfile_tests_defaults",
Chih-Hung Hsieha0a5f002022-02-17 21:14:37 -0800268 tidy_timeout_srcs: [
269 "dex/dex_file_verifier_test.cc",
270 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000271 srcs: [
272 "dex/art_dex_file_loader_test.cc",
273 "dex/class_accessor_test.cc",
274 "dex/code_item_accessors_test.cc",
275 "dex/compact_dex_file_test.cc",
276 "dex/compact_offset_table_test.cc",
277 "dex/descriptors_names_test.cc",
278 "dex/test_dex_file_builder_test.cc",
279 "dex/dex_file_loader_test.cc",
280 "dex/dex_file_verifier_test.cc",
281 "dex/dex_instruction_test.cc",
282 "dex/primitive_test.cc",
283 "dex/string_reference_test.cc",
284 "dex/type_lookup_table_test.cc",
285 "dex/utf_test.cc",
286 ],
David Srbecky4a88a5a2020-05-05 16:21:57 +0100287 data: [
288 ":art-gtest-jars-GetMethodSignature",
289 ":art-gtest-jars-Lookup",
290 ":art-gtest-jars-Main",
291 ":art-gtest-jars-MultiDex",
292 ":art-gtest-jars-Nested",
293 ],
Orion Hodson00cb81d2020-04-03 06:47:07 +0100294 header_libs: ["jni_headers"],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000295 shared_libs: [
Christopher Ferrisf44070e2022-03-26 09:54:32 -0700296 "libunwindstack",
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000297 "libziparchive",
298 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000299}
300
Roland Levillainf0409142021-03-22 15:45:03 +0000301// Version of ART gtest `art_libdexfile_tests` bundled with the ART APEX on target.
302// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
303art_cc_test {
304 name: "art_libdexfile_tests",
305 defaults: [
306 "art_gtest_defaults",
307 "art_libdexfile_tests_defaults",
308 ],
309}
310
311// Standalone version of ART gtest `art_libdexfile_tests`, not bundled with the ART APEX on target.
312art_cc_test {
313 name: "art_standalone_libdexfile_tests",
314 defaults: [
315 "art_standalone_gtest_defaults",
316 "art_libdexfile_tests_defaults",
317 ],
318 test_config: "art_standalone_libdexfile_tests.xml",
319}
320
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000321cc_library_headers {
322 name: "libdexfile_external_headers",
Martin Stjernholme10abe72021-10-28 03:49:55 +0100323 defaults: ["art_defaults"],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100324 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000325 host_supported: true,
326 header_libs: ["libbase_headers"],
327 export_header_lib_headers: ["libbase_headers"],
328 export_include_dirs: ["external/include"],
329
330 target: {
331 windows: {
332 enabled: true,
333 },
Martin Stjernholm7eba3772021-11-10 11:22:58 +0000334 darwin: {
335 enabled: true,
336 },
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000337 },
Jiyong Park71f661c2020-04-28 18:20:43 +0900338
339 apex_available: [
340 "//apex_available:platform",
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100341 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900342 "com.android.art.debug",
Martin Stjernholm694f0122020-10-30 02:23:24 +0000343 "com.android.media",
344 "com.android.runtime",
Jiyong Park71f661c2020-04-28 18:20:43 +0900345 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000346}
347
Paul Duffin4345aac2019-07-17 15:51:54 +0100348// Make dex_instruction_list.h available for tools/jvmti-agents/titrace
349cc_library_headers {
350 name: "libdexfile_all_headers",
Martin Stjernholme10abe72021-10-28 03:49:55 +0100351 defaults: ["art_defaults"],
Paul Duffin4345aac2019-07-17 15:51:54 +0100352 visibility: ["//art:__subpackages__"],
353 host_supported: true,
354 export_include_dirs: ["."],
Jiyong Park71f661c2020-04-28 18:20:43 +0900355
356 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100357 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900358 "com.android.art.debug",
Jiyong Park71f661c2020-04-28 18:20:43 +0900359 ],
Paul Duffin4345aac2019-07-17 15:51:54 +0100360}
361
Martin Stjernholm34aa3ae2022-01-19 23:05:20 +0000362art_cc_defaults {
363 name: "art_libdexfile_external_tests_defaults",
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100364 defaults: [
365 "art_module_source_build_defaults",
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100366 ],
Martin Stjernholm842555d2020-03-23 14:38:47 +0000367 test_suites: ["general-tests"],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000368 srcs: [
369 "external/dex_file_ext_c_test.c",
David Srbecky30d4d2f2021-03-24 16:11:49 +0000370 "external/dex_file_ext_test.cc",
371 ],
372 shared_libs: [
373 "libartbase",
374 "libdexfile",
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000375 ],
Orion Hodson00cb81d2020-04-03 06:47:07 +0100376 header_libs: [
377 "jni_headers",
378 "libdexfile_external_headers",
379 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000380}
381
Martin Stjernholm34aa3ae2022-01-19 23:05:20 +0000382// Version of ART gtest `art_libdexfile_external_tests` bundled with the ART APEX on target.
383// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
384art_cc_test {
385 name: "art_libdexfile_external_tests",
386 defaults: [
387 "art_test_defaults",
388 "art_libdexfile_external_tests_defaults",
389 ],
390}
391
392// Standalone version of ART gtest `art_libdexfile_external_tests`, not bundled with the ART APEX on
393// target.
394art_cc_test {
395 name: "art_standalone_libdexfile_external_tests",
396 defaults: [
397 "art_standalone_test_defaults",
398 "art_libdexfile_external_tests_defaults",
399 ],
400
Martin Stjernholm34aa3ae2022-01-19 23:05:20 +0000401 test_config_template: ":art-gtests-target-standalone-cts-template",
402 test_suites: ["cts"], // For backed-by API coverage.
403}
404
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000405// Support library with a C++ API for accessing the libdexfile API for external
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000406// (non-ART) users.
407//
Martin Stjernholm34b00fb2021-05-14 18:15:56 +0100408// This library dlopens libdexfile(d).so on first use, so there is no build time
409// dependency on dex file logic. It is therefore safe to use from binaries
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000410// compiled without dex file support, given they won't encounter any dex file
411// stack frames.
Martin Stjernholm315cf0c2021-08-26 21:34:52 +0100412//
413// IMPORTANT: When adding a static_libs dependency on this library, please
414// remember to also add a corresponding
415//
416// runtime_libs: ["libdexfile"],
417//
418// That is necessary since Soong doesn't propagate dependencies transitively for
419// static libraries (b/169779783).
Martin Stjernholm34b00fb2021-05-14 18:15:56 +0100420art_cc_library_static {
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000421 name: "libdexfile_support",
Martin Stjernholmf726d202021-10-28 03:52:25 +0100422 defaults: ["art_defaults"],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100423 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000424 host_supported: true,
425 srcs: [
426 "external/dex_file_supp.cc",
427 ],
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000428 runtime_libs: ["libdexfile"],
David Srbecky2ddb98b2021-03-09 00:37:04 +0000429 shared_libs: [
430 "liblog",
431 "libbase",
432 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000433 header_libs: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000434 export_header_lib_headers: ["libdexfile_external_headers"],
Jiyong Park71f661c2020-04-28 18:20:43 +0900435
436 apex_available: [
437 "//apex_available:platform",
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100438 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900439 "com.android.art.debug",
Martin Stjernholm694f0122020-10-30 02:23:24 +0000440 "com.android.media",
441 "com.android.media.swcodec",
442 "com.android.runtime",
Jiyong Park71f661c2020-04-28 18:20:43 +0900443 ],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000444}
Martin Stjernholm750bf042019-01-09 22:51:12 +0000445
Roland Levillainf0409142021-03-22 15:45:03 +0000446art_cc_defaults {
447 name: "art_libdexfile_support_tests_defaults",
Roland Levillain61f07162019-06-26 12:44:04 +0100448 defaults: [
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100449 "art_module_source_build_defaults",
Roland Levillain61f07162019-06-26 12:44:04 +0100450 ],
Martin Stjernholm842555d2020-03-23 14:38:47 +0000451 test_suites: ["general-tests"],
Martin Stjernholm750bf042019-01-09 22:51:12 +0000452 srcs: [
453 "external/dex_file_supp_test.cc",
454 ],
455 shared_libs: [
456 "libartbase",
457 "libbase",
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000458 "libdexfile",
Martin Stjernholm34b00fb2021-05-14 18:15:56 +0100459 "liblog",
460 ],
461 static_libs: [
Martin Stjernholm750bf042019-01-09 22:51:12 +0000462 "libdexfile_support",
463 ],
464}
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000465
Roland Levillainf0409142021-03-22 15:45:03 +0000466// Version of ART gtest `art_libdexfile_support_tests` bundled with the ART APEX on target.
467// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
468art_cc_test {
469 name: "art_libdexfile_support_tests",
470 host_supported: true,
471 defaults: [
472 "art_test_defaults",
473 "art_libdexfile_support_tests_defaults",
474 ],
475}
476
477// Standalone version of ART gtest `art_libdexfile_support_tests`, not bundled with the ART APEX on
478// target.
479art_cc_test {
480 name: "art_standalone_libdexfile_support_tests",
481 defaults: [
482 "art_standalone_test_defaults",
483 "art_libdexfile_support_tests_defaults",
484 ],
Roland Levillain6a2e6892021-07-04 14:21:07 +0100485 test_suites: [
486 "mts-art",
487 ],
Roland Levillainf0409142021-03-22 15:45:03 +0000488}
489
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100490cc_library_static {
491 name: "libdexfile_support_static",
Martin Stjernholme3878022021-11-23 16:29:52 +0000492 defaults: ["art_defaults"],
Martin Stjernholmd3ee98a2019-09-23 16:26:50 +0100493 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000494 srcs: [
495 "external/dex_file_supp.cc",
496 ],
497 cflags: ["-DSTATIC_LIB"],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000498 header_libs: ["libdexfile_external_headers"],
499 export_header_lib_headers: ["libdexfile_external_headers"],
500}
501
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100502cc_defaults {
503 name: "libdexfile_support_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100504 defaults: [
505 "libdexfile_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100506 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100507 whole_static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000508 "libdexfile",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100509 "libdexfile_support_static",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100510 ],
511}
512
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100513cc_defaults {
514 name: "libdexfiled_support_static_defaults",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100515 defaults: [
Martin Stjernholm621afb42019-09-23 22:01:36 +0100516 "libdexfiled_static_defaults",
517 ],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100518 whole_static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000519 "libdexfiled",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100520 "libdexfile_support_static",
Martin Stjernholm621afb42019-09-23 22:01:36 +0100521 ],
522}
523
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000524art_cc_test {
525 name: "art_libdexfile_support_static_tests",
Martin Stjernholm842555d2020-03-23 14:38:47 +0000526 test_suites: ["general-tests"],
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100527 defaults: [
Martin Stjernholm1dc77ab2021-05-10 17:44:05 +0100528 "art_module_source_build_defaults",
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100529 "art_test_defaults",
530 "libdexfile_support_static_defaults",
531 ],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000532 srcs: [
533 "external/dex_file_supp_test.cc",
534 ],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100535}
536
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100537// For use by external packages allowed to link in static libdexfile_support.
538// This is not allowed in any module that may end up in an APEX or platform
539// image, so visibility is restrictive.
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100540cc_library_static {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000541 name: "libdexfile_static",
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100542 host_supported: true,
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100543 visibility: [
544 // Required for simpleperf, libsimpleperf_record, and libsimpleperf_report
545 // in the NDK.
546 "//system/extras/simpleperf",
547 "//cts/tests/tests/simpleperf",
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000548 ],
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100549 // Using libdexfile_support_static_defaults will link in external libs like
550 // libbase and libz statically as well, which are likely to cause duplicate
551 // copies in the depending module.
552 // TODO(b/169885605): Avoid exposing symbols from those libs.
553 defaults: [
554 "art_defaults",
555 "libdexfile_support_static_defaults",
556 ],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100557}
558
559art_cc_test {
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000560 name: "art_libdexfile_static_tests",
Martin Stjernholm0da7dfc2021-05-12 00:38:05 +0100561 defaults: ["art_test_defaults"],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100562 test_suites: ["general-tests"],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100563 srcs: [
564 "external/dex_file_supp_test.cc",
565 ],
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100566 static_libs: [
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000567 "libdexfile_static",
Martin Stjernholmcbbc8df2020-09-30 22:02:32 +0100568 ],
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100569 enabled: false,
570 target: {
571 linux: {
572 enabled: true,
573 },
574 },
Martin Stjernholm49e80cc2021-03-03 00:13:09 +0000575 // TODO(b/181740144): Enable a ubsan check to create a dependency on
576 // ubsan_minimal. It's needed to be able to link with the prebuilt
Martin Stjernholmd3e9ff32021-03-16 00:44:25 +0000577 // libdexfile_static.a, which contains libziparchive.a, which is
Martin Stjernholm49e80cc2021-03-03 00:13:09 +0000578 // built with some ubsan checks
579 // (https://cs.android.com/android/platform/superproject/+/master:system/libziparchive/Android.bp;l=47-59;drc=c7b498fdf2002194709e40ea58ce39f43684fc14)
580 // that the SDK snapshots currently don't propagate properly for static
581 // libs.
582 sanitize: {
583 misc_undefined: ["shift"],
584 },
Martin Stjernholm68e5db52020-09-23 20:43:56 +0100585}
Colin Cross7b550652020-11-17 10:12:52 -0800586
587filegroup {
588 name: "art_libdexfile_dex_instruction_list_header",
589 srcs: ["dex/dex_instruction_list.h"],
590}