blob: e5f8c3154a4f65bd27493152c0dd099759ad2f56 [file] [log] [blame]
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001//
2// Copyright (C) 2015 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//
16
Colin Cross606913a2017-11-14 13:05:37 -080017// AIDL interface between libupdate_engine and framework.jar
18filegroup {
19 name: "libupdate_engine_aidl",
20 srcs: [
21 "binder_bindings/android/os/IUpdateEngine.aidl",
22 "binder_bindings/android/os/IUpdateEngineCallback.aidl",
23 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070024 path: "binder_bindings",
25}
26
27cc_defaults {
28 name: "ue_defaults",
29
30 cflags: [
Amin Hassani2e4eda52019-01-07 14:01:17 -080031 "-DBASE_VER=576279",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070032 "-DUSE_HWID_OVERRIDE=0",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070033 "-D_FILE_OFFSET_BITS=64",
34 "-D_POSIX_C_SOURCE=199309L",
35 "-Wa,--noexecstack",
36 "-Wall",
37 "-Werror",
38 "-Wextra",
39 "-Wformat=2",
40 "-Wno-psabi",
41 "-Wno-unused-parameter",
42 "-ffunction-sections",
43 "-fstack-protector-strong",
44 "-fvisibility=hidden",
45 ],
46 cppflags: [
47 "-Wnon-virtual-dtor",
48 "-fno-strict-aliasing",
49 ],
50 include_dirs: ["system"],
51 local_include_dirs: ["client_library/include"],
52 static_libs: ["libgtest_prod"],
53 shared_libs: [
54 "libbrillo-stream",
55 "libbrillo",
56 "libchrome",
57 ],
58 ldflags: ["-Wl,--gc-sections"],
59
60 product_variables: {
61 pdk: {
62 enabled: false,
63 },
64 },
65
66 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080067 android: {
68 cflags: [
69 "-DUSE_FEC=1",
70 ],
71 },
72 host: {
73 cflags: [
74 "-DUSE_FEC=0",
75 ],
76 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070077 darwin: {
78 enabled: false,
79 },
80 },
81}
82
83// update_metadata-protos (type: static_library)
84// ========================================================
85// Protobufs.
86cc_defaults {
87 name: "update_metadata-protos_exports",
88
89 shared_libs: ["libprotobuf-cpp-lite"],
90}
91
92cc_library_static {
93 name: "update_metadata-protos",
94 host_supported: true,
95 recovery_available: true,
96
97 srcs: ["update_engine/update_metadata.proto"],
98 cflags: [
99 "-Wall",
100 "-Werror",
101 ],
102 proto: {
103 canonical_path_from_root: false,
104 export_proto_headers: true,
105 },
106}
107
108// libpayload_consumer (type: static_library)
109// ========================================================
110// The payload application component and common dependencies.
111cc_defaults {
112 name: "libpayload_consumer_exports",
113 defaults: ["update_metadata-protos_exports"],
114
115 static_libs: [
116 "update_metadata-protos",
117 "libxz",
118 "libbz",
119 "libbspatch",
120 "libbrotli",
Tianjie99d570d2020-06-04 14:57:19 -0700121 "libc++fs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700122 "libfec_rs",
123 "libpuffpatch",
124 "libverity_tree",
125 ],
126 shared_libs: [
127 "libbase",
128 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800129 "libfec",
Tianjie99d570d2020-06-04 14:57:19 -0700130 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700131 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700132}
133
134cc_library_static {
135 name: "libpayload_consumer",
136 defaults: [
137 "ue_defaults",
138 "libpayload_consumer_exports",
139 ],
140 host_supported: true,
141 recovery_available: true,
142
143 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700144 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700145 "common/action_processor.cc",
146 "common/boot_control_stub.cc",
147 "common/clock.cc",
148 "common/constants.cc",
149 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800150 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700151 "common/error_code_utils.cc",
152 "common/file_fetcher.cc",
153 "common/hash_calculator.cc",
154 "common/http_common.cc",
155 "common/http_fetcher.cc",
156 "common/hwid_override.cc",
157 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700158 "common/prefs.cc",
159 "common/proxy_resolver.cc",
160 "common/subprocess.cc",
161 "common/terminator.cc",
162 "common/utils.cc",
163 "payload_consumer/bzip_extent_writer.cc",
164 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700165 "payload_consumer/certificate_parser_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700166 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700167 "payload_consumer/extent_reader.cc",
168 "payload_consumer/extent_writer.cc",
169 "payload_consumer/file_descriptor.cc",
170 "payload_consumer/file_descriptor_utils.cc",
171 "payload_consumer/file_writer.cc",
172 "payload_consumer/filesystem_verifier_action.cc",
173 "payload_consumer/install_plan.cc",
174 "payload_consumer/mount_history.cc",
175 "payload_consumer/payload_constants.cc",
176 "payload_consumer/payload_metadata.cc",
177 "payload_consumer/payload_verifier.cc",
178 "payload_consumer/postinstall_runner_action.cc",
179 "payload_consumer/verity_writer_android.cc",
180 "payload_consumer/xz_extent_writer.cc",
181 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700182 "payload_consumer/partition_update_generator_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700183 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700184}
185
186// libupdate_engine_boot_control (type: static_library)
187// ========================================================
188// A BootControl class implementation using Android's HIDL boot_control HAL.
189cc_defaults {
190 name: "libupdate_engine_boot_control_exports",
191 defaults: ["update_metadata-protos_exports"],
192
Yifan Hong420db9b2019-07-23 20:50:33 -0700193 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800194 "libcutils",
195 "libfs_mgr_binder",
196 "libgsi",
Yifan Hongdad0af82020-02-19 17:19:49 -0800197 "libpayload_consumer",
Yifan Hong420db9b2019-07-23 20:50:33 -0700198 "libsnapshot",
199 "update_metadata-protos",
200 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700201 shared_libs: [
202 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700203 "libhidlbase",
204 "liblp",
Yifan Hongd976cc52020-02-25 14:51:42 -0800205 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700206 "libutils",
207 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700208 "android.hardware.boot@1.1",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700209 ],
Yifan Hong29692902020-03-26 12:47:05 -0700210 header_libs: [
211 "avb_headers",
212 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700213 target: {
214 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800215 static_libs: [
216 "libfs_mgr",
217 "libsnapshot_nobinder",
218 ],
219 exclude_static_libs: [
220 "libfs_mgr_binder",
221 "libsnapshot",
222 ],
Yifan Hong212d7952020-02-04 11:08:08 -0800223 exclude_shared_libs: [
Yifan Hongd976cc52020-02-25 14:51:42 -0800224 "libstatslog",
Yifan Hong212d7952020-02-04 11:08:08 -0800225 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700226 },
227 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700228}
229
230cc_library_static {
231 name: "libupdate_engine_boot_control",
232 defaults: [
233 "ue_defaults",
234 "libupdate_engine_boot_control_exports",
Yifan Hongdad0af82020-02-19 17:19:49 -0800235 "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700236 ],
237 recovery_available: true,
238
239 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700240 "aosp/boot_control_android.cc",
241 "aosp/cleanup_previous_update_action.cc",
242 "aosp/dynamic_partition_control_android.cc",
243 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700244 ],
245}
246
247// libupdate_engine_android (type: static_library)
248// ========================================================
249// The main daemon static_library used in Android (non-Brillo). This only has a
250// loop to apply payloads provided by the upper layer via a Binder interface.
251cc_defaults {
252 name: "libupdate_engine_android_exports",
253 defaults: [
254 "ue_defaults",
255 "libpayload_consumer_exports",
256 "libupdate_engine_boot_control_exports",
257 ],
258
259 static_libs: [
Yifan Hongfd6640f2020-08-27 19:13:17 -0700260 "libkver",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700261 "libpayload_consumer",
262 "libupdate_engine_boot_control",
263 ],
264 shared_libs: [
265 "libandroid_net",
266 "libbase",
267 "libbinder",
268 "libbinderwrapper",
269 "libbootloader_message",
270 "libbrillo-binder",
271 "libcurl",
272 "libcutils",
Yifan Hong2562cf22020-07-21 19:28:44 -0700273 "libupdate_engine_stable-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700274 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700275 "libssl",
Tianjie Xu75cc9f22019-08-02 14:53:38 -0700276 "libstatslog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700277 "libutils",
278 ],
279}
280
281cc_library_static {
282 name: "libupdate_engine_android",
283 defaults: [
284 "ue_defaults",
285 "libupdate_engine_android_exports",
286 ],
287
288 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
289 // out of the DBus interface.
290 include_dirs: ["external/cros/system_api/dbus"],
291
292 aidl: {
293 local_include_dirs: ["binder_bindings"],
294 export_aidl_headers: true,
295 },
296
297 srcs: [
298 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800299 "common/system_state.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700300 "aosp/binder_service_android.cc",
301 "aosp/binder_service_stable_android.cc",
302 "aosp/daemon_android.cc",
303 "aosp/daemon_state_android.cc",
304 "aosp/hardware_android.cc",
305 "aosp/logging_android.cc",
306 "aosp/network_selector_android.cc",
307 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700308 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800309 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700310 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700311 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700312 "update_boot_flags_action.cc",
313 "update_status_utils.cc",
314 ],
315}
316
317// update_engine (type: executable)
318// ========================================================
319// update_engine daemon.
320cc_binary {
321 name: "update_engine",
322 defaults: [
323 "ue_defaults",
324 "libupdate_engine_android_exports",
325 ],
326
327 static_libs: ["libupdate_engine_android"],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700328 required: [
329 "cacerts_google",
Tianjie Xube4ea232019-10-15 18:08:31 -0700330 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700331 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700332
Amin Hassaniec7bc112020-10-29 16:47:58 -0700333 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700334 init_rc: ["update_engine.rc"],
335}
336
337// update_engine_sideload (type: executable)
338// ========================================================
339// A binary executable equivalent to update_engine daemon that installs an update
340// from a local file directly instead of running in the background. Used in
341// recovery image.
342cc_binary {
343 name: "update_engine_sideload",
344 defaults: [
345 "ue_defaults",
346 "update_metadata-protos_exports",
347 "libupdate_engine_boot_control_exports",
348 "libpayload_consumer_exports",
349 ],
350 recovery: true,
351
352 cflags: ["-D_UE_SIDELOAD"],
353 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
354 // out of the DBus interface.
355 include_dirs: ["external/cros/system_api/dbus"],
356
357 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700358 "aosp/hardware_android.cc",
359 "aosp/logging_android.cc",
360 "aosp/sideload_main.cc",
361 "aosp/update_attempter_android.cc",
362 "common/metrics_reporter_stub.cc",
363 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800364 "common/system_state.cc",
365 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700366 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700367 "update_boot_flags_action.cc",
368 "update_status_utils.cc",
369 ],
370
371 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
372 // as it doesn't look beneficial to be installed separately due to its size. Note
373 // that we explicitly request their recovery variants, so that the expected files
374 // will be used and installed.
375 shared_libs: [
376 "libbase",
377 "liblog",
378 ],
379 static_libs: [
380 "libpayload_consumer",
381 "libupdate_engine_boot_control",
382 "update_metadata-protos",
383
384 // We add the static versions of the shared libraries that are not installed to
385 // recovery image due to size concerns. Need to include all the static library
386 // dependencies of these static libraries.
387 "libevent",
388 "libmodpb64",
389 "libgtest_prod",
390 "libprotobuf-cpp-lite",
391 "libbrillo-stream",
392 "libbrillo",
393 "libchrome",
Yifan Hongfd6640f2020-08-27 19:13:17 -0700394 "libkver",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700395 ],
396 target: {
397 recovery: {
398 exclude_shared_libs: [
399 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700400 "libbrillo-stream",
401 "libbrillo",
402 "libchrome",
403 ],
404 },
405 },
406
Tao Bao1e1c86c2019-04-18 10:48:32 -0700407 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700408 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700409 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700410}
411
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700412// update_engine_client (type: executable)
413// ========================================================
414// update_engine console client.
415cc_binary {
416 name: "update_engine_client",
417 defaults: ["ue_defaults"],
418
419 // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved
420 // out of the DBus interface.
421 include_dirs: ["external/cros/system_api/dbus"],
422
423 shared_libs: [
424 "libbinder",
425 "libbinderwrapper",
426 "libbrillo-binder",
427 "libutils",
428 ],
429
430 aidl: {
431 local_include_dirs: ["binder_bindings"],
432 },
433
434 srcs: [
435 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700436 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700437 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700438 "update_status_utils.cc",
439 ],
440}
441
442// libpayload_generator (type: static_library)
443// ========================================================
444// server-side code. This is used for delta_generator and unittests but not
445// for any client code.
446cc_defaults {
447 name: "libpayload_generator_exports",
448 defaults: [
449 "libpayload_consumer_exports",
450 "update_metadata-protos_exports",
451 ],
452
Tianjie37ae8562020-03-25 15:16:01 -0700453 header_libs: [
454 "bootimg_headers",
455 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700456 static_libs: [
457 "libavb",
458 "libbrotli",
459 "libbsdiff",
460 "libdivsufsort",
461 "libdivsufsort64",
462 "liblzma",
463 "libpayload_consumer",
464 "libpuffdiff",
465 "libverity_tree",
466 "update_metadata-protos",
467 ],
468 shared_libs: [
469 "libbase",
470 "libext2fs",
471 ],
472}
473
474cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000475 name: "libpayload_extent_ranges",
476 defaults: [
477 "ue_defaults",
478 ],
479 host_supported: true,
480 srcs: [
481 "payload_generator/extent_ranges.cc",
482 ],
483 static_libs: [
484 "update_metadata-protos",
485 ],
486}
487
488cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700489 name: "libpayload_generator",
490 defaults: [
491 "ue_defaults",
492 "libpayload_generator_exports",
493 ],
494 host_supported: true,
495
496 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800497 "common/system_state.cc",
498 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700499 "payload_generator/ab_generator.cc",
500 "payload_generator/annotated_operation.cc",
501 "payload_generator/blob_file_writer.cc",
502 "payload_generator/block_mapping.cc",
503 "payload_generator/boot_img_filesystem.cc",
504 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700505 "payload_generator/deflate_utils.cc",
506 "payload_generator/delta_diff_generator.cc",
507 "payload_generator/delta_diff_utils.cc",
508 "payload_generator/ext2_filesystem.cc",
509 "payload_generator/extent_ranges.cc",
510 "payload_generator/extent_utils.cc",
511 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700512 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700513 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700514 "payload_generator/payload_file.cc",
515 "payload_generator/payload_generation_config_android.cc",
516 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700517 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700518 "payload_generator/payload_signer.cc",
519 "payload_generator/raw_filesystem.cc",
520 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700521 "payload_generator/xz_android.cc",
522 ],
523}
524
525// delta_generator (type: executable)
526// ========================================================
527// server-side delta generator.
528cc_binary_host {
529 name: "delta_generator",
530 defaults: [
531 "ue_defaults",
532 "libpayload_generator_exports",
533 "libpayload_consumer_exports",
534 ],
535
536 static_libs: [
537 "libavb_host_sysdeps",
538 "libpayload_consumer",
539 "libpayload_generator",
540 ],
541
542 srcs: ["payload_generator/generate_delta_main.cc"],
543}
544
545cc_test {
546 name: "ue_unittest_delta_generator",
547 defaults: [
548 "ue_defaults",
549 "libpayload_generator_exports",
550 "libpayload_consumer_exports",
551 ],
552
553 static_libs: [
554 "libpayload_consumer",
555 "libpayload_generator",
556 ],
557
558 srcs: ["payload_generator/generate_delta_main.cc"],
559
560 gtest: false,
561 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700562}
563
564// test_http_server (type: executable)
565// ========================================================
566// Test HTTP Server.
567cc_test {
568 name: "test_http_server",
569 defaults: ["ue_defaults"],
570 srcs: [
571 "common/http_common.cc",
572 "test_http_server.cc",
573 ],
574
575 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700576}
577
578// test_subprocess (type: executable)
579// ========================================================
580// Test helper subprocess program.
581cc_test {
582 name: "test_subprocess",
583 defaults: ["ue_defaults"],
584 srcs: ["test_subprocess.cc"],
585
586 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700587}
588
589// Public keys for unittests.
590// ========================================================
591genrule {
592 name: "ue_unittest_keys",
593 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700594 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700595 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
596 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700597 srcs: [
598 "unittest_key.pem",
599 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700600 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700601 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700602 ],
603 out: [
604 "unittest_key.pub.pem",
605 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -0700606 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700607 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700608 ],
609}
610
611// Sample images for unittests.
612// ========================================================
613// Extract sample image from the compressed sample_images.tar.bz2 file used by
614// the unittests.
615genrule {
616 name: "ue_unittest_disk_imgs",
617 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
618 srcs: ["sample_images/sample_images.tar.bz2"],
619 out: [
620 "gen/disk_ext2_1k.img",
621 "gen/disk_ext2_4k.img",
622 "gen/disk_ext2_4k_empty.img",
623 "gen/disk_ext2_unittest.img",
624 ],
625}
626
627// update_engine_unittests (type: executable)
628// ========================================================
629// Main unittest file.
630cc_test {
631 name: "update_engine_unittests",
632 defaults: [
633 "ue_defaults",
634 "libpayload_generator_exports",
635 "libupdate_engine_android_exports",
636 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700637
638 static_libs: [
639 "libpayload_generator",
640 "libbrillo-test-helpers",
641 "libgmock",
642 "libchrome_test_helpers",
643 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -0800644 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700645 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700646
Yifan Hong87ea73f2019-09-12 13:07:37 -0700647 header_libs: [
648 "libstorage_literals_headers",
649 ],
650
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700651 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -0700652 ":test_http_server",
653 ":test_subprocess",
654 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700655 ":ue_unittest_disk_imgs",
656 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700657 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700658 "unittest_key.pem",
659 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700660 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700661 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700662 "update_engine.conf",
663 ],
664
Tao Bao9456b6f2019-04-29 18:14:58 -0700665 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
666 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
667 test_config: "test_config.xml",
668 test_suites: ["device-tests"],
669
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700670 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700671 "aosp/dynamic_partition_control_android_unittest.cc",
672 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700673 "certificate_checker_unittest.cc",
674 "common/action_pipe_unittest.cc",
675 "common/action_processor_unittest.cc",
676 "common/action_unittest.cc",
677 "common/cpu_limiter_unittest.cc",
678 "common/fake_prefs.cc",
679 "common/file_fetcher_unittest.cc",
680 "common/hash_calculator_unittest.cc",
681 "common/http_fetcher_unittest.cc",
682 "common/hwid_override_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700683 "common/metrics_reporter_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700684 "common/mock_http_fetcher.cc",
685 "common/prefs_unittest.cc",
686 "common/proxy_resolver_unittest.cc",
687 "common/subprocess_unittest.cc",
688 "common/terminator_unittest.cc",
689 "common/test_utils.cc",
690 "common/utils_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700691 "download_action_android_unittest.cc",
Jae Hoon Kim0ae8fe12019-06-26 14:32:50 -0700692 "libcurl_http_fetcher_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700693 "payload_consumer/bzip_extent_writer_unittest.cc",
694 "payload_consumer/cached_file_descriptor_unittest.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700695 "payload_consumer/certificate_parser_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700696 "payload_consumer/delta_performer_integration_test.cc",
697 "payload_consumer/delta_performer_unittest.cc",
698 "payload_consumer/extent_reader_unittest.cc",
699 "payload_consumer/extent_writer_unittest.cc",
700 "payload_consumer/fake_file_descriptor.cc",
701 "payload_consumer/file_descriptor_utils_unittest.cc",
702 "payload_consumer/file_writer_unittest.cc",
703 "payload_consumer/filesystem_verifier_action_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -0700704 "payload_consumer/partition_update_generator_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700705 "payload_consumer/postinstall_runner_action_unittest.cc",
706 "payload_consumer/verity_writer_android_unittest.cc",
707 "payload_consumer/xz_extent_writer_unittest.cc",
708 "payload_generator/ab_generator_unittest.cc",
709 "payload_generator/blob_file_writer_unittest.cc",
710 "payload_generator/block_mapping_unittest.cc",
711 "payload_generator/boot_img_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700712 "payload_generator/deflate_utils_unittest.cc",
713 "payload_generator/delta_diff_utils_unittest.cc",
714 "payload_generator/ext2_filesystem_unittest.cc",
715 "payload_generator/extent_ranges_unittest.cc",
716 "payload_generator/extent_utils_unittest.cc",
717 "payload_generator/fake_filesystem.cc",
718 "payload_generator/full_update_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700719 "payload_generator/mapfile_filesystem_unittest.cc",
Tianjie87af6c02020-08-11 15:06:26 -0700720 "payload_generator/merge_sequence_generator_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700721 "payload_generator/payload_file_unittest.cc",
722 "payload_generator/payload_generation_config_android_unittest.cc",
723 "payload_generator/payload_generation_config_unittest.cc",
Jae Hoon Kim4b6d1262019-06-20 10:41:18 -0700724 "payload_generator/payload_properties_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700725 "payload_generator/payload_signer_unittest.cc",
726 "payload_generator/squashfs_filesystem_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700727 "payload_generator/zip_unittest.cc",
728 "testrunner.cc",
Jae Hoon Kim916af852019-08-01 17:45:30 -0700729 "update_status_utils_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700730 ],
731}
732
733// Brillo update payload generation script
734// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100735sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700736 name: "brillo_update_payload",
737 device_supported: false,
738 host_supported: true,
739
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +0100740 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700741 required: [
742 "delta_generator",
743 "shflags",
744 "simg2img",
745 ],
746
747 target: {
748 darwin: {
749 enabled: false,
750 },
751 },
Colin Cross606913a2017-11-14 13:05:37 -0800752}
Yifan Hongd51738c2020-07-23 17:06:25 -0700753
754// update_engine header library
755cc_library_headers {
756 name: "libupdate_engine_headers",
757 export_include_dirs: ["."],
758 apex_available: [
759 "com.android.gki.*",
760 ],
David Andersonc1c93052020-08-26 18:22:09 +0000761 host_supported: true,
Yifan Hongd51738c2020-07-23 17:06:25 -0700762}