• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1// List of clang-tidy checks that are reported as errors.
2// Please keep this list ordered lexicographically.
3tidy_errors = [
4  "cert-err34-c",
5  "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",
11  "misc-unused-parameters",
12  "misc-unused-using-decls",
13  "misc-use-after-move",
14  "modernize-pass-by-value",
15  "performance-faster-string-find",
16  "performance-for-range-copy",
17  "performance-implicit-conversion-in-loop",
18  "performance-inefficient-vector-operation",
19  "performance-move-const-arg",
20  "performance-move-constructor-init",
21  "performance-noexcept-move-constructor",
22  "performance-unnecessary-value-param",
23]
24
25cc_defaults {
26  name: "apex_flags_defaults",
27  cflags: [
28    "-Wall",
29    "-Wextra",
30    "-Werror",
31    "-Wno-unused-parameter",
32
33    // Some extra flags.
34    "-fstrict-aliasing",
35    "-Wredundant-decls",
36    "-Wshadow",
37    "-Wstrict-aliasing",
38    "-Wthread-safety",
39    "-Wthread-safety-negative",
40    "-Wunreachable-code",
41    "-Wunreachable-code-break",
42    "-Wunreachable-code-return",
43    "-Wunused",
44    "-Wused-but-marked-unused",
45  ],
46  tidy: true,
47  tidy_checks: tidy_errors,
48  tidy_checks_as_errors: tidy_errors,
49  tidy_flags: [
50    "-format-style='file'",
51    "--header-filter='system/apex/'",
52  ],
53}
54
55
56cc_defaults {
57  name: "libapexd-deps",
58  defaults: ["libapex-deps"],
59  shared_libs: [
60    "libbinder",
61    "libselinux",
62    "liblog",
63    "liblogwrap",
64  ],
65  static_libs: [
66    "libapex",
67    "libavb",
68    "libdm",
69    "libext2_uuid",
70    "libverity_tree",
71    "libvold_binder",
72  ],
73  whole_static_libs: ["com.android.sysprop.apex"],
74}
75
76aidl_interface {
77  name: "apex_aidl_interface",
78  unstable: true,
79  srcs: [
80    "aidl/android/apex/ApexInfo.aidl",
81    "aidl/android/apex/ApexInfoList.aidl",
82    "aidl/android/apex/ApexSessionInfo.aidl",
83    "aidl/android/apex/ApexSessionParams.aidl",
84    "aidl/android/apex/IApexService.aidl",
85  ],
86  local_include_dir: "aidl",
87  backend: {
88      java: {
89          sdk_version: "28",
90      },
91      ndk: {
92          enabled: false,
93      },
94  },
95}
96
97cc_binary {
98  name: "apexd",
99  defaults: [
100    "apex_flags_defaults",
101    "libapex-deps",
102    "libapexd-deps",
103    "libapexservice-deps",
104  ],
105  srcs: [
106    "apexd_main.cpp",
107  ],
108  static_libs: [
109    "libapex",
110    "libapexd",
111    "libapexd_checkpoint_vold",
112    "libapexservice",
113  ],
114  init_rc: ["apexd.rc"],
115  // 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,
119}
120
121cc_library_static {
122  name: "libapexd",
123  defaults: [
124    "apex_flags_defaults",
125    "libapexd-deps",
126  ],
127  srcs: [
128    "apex_database.cpp",
129    "apexd.cpp",
130    "apexd_loop.cpp",
131    "apexd_prepostinstall.cpp",
132    "apexd_private.cpp",
133    "apexd_prop.cpp",
134    "apexd_session.cpp",
135    "apexd_verity.cpp",
136  ],
137  export_include_dirs: ["."],
138  // Don't add shared/static libs here; add to libapexd_defaults instead.
139}
140
141cc_library_static {
142  name: "libapexd_checkpoint_vold",
143  defaults: ["apex_flags_defaults"],
144  srcs: [ "apexd_checkpoint_vold.cpp" ],
145  static_libs: [
146    "libbase",
147    "libutils",
148    "libvold_binder",
149  ],
150  export_include_dirs: ["."],
151}
152
153cc_defaults {
154  name: "libapexservice-deps",
155  shared_libs: [
156    "apex_aidl_interface-cpp",
157    "libbinder",
158    "libutils",
159  ],
160}
161
162cc_library_static {
163  name: "libapexservice",
164  defaults: [
165    "apex_flags_defaults",
166    "libapexd-deps",
167    "libapexservice-deps",
168  ],
169  srcs: ["apexservice.cpp"],
170  static_libs: [
171    "libapexd",
172  ],
173}
174
175cc_defaults {
176  name: "libapex-deps",
177  shared_libs: [
178    "libbase",
179    "libcrypto",
180    "libcutils",
181    "libprotobuf-cpp-full",
182    "libziparchive",
183  ],
184  static_libs: [
185    "lib_apex_session_state_proto",
186    "lib_apex_manifest_proto",
187    "libavb",
188  ],
189  static: {
190    whole_static_libs: ["libc++fs"],
191  },
192  shared: {
193    static_libs: ["libc++fs"],
194  },
195}
196
197cc_library_static {
198  name: "libapex",
199  defaults: [
200    "apex_flags_defaults",
201    "libapex-deps"
202  ],
203  srcs: [
204    "apex_file.cpp",
205    "apex_manifest.cpp",
206    "apex_preinstalled_data.cpp",
207    "apex_shim.cpp",
208  ],
209  host_supported: true,
210  target: {
211    darwin: {
212      enabled: false,
213    },
214  },
215  header_libs: [
216    "libutils_headers",
217  ],
218  export_header_lib_headers: [
219    "libutils_headers",
220  ],
221}
222
223genrule {
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"],
229  tools: ["soong_zip", "zipalign", "conv_apex_manifest"],
230  cmd: "unzip -q $(in) -d $(genDir) && " +
231       "$(location conv_apex_manifest) setprop version 137 $(genDir)/apex_manifest.pb && " +
232       "$(location soong_zip) -d -C $(genDir) -D $(genDir) " +
233       "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
234       "-o $(genDir)/unaligned.apex && " +
235       "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
236       "$(genDir)/apex.apexd_test_manifest_mismatch.apex"
237}
238
239genrule {
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) " +
249       "-s apex_manifest.pb -s apex_payload.img -s apex_pubkey " +
250       "-o $(genDir)/unaligned.apex && " +
251       "$(location zipalign) -f 4096 $(genDir)/unaligned.apex " +
252       "$(genDir)/apex.apexd_test_corrupt_apex.apex"
253}
254
255cc_test {
256  name: "ApexTestCases",
257  defaults: [
258    "apex_flags_defaults",
259    "libapex-deps",
260    "libapexd-deps"
261  ],
262  require_root: true,
263  cflags: [
264    // Otherwise libgmock won't compile.
265    "-Wno-used-but-marked-unused",
266  ],
267  data: [
268    ":apex.apexd_test",
269    ":apex.apexd_test_different_app",
270    ":apex.apexd_test_no_hashtree",
271    ":apex.apexd_test_no_hashtree_2",
272    ":apex.apexd_test_no_inst_key",
273    ":apex.apexd_test_nocode",
274    ":apex.apexd_test_postinstall",
275    ":apex.apexd_test_preinstall",
276    ":apex.apexd_test_prepostinstall.fail",
277    ":apex.apexd_test_v2",
278    ":apex.corrupted_b146895998",
279    ":gen_bad_apexes",
280    ":gen_corrupt_apex",
281    ":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",
288    "apexd_testdata/com.android.apex.test_package.avbpubkey",
289  ],
290  srcs: [
291    "apex_database_test.cpp",
292    "apex_file_test.cpp",
293    "apex_manifest_test.cpp",
294    "apexd_session_test.cpp",
295    "apexd_verity_test.cpp",
296    "apexd_utils_test.cpp",
297    "apexservice_test.cpp",
298  ],
299  host_supported: false,
300  compile_multilib: "first",
301  static_libs: [
302    "apex_aidl_interface-cpp",
303    "libapex",
304    "libapexd",
305    "libfstab",
306    "libgmock",
307  ],
308  shared_libs: [
309    "libbinder",
310    "libfs_mgr",
311    "libutils",
312  ],
313  test_suites: ["device-tests"],
314  test_config: "AndroidTest.xml",
315}
316
317cc_test {
318  name: "flattened_apex_test",
319  defaults: [
320    "apex_flags_defaults",
321    "libapex-deps",
322    "libapexd-deps"
323  ],
324  srcs: ["flattened_apex_test.cpp"],
325  host_supported: false,
326  compile_multilib: "first",
327  static_libs: [
328    "libapex",
329    "libapexd",
330  ],
331  test_suites: ["device-tests"],
332  test_config: "flattened_apex_test_config.xml",
333}
334
335