blob: f9375239e40f295f92afef22f5631a33c66fac6c [file] [log] [blame]
David Sehr67bf42e2018-02-26 16:43:04 -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 Sehrc431b9d2018-03-02 12:01:51 -080026cc_defaults {
27 name: "libartbase_defaults",
28 defaults: ["art_defaults"],
29 host_supported: true,
30 srcs: [
David Sehrc3e18952018-05-11 16:59:31 -070031 "arch/instruction_set.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080032 "base/allocator.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -070033 "base/arena_allocator.cc",
34 "base/arena_bit_vector.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080035 "base/bit_vector.cc",
Eric Holkc7ac91b2021-02-04 21:44:01 +000036 "base/compiler_filter.cc",
Andreas Gampe8764dc32019-01-07 15:20:12 -080037 "base/enums.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080038 "base/file_magic.cc",
David Sehrc3e18952018-05-11 16:59:31 -070039 "base/file_utils.cc",
Calin Juravle09eacd92021-05-19 17:03:55 -070040 "base/flags.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080041 "base/hex_dump.cc",
David Brazdildcfa89b2018-10-31 11:04:10 +000042 "base/hiddenapi_flags.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080043 "base/logging.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -070044 "base/malloc_arena_pool.cc",
Orion Hodson563ada22018-09-04 11:28:31 +010045 "base/membarrier.cc",
46 "base/memfd.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -070047 "base/memory_region.cc",
David Sehr79e26072018-04-06 17:58:50 -070048 "base/mem_map.cc",
Steve Austin882ed6b2018-06-08 11:40:38 -070049 // "base/mem_map_fuchsia.cc", put in target when fuchsia supported by soong
Eric Holk480d9812021-01-27 23:41:45 +000050 "base/metrics/metrics_common.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080051 "base/os_linux.cc",
52 "base/runtime_debug.cc",
53 "base/safe_copy.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -070054 "base/scoped_arena_allocator.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080055 "base/scoped_flock.cc",
Elliott Hughesc2efd4d2018-10-25 13:14:55 -070056 "base/socket_peer_is_trusted.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080057 "base/time_utils.cc",
58 "base/unix_file/fd_file.cc",
59 "base/unix_file/random_access_file_utils.cc",
60 "base/utils.cc",
David Sehr79e26072018-04-06 17:58:50 -070061 "base/zip_archive.cc",
David Sehrc431b9d2018-03-02 12:01:51 -080062 ],
David Sehr79e26072018-04-06 17:58:50 -070063 target: {
64 android: {
David Sehr10db8fe2018-07-18 11:01:20 -070065 srcs: [
Martin Stjernholmc3723142020-09-23 01:17:33 +010066 "base/globals_unix.cc",
David Sehr10db8fe2018-07-18 11:01:20 -070067 "base/mem_map_unix.cc",
68 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000069 static_libs: [
70 // ZipArchive support, the order matters here to get all symbols.
71 "libziparchive",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000072 ],
David Sehr10db8fe2018-07-18 11:01:20 -070073 shared_libs: [
Jiyong Parkb1c8e162020-05-18 19:04:42 +090074 "libz",
David Sehr10db8fe2018-07-18 11:01:20 -070075 "liblog",
76 // For ashmem.
Orion Hodson119733d2019-01-30 15:14:41 +000077 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070078 // For common macros.
79 "libbase",
80 ],
Martin Stjernholme407d972020-09-17 01:31:10 +010081 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
David Sehr79e26072018-04-06 17:58:50 -070082 },
David Sehr10db8fe2018-07-18 11:01:20 -070083 not_windows: {
84 srcs: [
Orion Hodsoncbe6d4a2019-05-09 10:29:52 +010085 "base/globals_unix.cc",
David Sehr10db8fe2018-07-18 11:01:20 -070086 "base/mem_map_unix.cc",
87 ],
Martin Stjernholma28438a2020-09-23 01:40:03 +010088 static: {
89 cflags: ["-DART_STATIC_LIBARTBASE"],
90 },
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +000091 shared_libs: [
92 "libziparchive",
93 "libz",
David Sehr10db8fe2018-07-18 11:01:20 -070094 "liblog",
95 // For ashmem.
Orion Hodson119733d2019-01-30 15:14:41 +000096 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -070097 // For common macros.
98 "libbase",
David Sehr79e26072018-04-06 17:58:50 -070099 ],
Martin Stjernholme407d972020-09-17 01:31:10 +0100100 export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
David Sehr79e26072018-04-06 17:58:50 -0700101 },
Martin Stjernholm43551622018-11-09 15:14:54 +0000102 windows: {
David Sehr9d9227a2018-12-19 12:32:50 -0800103 srcs: [
104 "base/mem_map_windows.cc",
105 ],
David Sehr10db8fe2018-07-18 11:01:20 -0700106 static_libs: [
107 "libziparchive",
108 "libz",
109 "liblog",
110 // For ashmem.
Orion Hodson119733d2019-01-30 15:14:41 +0000111 "libartpalette",
David Sehr10db8fe2018-07-18 11:01:20 -0700112 // For common macros.
113 "libbase",
114 ],
Martin Stjernholme407d972020-09-17 01:31:10 +0100115 export_static_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
116
David Sehr10db8fe2018-07-18 11:01:20 -0700117 cflags: ["-Wno-thread-safety"],
Martin Stjernholm43551622018-11-09 15:14:54 +0000118 },
David Srbeckyd53f6062019-03-22 14:55:21 +0000119 darwin: {
Andreas Gampe0dc93b12019-05-15 10:30:22 -0700120 enabled: true, // for libdexfile.
David Srbeckyd53f6062019-03-22 14:55:21 +0000121 },
David Sehr79e26072018-04-06 17:58:50 -0700122 },
David Sehrc431b9d2018-03-02 12:01:51 -0800123 generated_sources: ["art_libartbase_operator_srcs"],
Martin Stjernholm43551622018-11-09 15:14:54 +0000124
David Sehrc431b9d2018-03-02 12:01:51 -0800125 export_include_dirs: ["."],
David Sehrc431b9d2018-03-02 12:01:51 -0800126}
127
Andreas Gampeec5ed062018-01-26 16:20:02 -0800128cc_defaults {
129 name: "libartbase_static_base_defaults",
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100130 whole_static_libs: [
Andreas Gampeec5ed062018-01-26 16:20:02 -0800131 "libbase",
Orion Hodson119733d2019-01-30 15:14:41 +0000132 "libartpalette",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800133 "liblog",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000134 "libz",
135 "libziparchive",
Andreas Gampeec5ed062018-01-26 16:20:02 -0800136 ],
137}
138
139cc_defaults {
140 name: "libartbase_static_defaults",
141 defaults: ["libartbase_static_base_defaults"],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100142 whole_static_libs: ["libartbase"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800143}
144
145cc_defaults {
146 name: "libartbased_static_defaults",
147 defaults: ["libartbase_static_base_defaults"],
Martin Stjernholm35f765b2020-09-23 00:38:38 +0100148 whole_static_libs: ["libartbased"],
Andreas Gampeec5ed062018-01-26 16:20:02 -0800149}
150
David Sehrc431b9d2018-03-02 12:01:51 -0800151gensrcs {
152 name: "art_libartbase_operator_srcs",
153 cmd: "$(location generate_operator_out) art/libartbase $(in) > $(out)",
154 tools: ["generate_operator_out"],
155 srcs: [
David Sehrc3e18952018-05-11 16:59:31 -0700156 "arch/instruction_set.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800157 "base/allocator.h",
David Sehrc431b9d2018-03-02 12:01:51 -0800158 "base/unix_file/fd_file.h",
159 ],
160 output_extension: "operator_out.cc",
161}
162
163art_cc_library {
164 name: "libartbase",
Christopher Ferris0d38e852019-12-11 09:37:19 -0800165 defaults: [
166 "libartbase_defaults",
167 "libart_nativeunwind_defaults",
168 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100169 visibility: [
Martin Stjernholm4312f742021-03-23 00:30:57 +0000170 // TODO(b/183483755): Please visibility checks when the prebuilt
171 // libartbase is present but not preferred, and the prebuilt libdexfile
172 // hence depends on the source instead.
173 // TODO(b/172480617): Alternatively, clean up when we no longer need to
174 // support both prebuilts and sources present simultaneously.
175 "//prebuilts/module_sdk/art/current/host-exports",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100176 // TODO(b/133140750): Clean this up.
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100177 "//packages/modules/NetworkStack/tests:__subpackages__",
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100178 ],
Jiyong Park066dd9022019-12-19 02:11:59 +0000179 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100180 "com.android.art",
Jiyong Park066dd9022019-12-19 02:11:59 +0000181 "com.android.art.debug",
Jiyong Park066dd9022019-12-19 02:11:59 +0000182 ],
Martin Stjernholmb4abe0a2019-05-17 19:22:55 +0100183
David Sehr79e26072018-04-06 17:58:50 -0700184 shared_libs: [
185 "libbase",
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000186 "libziparchive",
David Sehr79e26072018-04-06 17:58:50 -0700187 ],
David Sehrc431b9d2018-03-02 12:01:51 -0800188 export_shared_lib_headers: ["libbase"],
David Sehr10db8fe2018-07-18 11:01:20 -0700189 target: {
190 windows: {
191 enabled: true,
192 shared: {
193 enabled: false,
194 },
195 },
196 },
Yi Kong1bad13f2021-12-29 14:16:59 +0800197 afdo: true,
David Sehrc431b9d2018-03-02 12:01:51 -0800198}
199
200art_cc_library {
201 name: "libartbased",
202 defaults: [
203 "art_debug_defaults",
204 "libartbase_defaults",
205 ],
Jiyong Park066dd9022019-12-19 02:11:59 +0000206 apex_available: [
207 "com.android.art.debug",
208 ],
Nicolas Geoffray65ed42a2018-10-30 12:33:04 +0000209 shared_libs: [
210 "libbase",
211 "libziparchive",
212 ],
213 export_shared_lib_headers: ["libbase"],
David Sehr10db8fe2018-07-18 11:01:20 -0700214 target: {
215 windows: {
216 enabled: true,
217 shared: {
218 enabled: false,
219 },
220 },
221 },
David Sehrc431b9d2018-03-02 12:01:51 -0800222}
223
Roland Levillainf0409142021-03-22 15:45:03 +0000224art_cc_defaults {
225 name: "libartbase-art-gtest-defaults",
David Sehrd5f8de82018-04-27 14:12:03 -0700226 srcs: [
227 "base/common_art_test.cc",
228 ],
229 shared_libs: [
David Sehrd5f8de82018-04-27 14:12:03 -0700230 "libbase",
231 "libbacktrace",
232 ],
233 header_libs: [
234 "libnativehelper_header_only",
235 ],
Alex Light55153102019-05-08 17:03:10 -0700236 static: {
Jiakai Zhang5514c8e2021-10-19 05:40:32 +0000237 whole_static_libs: [
238 "libc++fs",
Jiakai Zhang5514c8e2021-10-19 05:40:32 +0000239 ],
Alex Light55153102019-05-08 17:03:10 -0700240 },
241 shared: {
Jiakai Zhang5514c8e2021-10-19 05:40:32 +0000242 static_libs: [
243 "libc++fs",
Jiakai Zhang5514c8e2021-10-19 05:40:32 +0000244 ],
Alex Light55153102019-05-08 17:03:10 -0700245 },
David Sehrd5f8de82018-04-27 14:12:03 -0700246}
247
Roland Levillainf0409142021-03-22 15:45:03 +0000248art_cc_library {
249 name: "libartbase-art-gtest",
David Sehr67bf42e2018-02-26 16:43:04 -0800250 defaults: [
Roland Levillainf0409142021-03-22 15:45:03 +0000251 "libart-gtest-defaults",
252 "libartbase-art-gtest-defaults",
David Sehr67bf42e2018-02-26 16:43:04 -0800253 ],
Roland Levillainf0409142021-03-22 15:45:03 +0000254 shared_libs: [
255 "libartbase",
Jiakai Zhangd539f862022-02-08 14:56:05 +0000256 "libartbase-testing",
Roland Levillainf0409142021-03-22 15:45:03 +0000257 "libdexfile",
258 ],
259}
260
261art_cc_library {
262 name: "libartbased-art-gtest",
263 defaults: [
264 "libartd-gtest-defaults",
265 "libartbase-art-gtest-defaults",
266 ],
267 shared_libs: [
268 "libartbased",
Jiakai Zhangd539f862022-02-08 14:56:05 +0000269 "libartbased-testing",
Roland Levillainf0409142021-03-22 15:45:03 +0000270 "libdexfiled",
271 ],
272}
273
274art_cc_defaults {
Jiakai Zhangd539f862022-02-08 14:56:05 +0000275 name: "libartbase-testing-defaults",
276 defaults: [
277 "art_defaults",
278 ],
279 host_supported: true,
280 srcs: [
281 "base/testing.cc",
282 ],
283 shared_libs: [
284 "libbase",
285 ],
286 apex_available: [
287 "com.android.art.debug",
288 // TODO(b/183882457): This lib doesn't go into com.android.art, but
289 // apex_available lists need to be the same for internal libs to avoid
290 // stubs, and this depends on libdexfiled and others.
291 "com.android.art",
292 ],
293}
294
295art_cc_library {
296 name: "libartbase-testing",
297 defaults: [
298 "libartbase-testing-defaults",
299 ],
300 shared_libs: [
301 "libartbase",
302 ],
303}
304
305art_cc_library {
306 name: "libartbased-testing",
307 defaults: [
308 "libartbase-testing-defaults",
309 ],
310 shared_libs: [
311 "libartbased",
312 ],
313}
314
315art_cc_defaults {
Roland Levillainf0409142021-03-22 15:45:03 +0000316 name: "art_libartbase_tests_defaults",
Chih-Hung Hsieha0a5f002022-02-17 21:14:37 -0800317 tidy_timeout_srcs: [
318 "base/bit_utils_test.cc",
319 "base/intrusive_forward_list_test.cc",
320 ],
David Sehr67bf42e2018-02-26 16:43:04 -0800321 srcs: [
David Sehrc3e18952018-05-11 16:59:31 -0700322 "arch/instruction_set_test.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -0700323 "base/arena_allocator_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800324 "base/bit_field_test.cc",
David Srbecky68fefac2018-05-10 17:49:33 +0100325 "base/bit_memory_region_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800326 "base/bit_string_test.cc",
327 "base/bit_struct_test.cc",
David Srbecky052f8ca2018-04-26 15:42:54 +0100328 "base/bit_table_test.cc",
David Sehr67bf42e2018-02-26 16:43:04 -0800329 "base/bit_utils_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800330 "base/bit_vector_test.cc",
Eric Holkc7ac91b2021-02-04 21:44:01 +0000331 "base/compiler_filter_test.cc",
David Sehrc3e18952018-05-11 16:59:31 -0700332 "base/file_utils_test.cc",
Calin Juravle09eacd92021-05-19 17:03:55 -0700333 "base/flags_test.cc",
Vladimir Marko33247ee2020-07-03 13:31:56 +0100334 "base/hash_map_test.cc",
David Sehr67bf42e2018-02-26 16:43:04 -0800335 "base/hash_set_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800336 "base/hex_dump_test.cc",
337 "base/histogram_test.cc",
David Sehr9c4a0152018-04-05 12:23:54 -0700338 "base/indenter_test.cc",
Vladimir Marko3fae1292019-06-07 11:26:25 +0100339 "base/intrusive_forward_list_test.cc",
David Sehr67bf42e2018-02-26 16:43:04 -0800340 "base/leb128_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800341 "base/logging_test.cc",
Orion Hodson563ada22018-09-04 11:28:31 +0100342 "base/memfd_test.cc",
343 "base/membarrier_test.cc",
David Sehr1ce2b3b2018-04-05 11:02:03 -0700344 "base/memory_region_test.cc",
David Sehr79e26072018-04-06 17:58:50 -0700345 "base/mem_map_test.cc",
Eric Holk480d9812021-01-27 23:41:45 +0000346 "base/metrics/metrics_test.cc",
David Sehrc431b9d2018-03-02 12:01:51 -0800347 "base/safe_copy_test.cc",
348 "base/scoped_flock_test.cc",
349 "base/time_utils_test.cc",
350 "base/transform_array_ref_test.cc",
351 "base/transform_iterator_test.cc",
352 "base/unix_file/fd_file_test.cc",
353 "base/utils_test.cc",
354 "base/variant_map_test.cc",
David Sehr79e26072018-04-06 17:58:50 -0700355 "base/zip_archive_test.cc",
David Sehr67bf42e2018-02-26 16:43:04 -0800356 ],
357 shared_libs: [
358 "libbase",
359 ],
Roland Levillainf0409142021-03-22 15:45:03 +0000360 static_libs: [
361 "libgmock",
362 ],
363}
364
365// Version of ART gtest `art_libartbase_tests` bundled with the ART APEX on target.
366// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
367art_cc_test {
368 name: "art_libartbase_tests",
369 defaults: [
370 "art_gtest_defaults",
371 "art_libartbase_tests_defaults",
372 ],
373}
374
375// Standalone version of ART gtest `art_libartbase_tests`, not bundled with the ART APEX on target.
376art_cc_test {
377 name: "art_standalone_libartbase_tests",
378 defaults: [
379 "art_standalone_gtest_defaults",
380 "art_libartbase_tests_defaults",
381 ],
Jiakai Zhangd539f862022-02-08 14:56:05 +0000382 data: [":generate-boot-image"],
383 test_config_template: ":art-gtests-target-standalone-with-boot-image-template",
David Sehr67bf42e2018-02-26 16:43:04 -0800384}
385
386cc_library_headers {
387 name: "art_libartbase_headers",
Martin Stjernholme10abe72021-10-28 03:49:55 +0100388 defaults: ["art_defaults"],
David Sehr67bf42e2018-02-26 16:43:04 -0800389 host_supported: true,
390 export_include_dirs: ["."],
391 shared_libs: ["libbase"],
392 export_shared_lib_headers: ["libbase"],
Jiyong Park71f661c2020-04-28 18:20:43 +0900393
394 apex_available: [
Martin Stjernholm3e9abfc2020-10-09 22:17:51 +0100395 "com.android.art",
Jiyong Park71f661c2020-04-28 18:20:43 +0900396 "com.android.art.debug",
Jiyong Park71f661c2020-04-28 18:20:43 +0900397 ],
David Sehr67bf42e2018-02-26 16:43:04 -0800398}