1package {
2    // See: http://go/android-license-faq
3    // A large-scale-change added 'default_applicable_licenses' to import
4    // all of the 'license_kinds' from "frameworks_native_license"
5    // to get the below license kinds:
6    //   SPDX-license-identifier-Apache-2.0
7    default_applicable_licenses: ["frameworks_native_license"],
8}
9
10cc_defaults {
11    name: "servicemanager_defaults",
12
13    cflags: [
14        "-Wall",
15        "-Wextra",
16        "-Werror",
17        "-DANDROID_UTILS_REF_BASE_DISABLE_IMPLICIT_CONSTRUCTION",
18    ],
19
20    srcs: [
21        "Access.cpp",
22        "ServiceManager.cpp",
23    ],
24
25    shared_libs: [
26        "libbase",
27        "libvintf",
28        "libcutils",
29        "liblog",
30        "libutils",
31        "libselinux",
32    ],
33
34    target: {
35        android: {
36            shared_libs: [
37                "libbinder",
38                "libutils",
39            ],
40        },
41        host: {
42            static_libs: [
43                "libbinder",
44                "libutils",
45            ],
46        },
47        darwin: {
48            enabled: false,
49        },
50        vendor: {
51            exclude_shared_libs: ["libvintf"],
52        },
53    },
54}
55
56cc_binary {
57    name: "servicemanager",
58    defaults: ["servicemanager_defaults"],
59    init_rc: ["servicemanager.rc"],
60    srcs: ["main.cpp"],
61    bootstrap: true,
62}
63
64cc_binary {
65    name: "servicemanager.recovery",
66    stem: "servicemanager",
67    recovery: true,
68    defaults: ["servicemanager_defaults"],
69    init_rc: ["servicemanager.recovery.rc"],
70    srcs: ["main.cpp"],
71}
72
73cc_binary {
74    name: "vndservicemanager",
75    defaults: ["servicemanager_defaults"],
76    init_rc: ["vndservicemanager.rc"],
77    vendor: true,
78    cflags: [
79        "-DVENDORSERVICEMANAGER=1",
80    ],
81    required: [
82        "vndservice",
83    ],
84    srcs: ["main.cpp"],
85}
86
87cc_test {
88    name: "servicemanager_test",
89    host_supported: true,
90    test_suites: ["device-tests"],
91    defaults: ["servicemanager_defaults"],
92    srcs: [
93        "test_sm.cpp",
94    ],
95    static_libs: ["libgmock"],
96}
97
98cc_test_host {
99    name: "servicemanager_unittest",
100    test_suites: ["general-tests"],
101    defaults: ["servicemanager_defaults"],
102    srcs: [
103        "ServiceManagerUnittest.cpp",
104    ],
105    static_libs: ["libgmock"],
106}
107
108cc_fuzz {
109    name: "servicemanager_fuzzer",
110    defaults: [
111        "servicemanager_defaults",
112        "service_fuzzer_defaults",
113    ],
114    host_supported: true,
115    srcs: ["ServiceManagerFuzzer.cpp"],
116    fuzz_config: {
117        libfuzzer_options: [
118            "max_len=50000",
119        ],
120        cc: [
121            "smoreland@google.com",
122            "waghpawan@google.com",
123        ],
124    },
125}
126