• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1//
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
17package {
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
26cc_defaults {
27    name: "libartbase_defaults",
28    defaults: ["art_defaults"],
29    host_supported: true,
30    srcs: [
31        "arch/instruction_set.cc",
32        "base/allocator.cc",
33        "base/arena_allocator.cc",
34        "base/arena_bit_vector.cc",
35        "base/bit_vector.cc",
36        "base/compiler_filter.cc",
37        "base/enums.cc",
38        "base/file_magic.cc",
39        "base/file_utils.cc",
40        "base/flags.cc",
41        "base/hex_dump.cc",
42        "base/logging.cc",
43        "base/malloc_arena_pool.cc",
44        "base/membarrier.cc",
45        "base/memfd.cc",
46        "base/memory_region.cc",
47        "base/mem_map.cc",
48        // "base/mem_map_fuchsia.cc", put in target when fuchsia supported by soong
49        "base/metrics/metrics_common.cc",
50        "base/os_linux.cc",
51        "base/runtime_debug.cc",
52        "base/safe_copy.cc",
53        "base/scoped_arena_allocator.cc",
54        "base/scoped_flock.cc",
55        "base/socket_peer_is_trusted.cc",
56        "base/time_utils.cc",
57        "base/unix_file/fd_file.cc",
58        "base/unix_file/random_access_file_utils.cc",
59        "base/utils.cc",
60        "base/zip_archive.cc",
61    ],
62    target: {
63        android: {
64            srcs: [
65                "base/globals_unix.cc",
66                "base/mem_map_unix.cc",
67            ],
68            static: {
69                cflags: ["-DART_STATIC_LIBARTBASE"],
70            },
71            static_libs: [
72                "libcap",
73                "libmodules-utils-build",
74                // ZipArchive support, the order matters here to get all symbols.
75                "libziparchive",
76            ],
77            whole_static_libs: ["libtinyxml2"],
78            shared_libs: [
79                "libz",
80                "liblog",
81                // For ashmem.
82                "libartpalette",
83                // For common macros.
84                "libbase",
85            ],
86            export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
87            export_static_lib_headers: [
88                "libcap",
89            ],
90        },
91        not_windows: {
92            srcs: [
93                "base/globals_unix.cc",
94                "base/mem_map_unix.cc",
95            ],
96            static: {
97                cflags: ["-DART_STATIC_LIBARTBASE"],
98            },
99            whole_static_libs: ["libtinyxml2"],
100            shared_libs: [
101                "libziparchive",
102                "libz",
103                "liblog",
104                // For ashmem.
105                "libartpalette",
106                // For common macros.
107                "libbase",
108            ],
109            export_shared_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
110        },
111        linux_glibc: {
112            static_libs: [
113                "libcap",
114            ],
115            export_static_lib_headers: [
116                "libcap",
117            ],
118        },
119        windows: {
120            srcs: [
121                "base/mem_map_windows.cc",
122            ],
123            static_libs: [
124                "libziparchive",
125                "libz",
126                "liblog",
127                // For ashmem.
128                "libartpalette",
129                // For common macros.
130                "libbase",
131            ],
132            whole_static_libs: ["libtinyxml2"],
133            export_static_lib_headers: ["libbase"], // ART's macros.h depends on libbase's macros.h.
134
135            cflags: ["-Wno-thread-safety"],
136        },
137        darwin: {
138            enabled: true, // for libdexfile.
139        },
140    },
141    generated_sources: ["art_libartbase_operator_srcs"],
142
143    export_include_dirs: ["."],
144}
145
146cc_defaults {
147    name: "libartbase_static_base_defaults",
148    whole_static_libs: [
149        "libbase",
150        "libartpalette",
151        "liblog",
152        "libz",
153        "libziparchive",
154    ],
155    target: {
156        android: {
157            whole_static_libs: [
158                "libcap",
159            ],
160        },
161        linux_glibc: {
162            whole_static_libs: [
163                "libcap",
164            ],
165        },
166    },
167}
168
169cc_defaults {
170    name: "libartbase_static_defaults",
171    defaults: ["libartbase_static_base_defaults"],
172    whole_static_libs: ["libartbase"],
173}
174
175cc_defaults {
176    name: "libartbased_static_defaults",
177    defaults: ["libartbase_static_base_defaults"],
178    whole_static_libs: ["libartbased"],
179}
180
181gensrcs {
182    name: "art_libartbase_operator_srcs",
183    cmd: "$(location generate_operator_out) art/libartbase $(in) > $(out)",
184    tools: ["generate_operator_out"],
185    srcs: [
186        "arch/instruction_set.h",
187        "base/allocator.h",
188        "base/unix_file/fd_file.h",
189    ],
190    output_extension: "operator_out.cc",
191}
192
193art_cc_library {
194    name: "libartbase",
195    defaults: [
196        "libartbase_defaults",
197        "libart_nativeunwind_defaults",
198    ],
199    visibility: [
200        // TODO(b/183483755): Please visibility checks when the prebuilt
201        // libartbase is present but not preferred, and the prebuilt libdexfile
202        // hence depends on the source instead.
203        // TODO(b/172480617): Alternatively, clean up when we no longer need to
204        // support both prebuilts and sources present simultaneously.
205        "//prebuilts/module_sdk/art/current/host-exports",
206        // TODO(b/133140750): Clean this up.
207        "//packages/modules/NetworkStack/tests:__subpackages__",
208    ],
209    apex_available: [
210        "com.android.art",
211        "com.android.art.debug",
212    ],
213
214    target: {
215        windows: {
216            // Control the enabled property here rather than in
217            // libartbase_defaults, to ensure it overrides properties inherited
218            // from other defaults.
219            enabled: true,
220            shared: {
221                enabled: false,
222            },
223        },
224    },
225    afdo: true,
226}
227
228art_cc_library {
229    name: "libartbased",
230    defaults: [
231        "art_debug_defaults",
232        "libartbase_defaults",
233    ],
234    apex_available: [
235        "com.android.art.debug",
236    ],
237
238    target: {
239        windows: {
240            // Control the enabled property here rather than in
241            // libartbase_defaults, to ensure it overrides properties inherited
242            // from other defaults, in particular any inherited via
243            // art_debug_defaults.
244            enabled: true,
245            shared: {
246                enabled: false,
247            },
248        },
249    },
250}
251
252art_cc_defaults {
253    name: "libartbase-art-gtest-defaults",
254    srcs: [
255        "base/common_art_test.cc",
256    ],
257    shared_libs: [
258        "libbase",
259        "libunwindstack",
260    ],
261    header_libs: [
262        "libnativehelper_header_only",
263    ],
264    static: {
265        whole_static_libs: [
266            "libc++fs",
267            "libcap",
268        ],
269    },
270    shared: {
271        static_libs: [
272            "libc++fs",
273            "libcap",
274        ],
275    },
276}
277
278art_cc_library {
279    name: "libartbase-art-gtest",
280    defaults: [
281        "libart-gtest-defaults",
282        "libartbase-art-gtest-defaults",
283    ],
284    shared_libs: [
285        "libartbase",
286        "libartbase-testing",
287        "libdexfile",
288    ],
289}
290
291art_cc_library {
292    name: "libartbased-art-gtest",
293    defaults: [
294        "libartd-gtest-defaults",
295        "libartbase-art-gtest-defaults",
296    ],
297    shared_libs: [
298        "libartbased",
299        "libartbased-testing",
300        "libdexfiled",
301    ],
302}
303
304art_cc_defaults {
305    name: "libartbase-testing-defaults",
306    defaults: [
307        "art_defaults",
308    ],
309    host_supported: true,
310    srcs: [
311        "base/testing.cc",
312    ],
313    shared_libs: [
314        "libbase",
315    ],
316    apex_available: [
317        "com.android.art.debug",
318        // TODO(b/183882457): This lib doesn't go into com.android.art, but
319        // apex_available lists need to be the same for internal libs to avoid
320        // stubs, and this depends on libdexfiled and others.
321        "com.android.art",
322    ],
323}
324
325art_cc_library {
326    name: "libartbase-testing",
327    defaults: [
328        "libartbase-testing-defaults",
329    ],
330    shared_libs: [
331        "libartbase",
332    ],
333}
334
335art_cc_library {
336    name: "libartbased-testing",
337    defaults: [
338        "libartbase-testing-defaults",
339    ],
340    shared_libs: [
341        "libartbased",
342    ],
343}
344
345art_cc_defaults {
346    name: "art_libartbase_tests_defaults",
347    tidy_timeout_srcs: [
348        "base/bit_utils_test.cc",
349        "base/intrusive_forward_list_test.cc",
350    ],
351    srcs: [
352        "arch/instruction_set_test.cc",
353        "base/arena_allocator_test.cc",
354        "base/bit_field_test.cc",
355        "base/bit_memory_region_test.cc",
356        "base/bit_string_test.cc",
357        "base/bit_struct_test.cc",
358        "base/bit_table_test.cc",
359        "base/bit_utils_test.cc",
360        "base/bit_vector_test.cc",
361        "base/compiler_filter_test.cc",
362        "base/file_utils_test.cc",
363        "base/flags_test.cc",
364        "base/hash_map_test.cc",
365        "base/hash_set_test.cc",
366        "base/hex_dump_test.cc",
367        "base/histogram_test.cc",
368        "base/indenter_test.cc",
369        "base/intrusive_forward_list_test.cc",
370        "base/leb128_test.cc",
371        "base/logging_test.cc",
372        "base/memfd_test.cc",
373        "base/membarrier_test.cc",
374        "base/memory_region_test.cc",
375        "base/mem_map_test.cc",
376        "base/metrics/metrics_test.cc",
377        "base/safe_copy_test.cc",
378        "base/scoped_flock_test.cc",
379        "base/time_utils_test.cc",
380        "base/transform_array_ref_test.cc",
381        "base/transform_iterator_test.cc",
382        "base/unix_file/fd_file_test.cc",
383        "base/utils_test.cc",
384        "base/variant_map_test.cc",
385        "base/zip_archive_test.cc",
386    ],
387    shared_libs: [
388        "libbase",
389    ],
390    static_libs: [
391        "libgmock",
392    ],
393}
394
395// Version of ART gtest `art_libartbase_tests` bundled with the ART APEX on target.
396// TODO(b/192274705): Remove this module when the migration to standalone ART gtests is complete.
397art_cc_test {
398    name: "art_libartbase_tests",
399    defaults: [
400        "art_gtest_defaults",
401        "art_libartbase_tests_defaults",
402    ],
403}
404
405// Standalone version of ART gtest `art_libartbase_tests`, not bundled with the ART APEX on target.
406art_cc_test {
407    name: "art_standalone_libartbase_tests",
408    defaults: [
409        "art_standalone_gtest_defaults",
410        "art_libartbase_tests_defaults",
411    ],
412    data: [":generate-boot-image"],
413    test_config_template: ":art-gtests-target-standalone-with-boot-image-template",
414}
415
416cc_library_headers {
417    name: "art_libartbase_headers",
418    defaults: ["art_defaults"],
419    host_supported: true,
420    export_include_dirs: ["."],
421    shared_libs: ["libbase"],
422    export_shared_lib_headers: ["libbase"],
423
424    whole_static_libs: ["libtinyxml2"],
425
426    apex_available: [
427        "com.android.art",
428        "com.android.art.debug",
429    ],
430}
431