blob: 2c4c3d855cdc3bcb0afbc9fa3bddabbc7cfa654f [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: [
48 // For MemMap.
Orion Hodson119733d2019-01-30 15:14:41 +000049 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070050 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070051 // For common macros.
52 "libbase",
53 ],
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",
David Sehr10db8fe2018-07-18 11:01:20 -070062 // For MemMap.
Orion Hodson119733d2019-01-30 15:14:41 +000063 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070064 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070065 // 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",
76 // For MemMap.
Orion Hodson119733d2019-01-30 15:14:41 +000077 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070078 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070079 // For common macros.
80 "libbase",
81 ],
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 ],
111 static_libs: ["libdexfile"],
112}
113
114cc_defaults {
115 name: "libdexfiled_static_defaults",
116 defaults: [
117 "libartbased_static_defaults",
118 "libdexfile_static_base_defaults",
119 ],
120 static_libs: ["libdexfiled"],
121}
122
David Sehr334b9d72018-02-12 18:27:56 -0800123gensrcs {
124 name: "dexfile_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -0800125 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)",
126 tools: ["generate_operator_out"],
David Sehr334b9d72018-02-12 18:27:56 -0800127 srcs: [
128 "dex/dex_file.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800129 "dex/dex_file_layout.h",
David Sehr334b9d72018-02-12 18:27:56 -0800130 "dex/dex_instruction.h",
131 "dex/dex_instruction_utils.h",
132 "dex/invoke_type.h",
David Sehr312f3b22018-03-19 08:39:26 -0700133 "dex/method_reference.h",
David Sehr334b9d72018-02-12 18:27:56 -0800134 ],
135 output_extension: "operator_out.cc",
136}
137
David Sehr334b9d72018-02-12 18:27:56 -0800138art_cc_library {
139 name: "libdexfile",
140 defaults: ["libdexfile_defaults"],
141 // Leave the symbols in the shared library so that stack unwinders can
142 // produce meaningful name resolution.
143 strip: {
144 keep_symbols: true,
145 },
David Sehr10db8fe2018-07-18 11:01:20 -0700146 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100147 android: {
148 shared_libs: [
149 "libartbase",
150 ],
151 export_shared_lib_headers: [
152 "libartbase",
153 ],
154 },
155 not_windows: {
156 shared_libs: [
157 "libartbase",
158 ],
159 export_shared_lib_headers: [
160 "libartbase",
161 ],
162 },
David Sehr10db8fe2018-07-18 11:01:20 -0700163 windows: {
164 enabled: true,
165 shared: {
166 enabled: false,
167 },
David Srbecky7711c352019-04-10 17:50:12 +0100168 static_libs: [
169 "libartbase",
170 ],
171 export_static_lib_headers: [
172 "libartbase",
173 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700174 },
175 },
David Sehr334b9d72018-02-12 18:27:56 -0800176}
177
David Sehrfcbe15c2018-02-15 09:41:13 -0800178art_cc_library {
179 name: "libdexfiled",
180 defaults: [
181 "art_debug_defaults",
182 "libdexfile_defaults",
183 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700184 target: {
David Srbecky7711c352019-04-10 17:50:12 +0100185 android: {
186 shared_libs: [
187 "libartbased",
188 ],
189 export_shared_lib_headers: [
190 "libartbased",
191 ],
192 },
193 not_windows: {
194 shared_libs: [
195 "libartbased",
196 ],
197 export_shared_lib_headers: [
198 "libartbased",
199 ],
200 },
David Sehr10db8fe2018-07-18 11:01:20 -0700201 windows: {
202 enabled: true,
203 shared: {
204 enabled: false,
205 },
David Srbecky7711c352019-04-10 17:50:12 +0100206 static_libs: [
207 "libartbased",
208 ],
209 export_static_lib_headers: [
210 "libartbased",
211 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700212 },
213 },
David Sehrfcbe15c2018-02-15 09:41:13 -0800214}
215
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000216art_cc_test {
217 name: "art_libdexfile_tests",
218 defaults: [
219 "art_gtest_defaults",
220 ],
221 srcs: [
222 "dex/art_dex_file_loader_test.cc",
223 "dex/class_accessor_test.cc",
224 "dex/code_item_accessors_test.cc",
225 "dex/compact_dex_file_test.cc",
226 "dex/compact_offset_table_test.cc",
227 "dex/descriptors_names_test.cc",
228 "dex/test_dex_file_builder_test.cc",
229 "dex/dex_file_loader_test.cc",
230 "dex/dex_file_verifier_test.cc",
231 "dex/dex_instruction_test.cc",
232 "dex/primitive_test.cc",
233 "dex/string_reference_test.cc",
234 "dex/type_lookup_table_test.cc",
235 "dex/utf_test.cc",
236 ],
237 shared_libs: [
238 "libbacktrace",
239 "libziparchive",
240 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000241}
242
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000243cc_library_headers {
244 name: "libdexfile_external_headers",
245 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000246 vendor_available: true,
247 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000248 header_libs: ["libbase_headers"],
249 export_header_lib_headers: ["libbase_headers"],
250 export_include_dirs: ["external/include"],
251
252 target: {
253 windows: {
254 enabled: true,
255 },
256 },
257}
258
David Srbecky7711c352019-04-10 17:50:12 +0100259cc_defaults {
260 name: "libdexfile_external-defaults",
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000261 host_supported: true,
262 srcs: [
263 "external/dex_file_ext.cc",
264 ],
265 header_libs: ["libdexfile_external_headers"],
266 shared_libs: [
267 "libbase",
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000268 ],
Martin Stjernholm84bf6982019-02-05 15:07:57 +0000269 stubs: {
270 symbol_file: "external/libdexfile_external.map.txt",
271 versions: ["1"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000272 },
273}
274
David Srbecky7711c352019-04-10 17:50:12 +0100275cc_library {
276 name: "libdexfile_external",
277 defaults: [
278 "art_defaults",
279 "libdexfile_external-defaults",
280 ],
David Srbecky52fc7ab2019-05-03 11:03:52 +0100281 target: {
282 darwin: {
283 enabled: true,
284 },
285 },
David Srbecky7711c352019-04-10 17:50:12 +0100286 shared_libs: [
287 "libdexfile",
288 ],
289}
290
291cc_library {
292 name: "libdexfiled_external",
293 defaults: [
294 "art_debug_defaults",
295 "libdexfile_external-defaults",
296 ],
David Srbecky52fc7ab2019-05-03 11:03:52 +0100297 target: {
298 darwin: {
299 enabled: true,
300 },
301 },
David Srbecky7711c352019-04-10 17:50:12 +0100302 shared_libs: [
303 "libdexfiled",
304 ],
305}
306
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000307art_cc_test {
308 name: "art_libdexfile_external_tests",
309 host_supported: true,
310 test_per_src: true, // For consistency with other ART gtests.
311 srcs: [
312 "external/dex_file_ext_c_test.c",
313 ],
314 header_libs: ["libdexfile_external_headers"],
315}
316
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000317// Support library with a C++ API for accessing the libdexfile API for external
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000318// (non-ART) users.
319//
320// This library dlopens libdexfile_external on first use, so there is no build
321// time dependency on dex file logic. It is therefore safe to use from binaries
322// compiled without dex file support, given they won't encounter any dex file
323// stack frames.
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000324cc_library {
325 name: "libdexfile_support",
326 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000327 vendor_available: true,
328 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000329 srcs: [
330 "external/dex_file_supp.cc",
331 ],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000332 required: ["libdexfile_external"],
333 shared_libs: ["liblog"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000334 header_libs: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000335 export_header_lib_headers: ["libdexfile_external_headers"],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000336 target: {
337 recovery: {
338 cflags: ["-DNO_DEXFILE_SUPPORT"],
339 },
340 vendor: {
341 cflags: ["-DNO_DEXFILE_SUPPORT"],
342 },
343 },
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000344}
Martin Stjernholm750bf042019-01-09 22:51:12 +0000345
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000346// The same source file is used in two tests here, so unlike other ART gtests it
347// doesn't use test_per_src. Its test target is
348// test-art-{host,target}-gtest-art_libdexfile_support_tests.
Martin Stjernholm750bf042019-01-09 22:51:12 +0000349art_cc_test {
350 name: "art_libdexfile_support_tests",
351 host_supported: true,
Martin Stjernholm750bf042019-01-09 22:51:12 +0000352 srcs: [
353 "external/dex_file_supp_test.cc",
354 ],
355 shared_libs: [
356 "libartbase",
357 "libbase",
358 "libdexfile_external",
359 "libdexfile_support",
360 ],
361}
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000362
363cc_library_static {
364 name: "libdexfile_support_static",
365 host_supported: true,
366 defaults: ["libdexfile_static_defaults"],
367 srcs: [
368 "external/dex_file_supp.cc",
369 ],
370 cflags: ["-DSTATIC_LIB"],
371 // Using whole_static_libs here only as a "poor man's transitivity" kludge.
372 whole_static_libs: [
373 "libbase",
374 "libdexfile",
375 "libdexfile_external",
376 "liblog",
377 "libz",
378 "libziparchive",
379 ],
380 header_libs: ["libdexfile_external_headers"],
381 export_header_lib_headers: ["libdexfile_external_headers"],
382}
383
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000384// The same source file is used in two tests here, so unlike other ART gtests it
385// doesn't use test_per_src. Its test target is
386// test-art-{host,target}-gtest-art_libdexfile_support_static_tests.
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000387art_cc_test {
388 name: "art_libdexfile_support_static_tests",
389 host_supported: true,
390 srcs: [
391 "external/dex_file_supp_test.cc",
392 ],
393 static_libs: [
394 "libbase",
395 "libdexfile_support_static",
396 ],
397}