blob: a08f89faa63683f7c4053d32953f514290eff9e4 [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
17cc_defaults {
18 name: "libdexfile_defaults",
19 defaults: ["art_defaults"],
20 host_supported: true,
21 srcs: [
David Sehr1f010162018-05-15 08:59:32 -070022 "dex/art_dex_file_loader.cc",
David Sehr334b9d72018-02-12 18:27:56 -080023 "dex/compact_dex_file.cc",
Mathieu Chartier5e3cfa22018-02-20 16:53:37 -080024 "dex/compact_offset_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080025 "dex/descriptors_names.cc",
26 "dex/dex_file.cc",
27 "dex/dex_file_exception_helpers.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080028 "dex/dex_file_layout.cc",
David Sehr334b9d72018-02-12 18:27:56 -080029 "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 Sehr67bf42e2018-02-26 16:43:04 -080034 "dex/primitive.cc",
Andreas Gampead1aa632019-01-02 10:30:54 -080035 "dex/signature.cc",
David Sehr334b9d72018-02-12 18:27:56 -080036 "dex/standard_dex_file.cc",
David Sehr9c4a0152018-04-05 12:23:54 -070037 "dex/type_lookup_table.cc",
David Sehr334b9d72018-02-12 18:27:56 -080038 "dex/utf.cc",
39 ],
40
41 target: {
42 android: {
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000043 static_libs: [
44 "libziparchive",
45 "libz",
46 ],
David Sehr10db8fe2018-07-18 11:01:20 -070047 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -070048 // For MemMap.
49 "libartpalette",
50 "liblog",
51 // For common macros.
52 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -070053 ],
54 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070055 "libbase",
56 ],
David Sehr334b9d72018-02-12 18:27:56 -080057 },
David Sehr10db8fe2018-07-18 11:01:20 -070058 not_windows: {
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000059 shared_libs: [
60 "libziparchive",
61 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070062 // For MemMap.
63 "libartpalette",
64 "liblog",
65 // For common macros.
66 "libbase",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000067 ],
David Sehr10db8fe2018-07-18 11:01:20 -070068 export_shared_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070069 "libbase",
70 ],
71 },
72 windows: {
73 static_libs: [
74 "libziparchive",
75 "libz",
Andreas Gampe0dc93b12019-05-15 10:30:22 -070076 // For MemMap.
77 "libartpalette",
78 "liblog",
79 // For common macros.
80 "libbase",
David Sehr10db8fe2018-07-18 11:01:20 -070081 ],
82 export_static_lib_headers: [
David Sehr10db8fe2018-07-18 11:01:20 -070083 "libbase",
84 ],
85 cflags: ["-Wno-thread-safety"],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000086 },
David Srbeckyd53f6062019-03-22 14:55:21 +000087 darwin: {
88 enabled: true,
89 },
David Sehr334b9d72018-02-12 18:27:56 -080090 },
91 generated_sources: ["dexfile_operator_srcs"],
David Sehr334b9d72018-02-12 18:27:56 -080092 export_include_dirs: ["."],
David Sehr334b9d72018-02-12 18:27:56 -080093}
94
Andreas Gampeec5ed062018-01-26 16:20:02 -080095cc_defaults {
96 name: "libdexfile_static_base_defaults",
97 static_libs: [
98 "libbase",
Andreas Gampeec5ed062018-01-26 16:20:02 -080099 "liblog",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000100 "libz",
101 "libziparchive",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800102 ],
103}
104
105cc_defaults {
106 name: "libdexfile_static_defaults",
107 defaults: [
108 "libartbase_static_defaults",
109 "libdexfile_static_base_defaults",
110 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100111 defaults_visibility: [
112 "//art:__subpackages__",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100113 ],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800114 static_libs: ["libdexfile"],
115}
116
117cc_defaults {
118 name: "libdexfiled_static_defaults",
119 defaults: [
120 "libartbased_static_defaults",
121 "libdexfile_static_base_defaults",
122 ],
123 static_libs: ["libdexfiled"],
124}
125
David Sehr334b9d72018-02-12 18:27:56 -0800126gensrcs {
127 name: "dexfile_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -0800128 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)",
129 tools: ["generate_operator_out"],
David Sehr334b9d72018-02-12 18:27:56 -0800130 srcs: [
131 "dex/dex_file.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800132 "dex/dex_file_layout.h",
David Sehr334b9d72018-02-12 18:27:56 -0800133 "dex/dex_instruction.h",
134 "dex/dex_instruction_utils.h",
135 "dex/invoke_type.h",
David Sehr312f3b22018-03-19 08:39:26 -0700136 "dex/method_reference.h",
David Sehr334b9d72018-02-12 18:27:56 -0800137 ],
138 output_extension: "operator_out.cc",
139}
140
David Sehr334b9d72018-02-12 18:27:56 -0800141art_cc_library {
142 name: "libdexfile",
143 defaults: ["libdexfile_defaults"],
144 // Leave the symbols in the shared library so that stack unwinders can
145 // produce meaningful name resolution.
146 strip: {
147 keep_symbols: true,
148 },
David Sehr10db8fe2018-07-18 11:01:20 -0700149 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100150 android: {
151 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700152 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100153 ],
154 export_shared_lib_headers: [
155 "libartbase",
156 ],
157 },
158 not_windows: {
159 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700160 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100161 ],
162 export_shared_lib_headers: [
163 "libartbase",
164 ],
165 },
David Sehr10db8fe2018-07-18 11:01:20 -0700166 windows: {
167 enabled: true,
168 shared: {
169 enabled: false,
170 },
David Srbecky7711c352019-04-10 17:50:12 +0100171 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700172 "libartbase",
David Srbecky7711c352019-04-10 17:50:12 +0100173 ],
174 export_static_lib_headers: [
175 "libartbase",
176 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700177 },
178 },
David Sehr334b9d72018-02-12 18:27:56 -0800179}
180
David Sehrfcbe15c2018-02-15 09:41:13 -0800181art_cc_library {
182 name: "libdexfiled",
183 defaults: [
184 "art_debug_defaults",
185 "libdexfile_defaults",
186 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700187 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100188 android: {
189 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700190 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100191 ],
192 export_shared_lib_headers: [
193 "libartbased",
194 ],
195 },
196 not_windows: {
197 shared_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700198 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100199 ],
200 export_shared_lib_headers: [
201 "libartbased",
202 ],
203 },
David Sehr10db8fe2018-07-18 11:01:20 -0700204 windows: {
205 enabled: true,
206 shared: {
207 enabled: false,
208 },
David Srbecky7711c352019-04-10 17:50:12 +0100209 static_libs: [
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700210 "libartbased",
David Srbecky7711c352019-04-10 17:50:12 +0100211 ],
212 export_static_lib_headers: [
213 "libartbased",
214 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700215 },
216 },
David Sehrfcbe15c2018-02-15 09:41:13 -0800217}
218
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000219art_cc_test {
220 name: "art_libdexfile_tests",
221 defaults: [
222 "art_gtest_defaults",
223 ],
224 srcs: [
225 "dex/art_dex_file_loader_test.cc",
226 "dex/class_accessor_test.cc",
227 "dex/code_item_accessors_test.cc",
228 "dex/compact_dex_file_test.cc",
229 "dex/compact_offset_table_test.cc",
230 "dex/descriptors_names_test.cc",
231 "dex/test_dex_file_builder_test.cc",
232 "dex/dex_file_loader_test.cc",
233 "dex/dex_file_verifier_test.cc",
234 "dex/dex_instruction_test.cc",
235 "dex/primitive_test.cc",
236 "dex/string_reference_test.cc",
237 "dex/type_lookup_table_test.cc",
238 "dex/utf_test.cc",
239 ],
240 shared_libs: [
241 "libbacktrace",
242 "libziparchive",
243 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000244}
245
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000246cc_library_headers {
247 name: "libdexfile_external_headers",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100248 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000249 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000250 vendor_available: true,
251 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000252 header_libs: ["libbase_headers"],
253 export_header_lib_headers: ["libbase_headers"],
254 export_include_dirs: ["external/include"],
255
256 target: {
257 windows: {
258 enabled: true,
259 },
260 },
261}
262
Paul Duffin4345aac2019-07-17 15:51:54 +0100263// Make dex_instruction_list.h available for tools/jvmti-agents/titrace
264cc_library_headers {
265 name: "libdexfile_all_headers",
266 visibility: ["//art:__subpackages__"],
267 host_supported: true,
268 export_include_dirs: ["."],
269}
270
David Srbecky7711c352019-04-10 17:50:12 +0100271cc_defaults {
272 name: "libdexfile_external-defaults",
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000273 host_supported: true,
274 srcs: [
275 "external/dex_file_ext.cc",
276 ],
277 header_libs: ["libdexfile_external_headers"],
278 shared_libs: [
279 "libbase",
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000280 ],
Martin Stjernholm84bf6982019-02-05 15:07:57 +0000281 stubs: {
282 symbol_file: "external/libdexfile_external.map.txt",
283 versions: ["1"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000284 },
Jiyong Park7ed5e602019-09-04 17:25:23 +0900285 export_header_lib_headers: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000286}
287
David Srbecky7711c352019-04-10 17:50:12 +0100288cc_library {
289 name: "libdexfile_external",
290 defaults: [
291 "art_defaults",
292 "libdexfile_external-defaults",
293 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100294 visibility: ["//visibility:public"],
David Srbecky52fc7ab2019-05-03 11:03:52 +0100295 target: {
296 darwin: {
297 enabled: true,
298 },
299 },
David Srbecky7711c352019-04-10 17:50:12 +0100300 shared_libs: [
301 "libdexfile",
302 ],
303}
304
305cc_library {
306 name: "libdexfiled_external",
307 defaults: [
308 "art_debug_defaults",
309 "libdexfile_external-defaults",
310 ],
David Srbecky52fc7ab2019-05-03 11:03:52 +0100311 target: {
312 darwin: {
313 enabled: true,
314 },
315 },
David Srbecky7711c352019-04-10 17:50:12 +0100316 shared_libs: [
317 "libdexfiled",
318 ],
319}
320
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000321art_cc_test {
322 name: "art_libdexfile_external_tests",
323 host_supported: true,
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700324 test_per_src: true, // For consistency with other ART gtests.
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000325 srcs: [
326 "external/dex_file_ext_c_test.c",
327 ],
328 header_libs: ["libdexfile_external_headers"],
329}
330
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000331// Support library with a C++ API for accessing the libdexfile API for external
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000332// (non-ART) users.
333//
334// This library dlopens libdexfile_external on first use, so there is no build
335// time dependency on dex file logic. It is therefore safe to use from binaries
336// compiled without dex file support, given they won't encounter any dex file
337// stack frames.
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000338cc_library {
339 name: "libdexfile_support",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100340 visibility: ["//visibility:public"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000341 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000342 vendor_available: true,
343 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000344 srcs: [
345 "external/dex_file_supp.cc",
346 ],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000347 required: ["libdexfile_external"],
348 shared_libs: ["liblog"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000349 header_libs: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000350 export_header_lib_headers: ["libdexfile_external_headers"],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000351 target: {
352 recovery: {
353 cflags: ["-DNO_DEXFILE_SUPPORT"],
354 },
355 vendor: {
356 cflags: ["-DNO_DEXFILE_SUPPORT"],
357 },
358 },
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000359}
Martin Stjernholm750bf042019-01-09 22:51:12 +0000360
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000361// The same source file is used in two tests here, so unlike other ART gtests it
362// doesn't use test_per_src. Its test target is
363// test-art-{host,target}-gtest-art_libdexfile_support_tests.
Martin Stjernholm750bf042019-01-09 22:51:12 +0000364art_cc_test {
365 name: "art_libdexfile_support_tests",
Roland Levillain61f07162019-06-26 12:44:04 +0100366 defaults: [
367 "art_test_defaults",
368 ],
Martin Stjernholm750bf042019-01-09 22:51:12 +0000369 host_supported: true,
Martin Stjernholm750bf042019-01-09 22:51:12 +0000370 srcs: [
371 "external/dex_file_supp_test.cc",
372 ],
373 shared_libs: [
374 "libartbase",
375 "libbase",
376 "libdexfile_external",
377 "libdexfile_support",
378 ],
379}
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000380
Martin Stjernholm621afb42019-09-23 22:01:36 +0100381cc_defaults {
382 name: "libdexfile_support_static_defaults",
Martin Stjernholmd3ee98a2019-09-23 16:26:50 +0100383 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000384 srcs: [
385 "external/dex_file_supp.cc",
386 ],
387 cflags: ["-DSTATIC_LIB"],
388 // Using whole_static_libs here only as a "poor man's transitivity" kludge.
389 whole_static_libs: [
390 "libbase",
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000391 "liblog",
392 "libz",
393 "libziparchive",
394 ],
395 header_libs: ["libdexfile_external_headers"],
396 export_header_lib_headers: ["libdexfile_external_headers"],
397}
398
Martin Stjernholm621afb42019-09-23 22:01:36 +0100399cc_library_static {
400 name: "libdexfile_support_static",
401 visibility: [
402 "//art:__subpackages__",
403 // TODO(b/133140750): Clean this up.
404 "//system/core/debuggerd",
405 "//system/core/init", // Dependency from Android.mk file, so not enforced.
406 "//system/extras/simpleperf",
407 ],
408 defaults: [
409 "libdexfile_static_defaults",
410 "libdexfile_support_static_defaults",
411 ],
412 whole_static_libs: [
413 "libdexfile",
414 "libdexfile_external",
415 ],
416}
417
418cc_library_static {
419 name: "libdexfiled_support_static",
420 defaults: [
421 "libdexfile_support_static_defaults",
422 "libdexfiled_static_defaults",
423 ],
424 whole_static_libs: [
425 "libdexfiled",
426 "libdexfiled_external",
427 ],
428}
429
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000430// The same source file is used in two tests here, so unlike other ART gtests it
431// doesn't use test_per_src. Its test target is
432// test-art-{host,target}-gtest-art_libdexfile_support_static_tests.
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000433art_cc_test {
434 name: "art_libdexfile_support_static_tests",
435 host_supported: true,
436 srcs: [
437 "external/dex_file_supp_test.cc",
438 ],
439 static_libs: [
440 "libbase",
441 "libdexfile_support_static",
442 ],
443}