blob: 8e131d395b90682867a93be0b54263c4598914c5 [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.
49 "libartbase",
Orion Hodson119733d2019-01-30 15:14:41 +000050 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070051 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070052 // For common macros.
53 "libbase",
54 ],
55 export_shared_lib_headers: [
56 "libartbase",
57 "libbase",
58 ],
David Sehr334b9d72018-02-12 18:27:56 -080059 },
David Sehr10db8fe2018-07-18 11:01:20 -070060 not_windows: {
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000061 shared_libs: [
62 "libziparchive",
63 "libz",
David Sehr10db8fe2018-07-18 11:01:20 -070064 // For MemMap.
65 "libartbase",
Orion Hodson119733d2019-01-30 15:14:41 +000066 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070067 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070068 // For common macros.
69 "libbase",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000070 ],
David Sehr10db8fe2018-07-18 11:01:20 -070071 export_shared_lib_headers: [
72 "libartbase",
73 "libbase",
74 ],
75 },
76 windows: {
77 static_libs: [
78 "libziparchive",
79 "libz",
80 // For MemMap.
81 "libartbase",
Orion Hodson119733d2019-01-30 15:14:41 +000082 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070083 "liblog",
David Sehr10db8fe2018-07-18 11:01:20 -070084 // For common macros.
85 "libbase",
86 ],
87 export_static_lib_headers: [
88 "libartbase",
89 "libbase",
90 ],
91 cflags: ["-Wno-thread-safety"],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000092 },
David Srbeckyd53f6062019-03-22 14:55:21 +000093 darwin: {
94 enabled: true,
95 },
David Sehr334b9d72018-02-12 18:27:56 -080096 },
97 generated_sources: ["dexfile_operator_srcs"],
David Sehr334b9d72018-02-12 18:27:56 -080098 export_include_dirs: ["."],
David Sehr334b9d72018-02-12 18:27:56 -080099}
100
Andreas Gampeec5ed062018-01-26 16:20:02 -0800101cc_defaults {
102 name: "libdexfile_static_base_defaults",
103 static_libs: [
104 "libbase",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800105 "liblog",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000106 "libz",
107 "libziparchive",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800108 ],
109}
110
111cc_defaults {
112 name: "libdexfile_static_defaults",
113 defaults: [
114 "libartbase_static_defaults",
115 "libdexfile_static_base_defaults",
116 ],
117 static_libs: ["libdexfile"],
118}
119
120cc_defaults {
121 name: "libdexfiled_static_defaults",
122 defaults: [
123 "libartbased_static_defaults",
124 "libdexfile_static_base_defaults",
125 ],
126 static_libs: ["libdexfiled"],
127}
128
David Sehr334b9d72018-02-12 18:27:56 -0800129gensrcs {
130 name: "dexfile_operator_srcs",
Alex Lightb69d2d32018-02-21 13:37:17 -0800131 cmd: "$(location generate_operator_out) art/libdexfile $(in) > $(out)",
132 tools: ["generate_operator_out"],
David Sehr334b9d72018-02-12 18:27:56 -0800133 srcs: [
134 "dex/dex_file.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800135 "dex/dex_file_layout.h",
David Sehr334b9d72018-02-12 18:27:56 -0800136 "dex/dex_instruction.h",
137 "dex/dex_instruction_utils.h",
138 "dex/invoke_type.h",
David Sehr312f3b22018-03-19 08:39:26 -0700139 "dex/method_reference.h",
David Sehr334b9d72018-02-12 18:27:56 -0800140 ],
141 output_extension: "operator_out.cc",
142}
143
David Sehr334b9d72018-02-12 18:27:56 -0800144art_cc_library {
145 name: "libdexfile",
146 defaults: ["libdexfile_defaults"],
147 // Leave the symbols in the shared library so that stack unwinders can
148 // produce meaningful name resolution.
149 strip: {
150 keep_symbols: true,
151 },
David Sehr10db8fe2018-07-18 11:01:20 -0700152 target: {
153 windows: {
154 enabled: true,
155 shared: {
156 enabled: false,
157 },
158 },
159 },
David Sehr334b9d72018-02-12 18:27:56 -0800160}
161
David Sehrfcbe15c2018-02-15 09:41:13 -0800162art_cc_library {
163 name: "libdexfiled",
164 defaults: [
165 "art_debug_defaults",
166 "libdexfile_defaults",
167 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700168 target: {
169 windows: {
170 enabled: true,
171 shared: {
172 enabled: false,
173 },
174 },
175 },
David Sehrfcbe15c2018-02-15 09:41:13 -0800176}
177
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000178art_cc_test {
179 name: "art_libdexfile_tests",
180 defaults: [
181 "art_gtest_defaults",
182 ],
183 srcs: [
184 "dex/art_dex_file_loader_test.cc",
185 "dex/class_accessor_test.cc",
186 "dex/code_item_accessors_test.cc",
187 "dex/compact_dex_file_test.cc",
188 "dex/compact_offset_table_test.cc",
189 "dex/descriptors_names_test.cc",
190 "dex/test_dex_file_builder_test.cc",
191 "dex/dex_file_loader_test.cc",
192 "dex/dex_file_verifier_test.cc",
193 "dex/dex_instruction_test.cc",
194 "dex/primitive_test.cc",
195 "dex/string_reference_test.cc",
196 "dex/type_lookup_table_test.cc",
197 "dex/utf_test.cc",
198 ],
199 shared_libs: [
200 "libbacktrace",
201 "libziparchive",
202 ],
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000203}
204
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000205cc_library_headers {
206 name: "libdexfile_external_headers",
207 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000208 vendor_available: true,
209 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000210 header_libs: ["libbase_headers"],
211 export_header_lib_headers: ["libbase_headers"],
212 export_include_dirs: ["external/include"],
213
214 target: {
215 windows: {
216 enabled: true,
217 },
218 },
219}
220
221cc_library {
222 name: "libdexfile_external",
223 host_supported: true,
224 srcs: [
225 "external/dex_file_ext.cc",
226 ],
227 header_libs: ["libdexfile_external_headers"],
228 shared_libs: [
229 "libbase",
230 "libdexfile",
231 ],
232
Martin Stjernholm84bf6982019-02-05 15:07:57 +0000233 stubs: {
234 symbol_file: "external/libdexfile_external.map.txt",
235 versions: ["1"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000236 },
237}
238
Martin Stjernholmfdb2f602019-01-09 14:47:00 +0000239art_cc_test {
240 name: "art_libdexfile_external_tests",
241 host_supported: true,
242 test_per_src: true, // For consistency with other ART gtests.
243 srcs: [
244 "external/dex_file_ext_c_test.c",
245 ],
246 header_libs: ["libdexfile_external_headers"],
247}
248
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000249// Support library with a C++ API for accessing the libdexfile API for external
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000250// (non-ART) users.
251//
252// This library dlopens libdexfile_external on first use, so there is no build
253// time dependency on dex file logic. It is therefore safe to use from binaries
254// compiled without dex file support, given they won't encounter any dex file
255// stack frames.
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000256cc_library {
257 name: "libdexfile_support",
258 host_supported: true,
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000259 vendor_available: true,
260 recovery_available: true,
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000261 srcs: [
262 "external/dex_file_supp.cc",
263 ],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000264 required: ["libdexfile_external"],
265 shared_libs: ["liblog"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000266 header_libs: ["libdexfile_external_headers"],
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000267 export_header_lib_headers: ["libdexfile_external_headers"],
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000268 target: {
269 recovery: {
270 cflags: ["-DNO_DEXFILE_SUPPORT"],
271 },
272 vendor: {
273 cflags: ["-DNO_DEXFILE_SUPPORT"],
274 },
275 },
Martin Stjernholmb3d2e832018-11-15 18:09:35 +0000276}
Martin Stjernholm750bf042019-01-09 22:51:12 +0000277
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000278// The same source file is used in two tests here, so unlike other ART gtests it
279// doesn't use test_per_src. Its test target is
280// test-art-{host,target}-gtest-art_libdexfile_support_tests.
Martin Stjernholm750bf042019-01-09 22:51:12 +0000281art_cc_test {
282 name: "art_libdexfile_support_tests",
283 host_supported: true,
Martin Stjernholm750bf042019-01-09 22:51:12 +0000284 srcs: [
285 "external/dex_file_supp_test.cc",
286 ],
287 shared_libs: [
288 "libartbase",
289 "libbase",
290 "libdexfile_external",
291 "libdexfile_support",
292 ],
293}
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000294
295cc_library_static {
296 name: "libdexfile_support_static",
297 host_supported: true,
298 defaults: ["libdexfile_static_defaults"],
299 srcs: [
300 "external/dex_file_supp.cc",
301 ],
302 cflags: ["-DSTATIC_LIB"],
303 // Using whole_static_libs here only as a "poor man's transitivity" kludge.
304 whole_static_libs: [
305 "libbase",
306 "libdexfile",
307 "libdexfile_external",
308 "liblog",
309 "libz",
310 "libziparchive",
311 ],
312 header_libs: ["libdexfile_external_headers"],
313 export_header_lib_headers: ["libdexfile_external_headers"],
314}
315
Martin Stjernholm70ae00d2019-02-15 22:41:14 +0000316// The same source file is used in two tests here, so unlike other ART gtests it
317// doesn't use test_per_src. Its test target is
318// test-art-{host,target}-gtest-art_libdexfile_support_static_tests.
Martin Stjernholmfe94b1c2019-01-31 17:40:39 +0000319art_cc_test {
320 name: "art_libdexfile_support_static_tests",
321 host_supported: true,
322 srcs: [
323 "external/dex_file_supp_test.cc",
324 ],
325 static_libs: [
326 "libbase",
327 "libdexfile_support_static",
328 ],
329}