blob: e8d221d585d90568b5e4d22e631ff6e52fc4d3ee [file] [log] [blame]
Nikita Ioffebca0bc12019-06-17 18:54:13 +01001// List of clang-tidy checks that are reported as errors.
2// Please keep this list ordered lexicographically.
Nikita Ioffeb55ed9b2019-03-26 20:44:52 +00003tidy_errors = [
Nikita Ioffe44ee0c62020-03-14 00:03:53 +00004 "cert-err34-c",
Nikita Ioffebca0bc12019-06-17 18:54:13 +01005 "google-default-arguments",
6 "google-explicit-constructor",
7 "google-runtime-int",
8 "google-runtime-member-string-references",
9 "misc-move-const-arg",
10 "misc-move-forwarding-reference",
Nikita Ioffe11fa6892019-06-18 05:24:24 +010011 "misc-unused-parameters",
12 "misc-unused-using-decls",
Nikita Ioffef94bda62019-06-18 01:13:38 +010013 "misc-use-after-move",
14 "modernize-pass-by-value",
Nikita Ioffeb55ed9b2019-03-26 20:44:52 +000015 "performance-faster-string-find",
16 "performance-for-range-copy",
17 "performance-implicit-conversion-in-loop",
Nikita Ioffebca0bc12019-06-17 18:54:13 +010018 "performance-inefficient-vector-operation",
Nikita Ioffeb55ed9b2019-03-26 20:44:52 +000019 "performance-move-const-arg",
20 "performance-move-constructor-init",
21 "performance-noexcept-move-constructor",
22 "performance-unnecessary-value-param",
23]
24
Dario Freni5a259292018-08-14 17:49:00 +010025cc_defaults {
Andreas Gampe7149e2f2019-02-07 11:44:04 -080026 name: "apex_flags_defaults",
Dario Freni5a259292018-08-14 17:49:00 +010027 cflags: [
Andreas Gampee66772f2018-10-17 16:31:58 -070028 "-Wall",
29 "-Wextra",
Abhijeet Kaur216e36c2019-01-04 10:15:01 +000030 "-Werror",
31 "-Wno-unused-parameter",
Andreas Gampee66772f2018-10-17 16:31:58 -070032
33 // Some extra flags.
34 "-fstrict-aliasing",
35 "-Wredundant-decls",
36 "-Wshadow",
37 "-Wstrict-aliasing",
38 "-Wthread-safety",
39 "-Wthread-safety-negative",
Dario Freni5a259292018-08-14 17:49:00 +010040 "-Wunreachable-code",
Andreas Gampee66772f2018-10-17 16:31:58 -070041 "-Wunreachable-code-break",
42 "-Wunreachable-code-return",
43 "-Wunused",
44 "-Wused-but-marked-unused",
Dario Freni5a259292018-08-14 17:49:00 +010045 ],
Nikita Ioffe6bea4e52019-02-10 22:46:05 +000046 tidy: true,
Nikita Ioffeb55ed9b2019-03-26 20:44:52 +000047 tidy_checks: tidy_errors,
48 tidy_checks_as_errors: tidy_errors,
Nikita Ioffe6bea4e52019-02-10 22:46:05 +000049 tidy_flags: [
50 "-format-style='file'",
51 "--header-filter='system/apex/'",
52 ],
Andreas Gampe7149e2f2019-02-07 11:44:04 -080053}
54
55
56cc_defaults {
Martijn Coenen548a31c2019-07-03 14:58:29 +020057 name: "libapexd-deps",
58 defaults: ["libapex-deps"],
Dario Freni5a259292018-08-14 17:49:00 +010059 shared_libs: [
Martijn Coenen548a31c2019-07-03 14:58:29 +020060 "libbinder",
61 "libselinux",
Nikita Ioffe02f0d002020-02-21 09:24:56 +000062 "liblog",
63 "liblogwrap",
Dario Freni5a259292018-08-14 17:49:00 +010064 ],
Abhijeet Kaur216e36c2019-01-04 10:15:01 +000065 static_libs: [
Martijn Coenen548a31c2019-07-03 14:58:29 +020066 "libapex",
67 "libavb",
68 "libdm",
David Andersonad91fab2019-06-27 14:49:44 -070069 "libext2_uuid",
Martijn Coenen548a31c2019-07-03 14:58:29 +020070 "libverity_tree",
71 "libvold_binder",
Abhijeet Kaur216e36c2019-01-04 10:15:01 +000072 ],
Martijn Coenen548a31c2019-07-03 14:58:29 +020073 whole_static_libs: ["com.android.sysprop.apex"],
Dario Freni5a259292018-08-14 17:49:00 +010074}
75
Martijn Coenene6f6b8f2018-08-17 09:48:33 +020076aidl_interface {
77 name: "apex_aidl_interface",
Jiyong Park77f148e2020-04-13 12:56:02 +090078 unstable: true,
Martijn Coenene6f6b8f2018-08-17 09:48:33 +020079 srcs: [
Dario Frenidded6c12018-11-19 16:02:26 +000080 "aidl/android/apex/ApexInfo.aidl",
Dario Frenia6ad33e2019-01-09 14:35:43 +000081 "aidl/android/apex/ApexInfoList.aidl",
Dario Frenid2437642019-01-11 14:35:23 +000082 "aidl/android/apex/ApexSessionInfo.aidl",
Oli Lanb8b03062019-12-02 14:08:24 +000083 "aidl/android/apex/ApexSessionParams.aidl",
Martijn Coenene6f6b8f2018-08-17 09:48:33 +020084 "aidl/android/apex/IApexService.aidl",
85 ],
86 local_include_dir: "aidl",
Dario Freni8e88b682018-10-25 13:06:21 +010087 backend: {
Jeongik Cha1ae83c52019-03-18 11:54:55 +090088 java: {
89 sdk_version: "28",
90 },
Dario Freni8e88b682018-10-25 13:06:21 +010091 ndk: {
92 enabled: false,
93 },
94 },
Martijn Coenene6f6b8f2018-08-17 09:48:33 +020095}
96
Dario Freni3ff2c652018-08-10 19:55:32 +010097cc_binary {
Dario Freni5a259292018-08-14 17:49:00 +010098 name: "apexd",
Andreas Gampe602ef782018-11-12 16:51:31 -080099 defaults: [
Martijn Coenen548a31c2019-07-03 14:58:29 +0200100 "apex_flags_defaults",
101 "libapex-deps",
102 "libapexd-deps",
Andreas Gampe602ef782018-11-12 16:51:31 -0800103 "libapexservice-deps",
Dario Freni5a259292018-08-14 17:49:00 +0100104 ],
Andreas Gampe27adafa2018-11-29 12:20:08 -0800105 srcs: [
106 "apexd_main.cpp",
Andreas Gampe27adafa2018-11-29 12:20:08 -0800107 ],
Dario Freni5a259292018-08-14 17:49:00 +0100108 static_libs: [
109 "libapex",
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700110 "libapexd",
Andreas Gampe6aaa2fe2019-03-29 14:13:59 -0700111 "libapexd_checkpoint_vold",
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700112 "libapexservice",
Jiyong Parkc2f77eb2018-12-03 22:13:37 +0900113 ],
Martijn Coenen3d031462018-08-17 10:37:29 +0200114 init_rc: ["apexd.rc"],
Jiyong Park715e23d2019-02-22 22:14:37 +0900115 // Just like the init, apexd should be able to run without
116 // any APEX activated. To do so, it uses the bootstrap linker
117 // and the bootstrap bionic libraries.
118 bootstrap: true,
Dario Freni5a259292018-08-14 17:49:00 +0100119}
Dario Freni3ff2c652018-08-10 19:55:32 +0100120
Dario Freni5a259292018-08-14 17:49:00 +0100121cc_library_static {
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700122 name: "libapexd",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200123 defaults: [
124 "apex_flags_defaults",
125 "libapexd-deps",
126 ],
Roland Levillain3d776bb2018-12-13 16:44:39 +0000127 srcs: [
Jooyung Han7dca50c2019-04-12 04:52:42 +0900128 "apex_database.cpp",
Roland Levillain3d776bb2018-12-13 16:44:39 +0000129 "apexd.cpp",
Andreas Gampe225e1b02019-01-15 14:53:24 -0800130 "apexd_loop.cpp",
Andreas Gampef7663552019-01-03 09:22:11 -0800131 "apexd_prepostinstall.cpp",
Roland Levillain3d776bb2018-12-13 16:44:39 +0000132 "apexd_private.cpp",
Zimuzo9cc0be42019-01-09 11:37:34 +0000133 "apexd_prop.cpp",
Jooyung Hanf7c8d032019-04-11 15:12:09 +0900134 "apexd_session.cpp",
135 "apexd_verity.cpp",
Roland Levillain3d776bb2018-12-13 16:44:39 +0000136 ],
Roland Levillain3d776bb2018-12-13 16:44:39 +0000137 export_include_dirs: ["."],
Martijn Coenen548a31c2019-07-03 14:58:29 +0200138 // Don't add shared/static libs here; add to libapexd_defaults instead.
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700139}
140
Andreas Gampe6aaa2fe2019-03-29 14:13:59 -0700141cc_library_static {
142 name: "libapexd_checkpoint_vold",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200143 defaults: ["apex_flags_defaults"],
Andreas Gampe6aaa2fe2019-03-29 14:13:59 -0700144 srcs: [ "apexd_checkpoint_vold.cpp" ],
145 static_libs: [
146 "libbase",
147 "libutils",
148 "libvold_binder",
149 ],
150 export_include_dirs: ["."],
151}
152
Andreas Gampe602ef782018-11-12 16:51:31 -0800153cc_defaults {
154 name: "libapexservice-deps",
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700155 shared_libs: [
Andreas Gampe602ef782018-11-12 16:51:31 -0800156 "apex_aidl_interface-cpp",
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700157 "libbinder",
158 "libutils",
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700159 ],
Andreas Gampe602ef782018-11-12 16:51:31 -0800160}
Jooyung Hanf7c8d032019-04-11 15:12:09 +0900161
Andreas Gampe602ef782018-11-12 16:51:31 -0800162cc_library_static {
163 name: "libapexservice",
164 defaults: [
Martijn Coenen548a31c2019-07-03 14:58:29 +0200165 "apex_flags_defaults",
166 "libapexd-deps",
Andreas Gampe602ef782018-11-12 16:51:31 -0800167 "libapexservice-deps",
168 ],
169 srcs: ["apexservice.cpp"],
Jooyung Hanf7c8d032019-04-11 15:12:09 +0900170 static_libs: [
171 "libapexd",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200172 ],
173}
174
175cc_defaults {
176 name: "libapex-deps",
177 shared_libs: [
178 "libbase",
179 "libcrypto",
180 "libcutils",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200181 "libprotobuf-cpp-full",
182 "libziparchive",
183 ],
184 static_libs: [
185 "lib_apex_session_state_proto",
186 "lib_apex_manifest_proto",
Jooyung Hanf7c8d032019-04-11 15:12:09 +0900187 "libavb",
188 ],
Martijn Coenen548a31c2019-07-03 14:58:29 +0200189 static: {
190 whole_static_libs: ["libc++fs"],
191 },
192 shared: {
193 static_libs: ["libc++fs"],
194 },
Andreas Gampefa3f20b2018-10-19 21:43:32 -0700195}
196
197cc_library_static {
Dario Freni5a259292018-08-14 17:49:00 +0100198 name: "libapex",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200199 defaults: [
200 "apex_flags_defaults",
201 "libapex-deps"
202 ],
Dario Freni5a259292018-08-14 17:49:00 +0100203 srcs: [
204 "apex_file.cpp",
Dario Freniaeb233c2018-08-28 12:48:42 +0100205 "apex_manifest.cpp",
Dario Freni9d576242019-10-13 10:09:32 +0100206 "apex_preinstalled_data.cpp",
Nikita Ioffe4db13a52019-03-14 23:26:08 +0000207 "apex_shim.cpp",
Dario Freni5a259292018-08-14 17:49:00 +0100208 ],
209 host_supported: true,
Andreas Gampe97f17542018-12-27 13:12:30 -0800210 target: {
211 darwin: {
212 enabled: false,
213 },
214 },
Dario Freni5a259292018-08-14 17:49:00 +0100215 header_libs: [
216 "libutils_headers",
217 ],
218 export_header_lib_headers: [
219 "libutils_headers",
220 ],
221}
Dario Freni3ff2c652018-08-10 19:55:32 +0100222
Martijn Coenen329f1122019-02-28 16:10:08 +0100223genrule {
224 // Generates an apex which has a different manifest outside the filesystem
225 // image.
226 name: "gen_bad_apexes",
227 out: ["apex.apexd_test_manifest_mismatch.apex"],
228 srcs: [":apex.apexd_test"],
Dario Frenia277bdf2019-11-05 22:37:49 +0000229 tools: ["soong_zip", "zipalign", "conv_apex_manifest"],
Martijn Coenen329f1122019-02-28 16:10:08 +0100230 cmd: "unzip -q $(in) -d $(genDir) && " +
Jooyung Han2426fc92019-11-12 13:03:50 +0900231 "$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " +
Martijn Coenen329f1122019-02-28 16:10:08 +0100232 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
Jooyung Han2426fc92019-11-12 13:03:50 +0900233 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
Martijn Coenen329f1122019-02-28 16:10:08 +0100234 "-o $(genDir)/unaligned.apex && " +
235 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
236 "$(genDir)/apex.apexd_test_manifest_mismatch.apex"
237}
238
Martijn Coenen2caabb42019-04-02 11:42:02 +0200239genrule {
240 // Generates an apex with a corrupted filesystem image, which should cause
241 // dm-verity verification to fail
242 name: "gen_corrupt_apex",
243 out: ["apex.apexd_test_corrupt_apex.apex"],
244 srcs: [":apex.apexd_test"],
245 tools: ["soong_zip", "zipalign"],
246 cmd: "unzip -q $(in) -d $(genDir) && " +
247 "dd if=/dev/zero of=$(genDir)/apex_payload.img conv=notrunc bs=1024 seek=16 count=1 && " +
248 "$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
Jooyung Han2426fc92019-11-12 13:03:50 +0900249 "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
Martijn Coenen2caabb42019-04-02 11:42:02 +0200250 "-o $(genDir)/unaligned.apex && " +
251 "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
252 "$(genDir)/apex.apexd_test_corrupt_apex.apex"
253}
254
Andreas Gampe35e80932018-10-29 12:56:53 -0700255cc_test {
Nikita Ioffead94bcc2020-04-24 15:22:41 +0100256 name: "ApexTestCases",
Martijn Coenen548a31c2019-07-03 14:58:29 +0200257 defaults: [
258 "apex_flags_defaults",
259 "libapex-deps",
260 "libapexd-deps"
261 ],
Nikita Ioffead94bcc2020-04-24 15:22:41 +0100262 require_root: true,
Nikita Ioffea82b0a82019-02-15 18:59:47 +0000263 cflags: [
264 // Otherwise libgmock won't compile.
265 "-Wno-used-but-marked-unused",
266 ],
Andreas Gampe0562bc52018-12-12 15:03:58 -0800267 data: [
268 ":apex.apexd_test",
Dario Freni6dd4dd62019-01-18 12:45:44 +0000269 ":apex.apexd_test_different_app",
Nikita Ioffe695b0a32019-12-05 17:17:41 +0000270 ":apex.apexd_test_no_hashtree",
271 ":apex.apexd_test_no_hashtree_2",
Andreas Gampea2bbbbe2018-12-21 15:05:48 -0800272 ":apex.apexd_test_no_inst_key",
Jiyong Park361fed22019-06-03 10:15:50 +0900273 ":apex.apexd_test_nocode",
Andreas Gampef4c7e7c2019-01-14 12:33:34 -0800274 ":apex.apexd_test_postinstall",
Jiyong Park361fed22019-06-03 10:15:50 +0900275 ":apex.apexd_test_preinstall",
Andreas Gampe1144b182019-02-04 15:28:12 -0800276 ":apex.apexd_test_prepostinstall.fail",
Jiyong Park361fed22019-06-03 10:15:50 +0900277 ":apex.apexd_test_v2",
Nikita Ioffeaf157ab2020-04-15 22:14:11 +0100278 ":apex.corrupted_b146895998",
Martijn Coenen329f1122019-02-28 16:10:08 +0100279 ":gen_bad_apexes",
Martijn Coenen2caabb42019-04-02 11:42:02 +0200280 ":gen_corrupt_apex",
Nikita Ioffe8934a4c2019-04-04 12:35:34 +0100281 ":com.android.apex.cts.shim.v1_prebuilt",
282 ":com.android.apex.cts.shim.v2_prebuilt",
283 ":com.android.apex.cts.shim.v2_wrong_sha_prebuilt",
284 ":com.android.apex.cts.shim.v2_additional_file_prebuilt",
285 ":com.android.apex.cts.shim.v2_additional_folder_prebuilt",
286 ":com.android.apex.cts.shim.v2_with_pre_install_hook_prebuilt",
287 ":com.android.apex.cts.shim.v2_with_post_install_hook_prebuilt",
Nikita Ioffead94bcc2020-04-24 15:22:41 +0100288 "apexd_testdata/com.android.apex.test_package.avbpubkey",
Andreas Gampe0562bc52018-12-12 15:03:58 -0800289 ],
Nikita Ioffead94bcc2020-04-24 15:22:41 +0100290 srcs: [
291 "apex_database_test.cpp",
292 "apex_file_test.cpp",
293 "apex_manifest_test.cpp",
294 "apexd_verity_test.cpp",
295 "apexservice_test.cpp",
296 ],
Andreas Gampe35e80932018-10-29 12:56:53 -0700297 host_supported: false,
Andreas Gampe3a3169a2019-01-15 09:01:27 -0800298 compile_multilib: "first",
Andreas Gampec45bf322018-12-06 13:57:45 -0800299 static_libs: [
300 "apex_aidl_interface-cpp",
301 "libapex",
Andreas Gampe4510d492018-12-12 15:56:05 -0800302 "libapexd",
Nikita Ioffe695b0a32019-12-05 17:17:41 +0000303 "libfstab",
Nikita Ioffea82b0a82019-02-15 18:59:47 +0000304 "libgmock",
Andreas Gampec45bf322018-12-06 13:57:45 -0800305 ],
Andreas Gampe35e80932018-10-29 12:56:53 -0700306 shared_libs: [
307 "libbinder",
Nikita Ioffe78d2bce2020-05-02 01:28:30 +0100308 "libfs_mgr",
Andreas Gampe35e80932018-10-29 12:56:53 -0700309 "libutils",
310 ],
311 test_suites: ["device-tests"],
Nikita Ioffead94bcc2020-04-24 15:22:41 +0100312 test_config: "AndroidTest.xml",
Andreas Gampe35e80932018-10-29 12:56:53 -0700313}
Nikita Ioffe6d6c74f2019-03-18 14:54:38 +0000314
Nikita Ioffe69536f02019-07-19 16:20:16 +0100315cc_test {
316 name: "flattened_apex_test",
317 defaults: [
318 "apex_flags_defaults",
319 "libapex-deps",
320 "libapexd-deps"
321 ],
322 srcs: ["flattened_apex_test.cpp"],
323 host_supported: false,
324 compile_multilib: "first",
325 static_libs: [
326 "libapex",
327 "libapexd",
328 ],
329 test_suites: ["device-tests"],
330 test_config: "flattened_apex_test_config.xml",
331}
332