xref: /aosp_15_r20/art/artd/Android.bp (revision 795d594fd825385562da6b089ea9b2033f3abf5a)
1//
2// Copyright (C) 2021 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
16package {
17    // See: http://go/android-license-faq
18    // A large-scale-change added 'default_applicable_licenses' to import
19    // all of the 'license_kinds' from "art_license"
20    // to get the below license kinds:
21    //   SPDX-license-identifier-Apache-2.0
22    default_applicable_licenses: ["art_license"],
23    default_team: "trendy_team_art_mainline",
24}
25
26cc_defaults {
27    name: "artd_defaults",
28    defaults: ["art_defaults"],
29    srcs: [
30        "artd.cc",
31        "file_utils.cc",
32        "path_utils.cc",
33    ],
34    header_libs: [
35        "art_cmdlineparser_headers",
36        "libarttools_binder_utils",
37        "odrefresh_headers_art",
38        "profman_headers",
39    ],
40    shared_libs: [
41        "libbinder_ndk",
42        "libselinux",
43    ],
44    static_libs: [
45        "artd-aidl-ndk",
46        "libfstab",
47    ],
48    target: {
49        android: {
50            compile_multilib: "first",
51        },
52    },
53}
54
55art_cc_binary {
56    name: "artd",
57    defaults: ["artd_defaults"],
58    srcs: [
59        "artd_main.cc",
60    ],
61    shared_libs: [
62        "libart",
63        "libartbase",
64        "libartservice",
65        "libarttools",
66        "libbase",
67        "libdexfile#impl",
68    ],
69    apex_available: [
70        "com.android.art",
71        "com.android.art.debug",
72    ],
73}
74
75art_cc_defaults {
76    name: "art_artd_tests_defaults",
77    defaults: ["artd_defaults"],
78    header_libs: [
79        "libarttools_testing",
80    ],
81    static_libs: [
82        "libgmock",
83    ],
84    srcs: [
85        "artd_test.cc",
86        "file_utils_test.cc",
87        "path_utils_test.cc",
88    ],
89    device_common_data: [
90        ":art-gtest-jars-Main",
91        ":art-gtest-jars-Nested",
92    ],
93}
94
95// Version of ART gtest `art_artd_tests` for host.
96//
97// This test requires the full libbinder_ndk implementation on host, which is
98// not available as a prebuilt on the thin master-art branch. Hence it won't
99// work there, and there's a conditional in Android.gtest.mk to exclude it from
100// test-art-host-gtest.
101art_cc_test {
102    name: "art_artd_tests",
103    device_supported: false,
104    defaults: [
105        "art_gtest_defaults",
106        "art_artd_tests_defaults",
107    ],
108    shared_libs: [
109        "libartservice",
110        "libarttools",
111        "libbase",
112        "libdexfile",
113        "libprofile",
114    ],
115}
116
117// Standalone version of ART gtest `art_artd_tests`, not bundled with the ART
118// APEX on target.
119art_cc_test {
120    name: "art_standalone_artd_tests",
121    defaults: [
122        "art_standalone_gtest_defaults",
123        "art_artd_tests_defaults",
124    ],
125    static_libs: [
126        "libartservice",
127        "libarttools",
128        "libbase",
129        "libdexfile",
130        "libprofile",
131    ],
132    test_config_template: "art_standalone_artd_tests.xml",
133}
134
135cc_fuzz {
136    name: "artd_fuzzer",
137    defaults: [
138        "service_fuzzer_defaults",
139        "artd_defaults",
140        // Fuzzer is on a special variant, different from the APEX variant. When
141        // linking against "libdexfile" as a shared library, the build system
142        // incorrectly picks the platform variant, which only exposes system
143        // APIs. As a workaround, we link against "libdexfile" as a static
144        // library.
145        "libdexfile_static_defaults",
146    ],
147    host_supported: true,
148    srcs: ["artd_fuzzer.cc"],
149    shared_libs: [
150        "libart",
151        "libartbase",
152        "libartservice",
153        "libarttools",
154        "libbase",
155        "libdexfile",
156        "liblog",
157    ],
158    fuzz_config: {
159        cc: [
160            "[email protected]",
161        ],
162    },
163}
164