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}
49
50art_cc_binary {
51    name: "artd",
52    defaults: ["artd_defaults"],
53    srcs: [
54        "artd_main.cc",
55    ],
56    shared_libs: [
57        "libart",
58        "libartbase",
59        "libartservice",
60        "libarttools",
61        "libbase",
62        "libdexfile",
63    ],
64    apex_available: [
65        "com.android.art",
66        "com.android.art.debug",
67    ],
68}
69
70art_cc_defaults {
71    name: "art_artd_tests_defaults",
72    defaults: ["artd_defaults"],
73    static_libs: [
74        "libgmock",
75    ],
76    srcs: [
77        "artd_test.cc",
78        "file_utils_test.cc",
79        "path_utils_test.cc",
80    ],
81    data: [
82        ":art-gtest-jars-Main",
83        ":art-gtest-jars-Nested",
84    ],
85}
86
87// Version of ART gtest `art_artd_tests` bundled with the ART APEX on target.
88//
89// This test requires the full libbinder_ndk implementation on host, which is
90// not available as a prebuilt on the thin master-art branch. Hence it won't
91// work there, and there's a conditional in Android.gtest.mk to exclude it from
92// test-art-host-gtest.
93art_cc_test {
94    name: "art_artd_tests",
95    defaults: [
96        "art_gtest_defaults",
97        "art_artd_tests_defaults",
98    ],
99    shared_libs: [
100        "libartservice",
101        "libarttools",
102        "libbase",
103        "libdexfile",
104    ],
105}
106
107// Standalone version of ART gtest `art_artd_tests`, not bundled with the ART
108// APEX on target.
109art_cc_test {
110    name: "art_standalone_artd_tests",
111    defaults: [
112        "art_standalone_gtest_defaults",
113        "art_artd_tests_defaults",
114    ],
115    static_libs: [
116        "libartservice",
117        "libarttools",
118        "libbase",
119        "libdexfile",
120    ],
121    test_config_template: "art_standalone_artd_tests.xml",
122}
123
124cc_fuzz {
125    name: "artd_fuzzer",
126    defaults: [
127        "service_fuzzer_defaults",
128        "artd_defaults",
129        // Fuzzer is on a special variant, different from the APEX variant. When
130        // linking against "libdexfile" as a shared library, the build system
131        // incorrectly picks the platform variant, which only exposes system
132        // APIs. As a workaround, we link against "libdexfile" as a static
133        // library.
134        "libdexfile_static_defaults",
135    ],
136    host_supported: true,
137    srcs: ["artd_fuzzer.cc"],
138    shared_libs: [
139        "libart",
140        "libartbase",
141        "libartservice",
142        "libarttools",
143        "libbase",
144        "libdexfile",
145        "liblog",
146    ],
147    fuzz_config: {
148        cc: [
149            "art-module-team@google.com",
150        ],
151    },
152}
153