1cc_defaults {
2    name: "installd_defaults",
3
4    cflags: [
5        "-Wall",
6        "-Werror",
7        "-Wextra",
8
9        "-Wunreachable-code",
10        "-Wunreachable-code-break",
11        "-Wunreachable-code-return",
12    ],
13    srcs: [
14        "CacheItem.cpp",
15        "CacheTracker.cpp",
16        "CrateManager.cpp",
17        "InstalldNativeService.cpp",
18        "QuotaUtils.cpp",
19        "dexopt.cpp",
20        "globals.cpp",
21        "utils.cpp",
22        "utils_default.cpp",
23        "view_compiler.cpp",
24        ":installd_aidl",
25    ],
26    header_libs: [
27        "dex2oat_headers",
28    ],
29    shared_libs: [
30        "libbase",
31        "libbinder",
32        "libcrypto",
33        "libcutils",
34        "liblog",
35        "liblogwrap",
36        "libprocessgroup",
37        "libselinux",
38        "libutils",
39        "server_configurable_flags",
40    ],
41
42    product_variables: {
43        arc: {
44            exclude_srcs: [
45                "QuotaUtils.cpp",
46            ],
47            static_libs: [
48                "libarcdiskquota",
49                "arc_services_aidl",
50            ],
51            cflags: [
52                "-DUSE_ARC",
53            ],
54        },
55    },
56
57    clang: true,
58
59    tidy: true,
60    tidy_checks: [
61        "-*",
62        "clang-analyzer-security*",
63        "cert-*",
64        "-cert-err58-cpp",
65    ],
66    tidy_flags: [
67        "-warnings-as-errors=clang-analyzer-security*,cert-*"
68    ],
69}
70
71//
72// Static library used in testing and executable
73//
74
75cc_library_static {
76    name: "libinstalld",
77    defaults: ["installd_defaults"],
78
79    export_include_dirs: ["."],
80    aidl: {
81        export_aidl_headers: true,
82    },
83
84    product_variables: {
85        arc: {
86            exclude_srcs: [
87                "QuotaUtils.cpp",
88            ],
89            static_libs: [
90                "libarcdiskquota",
91                "arc_services_aidl",
92            ],
93            cflags: [
94                "-DUSE_ARC",
95            ],
96        },
97    },
98}
99
100cc_library_headers {
101    name: "libinstalld_headers",
102    export_include_dirs: ["."],
103}
104
105//
106// Executable
107//
108
109cc_binary {
110    name: "installd",
111    defaults: ["installd_defaults"],
112    srcs: ["installd.cpp"],
113
114    static_libs: ["libdiskusage"],
115
116    init_rc: ["installd.rc"],
117
118    product_variables: {
119        arc: {
120            exclude_srcs: [
121                "QuotaUtils.cpp",
122            ],
123            static_libs: [
124                "libarcdiskquota",
125                "arc_services_aidl",
126            ],
127            cflags: [
128                "-DUSE_ARC",
129            ],
130        },
131    },
132
133    // Needs to be wherever installd is as it's execed by
134    // installd.
135    required: [ "migrate_legacy_obb_data.sh" ],
136}
137
138// OTA chroot tool
139
140cc_binary {
141    name: "otapreopt_chroot",
142    defaults: ["libapexd-deps"],
143    cflags: [
144        "-Wall",
145        "-Werror",
146    ],
147    clang: true,
148
149    srcs: [
150        "otapreopt_chroot.cpp",
151        "otapreopt_utils.cpp",
152    ],
153    shared_libs: [
154        "libbase",
155        "liblog",
156        "libutils",
157    ],
158    static_libs: [
159        "libapexd",
160    ],
161}
162
163filegroup {
164    name: "installd_aidl",
165    srcs: [
166        "binder/android/os/IInstalld.aidl",
167        "binder/android/os/storage/CrateMetadata.aidl",
168    ],
169    path: "binder",
170}
171
172//
173// Static library for otapreopt used in testing
174//
175cc_library_static {
176    name: "libotapreoptparameters",
177    cflags: [
178        "-Wall",
179        "-Werror"
180    ],
181
182    srcs: ["otapreopt_parameters.cpp"],
183
184    export_include_dirs: ["."],
185
186    shared_libs: [
187        "libbase",
188        "libcutils",
189        "liblog",
190        "libprocessgroup",
191        "libutils",
192    ],
193}
194
195//
196//  OTA Executable
197//
198
199cc_binary {
200    name: "otapreopt",
201    cflags: [
202        "-Wall",
203        "-Werror"
204    ],
205
206    srcs: [
207        "dexopt.cpp",
208        "globals.cpp",
209        "otapreopt.cpp",
210        "otapreopt_utils.cpp",
211        "utils.cpp",
212        "utils_default.cpp",
213        "view_compiler.cpp",
214    ],
215
216    header_libs: ["dex2oat_headers"],
217
218    static_libs: [
219        "libartimagevalues",
220        "libdiskusage",
221        "libotapreoptparameters",
222    ],
223
224    shared_libs: [
225        "libbase",
226        "libcrypto",
227        "libcutils",
228        "liblog",
229        "liblogwrap",
230        "libprocessgroup",
231        "libselinux",
232        "libutils",
233        "server_configurable_flags",
234    ],
235}
236
237// OTA slot script
238sh_binary {
239    name: "otapreopt_slot",
240    src: "otapreopt_slot.sh",
241    init_rc: ["otapreopt.rc"],
242}
243
244// OTA postinstall script
245sh_binary {
246    name: "otapreopt_script",
247    src: "otapreopt_script.sh",
248    // Let this depend on otapreopt, the chroot tool and the slot script,
249    // so we just have to mention one in a configuration.
250    required: [
251        "otapreopt",
252        "otapreopt_chroot",
253        "otapreopt_slot",
254    ],
255}
256
257// Script to migrate legacy obb data.
258sh_binary {
259    name: "migrate_legacy_obb_data.sh",
260    src: "migrate_legacy_obb_data.sh"
261}
262