blob: 962a9a729533068dbec2064e8ab820f69d9a4cb6 [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
Bob Badour9b85a6c2021-02-12 21:28:32 -080018package {
19 default_applicable_licenses: ["system_update_engine_license"],
20}
21
22// Added automatically by a large-scale-change
23// See: http://go/android-license-faq
24license {
25 name: "system_update_engine_license",
26 visibility: [":__subpackages__"],
27 license_kinds: [
28 "SPDX-license-identifier-Apache-2.0",
29 ],
30 license_text: [
31 "NOTICE",
32 ],
33}
34
Colin Cross606913a2017-11-14 13:05:37 -080035filegroup {
36 name: "libupdate_engine_aidl",
37 srcs: [
38 "binder_bindings/android/os/IUpdateEngine.aidl",
39 "binder_bindings/android/os/IUpdateEngineCallback.aidl",
40 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070041 path: "binder_bindings",
42}
43
44cc_defaults {
45 name: "ue_defaults",
46
47 cflags: [
Amin Hassani2e4eda52019-01-07 14:01:17 -080048 "-DBASE_VER=576279",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070049 "-DUSE_HWID_OVERRIDE=0",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070050 "-D_FILE_OFFSET_BITS=64",
51 "-D_POSIX_C_SOURCE=199309L",
52 "-Wa,--noexecstack",
53 "-Wall",
54 "-Werror",
55 "-Wextra",
56 "-Wformat=2",
57 "-Wno-psabi",
58 "-Wno-unused-parameter",
59 "-ffunction-sections",
60 "-fstack-protector-strong",
61 "-fvisibility=hidden",
Kelvin Zhangc5803b72021-09-02 09:06:16 -070062 "-g3",
Dan Willemsenf5a904e2018-10-23 01:02:44 -070063 ],
64 cppflags: [
65 "-Wnon-virtual-dtor",
66 "-fno-strict-aliasing",
67 ],
68 include_dirs: ["system"],
69 local_include_dirs: ["client_library/include"],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -070070 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -070071 shared_libs: [
72 "libbrillo-stream",
73 "libbrillo",
74 "libchrome",
75 ],
76 ldflags: ["-Wl,--gc-sections"],
77
Dan Willemsenf5a904e2018-10-23 01:02:44 -070078 target: {
Sen Jiangb5f631d2018-12-18 16:59:57 -080079 android: {
80 cflags: [
81 "-DUSE_FEC=1",
82 ],
Kelvin Zhangb9a9aa22024-10-15 10:38:35 -070083 shared_libs: [
84 "libbase",
85 ],
Sen Jiangb5f631d2018-12-18 16:59:57 -080086 },
87 host: {
88 cflags: [
89 "-DUSE_FEC=0",
90 ],
91 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -070092 darwin: {
93 enabled: false,
94 },
95 },
96}
97
Kelvin Zhang9b10dba2020-09-25 17:09:11 -040098// libcow_operation_convert (type: library)
99// ========================================================
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500100cc_library_static {
101 name: "libpayload_extent_utils",
102 defaults: [
103 "ue_defaults",
104 ],
105 host_supported: true,
106 recovery_available: true,
107 srcs: [
108 "payload_generator/extent_utils.cc",
109 ],
110 static_libs: [
111 "update_metadata-protos",
112 ],
113}
114
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400115cc_library {
116 name: "libcow_operation_convert",
117 host_supported: true,
118 recovery_available: true,
119 defaults: [
120 "ue_defaults",
121 "update_metadata-protos_exports",
122 ],
123 srcs: [
124 "common/cow_operation_convert.cc",
125 ],
126 static_libs: [
127 "libsnapshot_cow",
128 "update_metadata-protos",
129 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500130 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400131 "libbrotli",
132 "libz",
133 ],
134}
135
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700136// update_metadata-protos (type: static_library)
137// ========================================================
138// Protobufs.
139cc_defaults {
140 name: "update_metadata-protos_exports",
141
142 shared_libs: ["libprotobuf-cpp-lite"],
143}
144
Devendra Singhi87484b02022-11-22 14:10:14 +0530145cc_defaults {
146 name: "update_metadata-protos-defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700147 host_supported: true,
Inseob Kim3cce62a2021-06-14 11:55:35 +0900148 ramdisk_available: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700149 recovery_available: true,
150
151 srcs: ["update_engine/update_metadata.proto"],
152 cflags: [
153 "-Wall",
154 "-Werror",
155 ],
156 proto: {
157 canonical_path_from_root: false,
158 export_proto_headers: true,
159 },
160}
161
Devendra Singhi87484b02022-11-22 14:10:14 +0530162cc_library_static {
163 name: "update_metadata-protos",
164 defaults: ["update_metadata-protos-defaults"],
165 proto: {
166 type: "lite",
167 },
168}
169
170cc_library_static {
171 name: "update_metadata-protos-full",
172 defaults: ["update_metadata-protos-defaults"],
173}
174
Kelvin Zhang73202a92022-06-02 10:19:54 -0700175python_library_host {
176 name: "update_metadata-protos-python",
177 srcs: ["update_metadata.proto"],
178 proto: {
179 canonical_path_from_root: false,
180 },
181}
182
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700183// libpayload_consumer (type: static_library)
184// ========================================================
185// The payload application component and common dependencies.
186cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530187 name: "libpayload_consumer_exports_defaults",
188 defaults: ["update_metadata-protos_exports",],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700189
190 static_libs: [
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700191 "libxz",
192 "libbz",
193 "libbspatch",
194 "libbrotli",
195 "libfec_rs",
196 "libpuffpatch",
197 "libverity_tree",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400198 "libsnapshot_cow",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400199 "libbrotli",
200 "libz",
201 "libpayload_extent_ranges",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500202 "libpayload_extent_utils",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400203 "libcow_operation_convert",
Kelvin Zhang55624032021-12-20 12:13:24 -0800204 "lz4diff-protos",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800205 "liblz4patch",
Kelvin Zhang27757a22023-02-15 16:58:27 -0800206 "libzstd",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700207 ],
208 shared_libs: [
209 "libbase",
210 "libcrypto",
Sen Jiangb5f631d2018-12-18 16:59:57 -0800211 "libfec",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800212 "liblz4",
Tianjie99d570d2020-06-04 14:57:19 -0700213 "libziparchive",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700214 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700215}
216
Devendra Singhi87484b02022-11-22 14:10:14 +0530217cc_defaults {
218 name: "libpayload_consumer_exports",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700219 defaults: [
Devendra Singhi87484b02022-11-22 14:10:14 +0530220 "libpayload_consumer_exports_defaults"
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700221 ],
Devendra Singhi87484b02022-11-22 14:10:14 +0530222 static_libs: ["update_metadata-protos",],
223}
224
225cc_defaults {
226 name: "libpayload_consumer_exports_proto-full",
227 defaults: [
228 "libpayload_consumer_exports_defaults"
229 ],
230 static_libs: ["update_metadata-protos-full",],
231}
232
233cc_defaults {
234 name: "libpayload_consumer_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700235 host_supported: true,
236 recovery_available: true,
237
238 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700239 "aosp/platform_constants_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700240 "common/action_processor.cc",
241 "common/boot_control_stub.cc",
242 "common/clock.cc",
243 "common/constants.cc",
244 "common/cpu_limiter.cc",
Yifan Hongdaac7322019-11-07 10:48:26 -0800245 "common/dynamic_partition_control_stub.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700246 "common/error_code_utils.cc",
247 "common/file_fetcher.cc",
248 "common/hash_calculator.cc",
249 "common/http_common.cc",
250 "common/http_fetcher.cc",
251 "common/hwid_override.cc",
252 "common/multi_range_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700253 "common/prefs.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700254 "common/subprocess.cc",
255 "common/terminator.cc",
256 "common/utils.cc",
257 "payload_consumer/bzip_extent_writer.cc",
258 "payload_consumer/cached_file_descriptor.cc",
Tianjie Xu7a78d632019-10-08 16:32:39 -0700259 "payload_consumer/certificate_parser_android.cc",
Kelvin Zhang569c97e2020-10-26 12:12:24 -0400260 "payload_consumer/cow_writer_file_descriptor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700261 "payload_consumer/delta_performer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700262 "payload_consumer/extent_reader.cc",
263 "payload_consumer/extent_writer.cc",
264 "payload_consumer/file_descriptor.cc",
265 "payload_consumer/file_descriptor_utils.cc",
266 "payload_consumer/file_writer.cc",
267 "payload_consumer/filesystem_verifier_action.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -0500268 "payload_consumer/install_operation_executor.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700269 "payload_consumer/install_plan.cc",
270 "payload_consumer/mount_history.cc",
271 "payload_consumer/payload_constants.cc",
272 "payload_consumer/payload_metadata.cc",
273 "payload_consumer/payload_verifier.cc",
Kelvin Zhang50bac652020-09-28 15:51:41 -0400274 "payload_consumer/partition_writer.cc",
Kelvin Zhang94f51cc2020-09-25 11:34:49 -0400275 "payload_consumer/partition_writer_factory_android.cc",
276 "payload_consumer/vabc_partition_writer.cc",
Kelvin Zhang4bb49202021-07-08 21:39:05 -0400277 "payload_consumer/xor_extent_writer.cc",
Kelvin Zhangb1706762021-06-25 15:05:22 -0400278 "payload_consumer/block_extent_writer.cc",
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400279 "payload_consumer/snapshot_extent_writer.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700280 "payload_consumer/postinstall_runner_action.cc",
Kelvin Zhangab3ce602021-02-24 14:46:40 -0500281 "payload_consumer/verified_source_fd.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700282 "payload_consumer/verity_writer_android.cc",
283 "payload_consumer/xz_extent_writer.cc",
284 "payload_consumer/fec_file_descriptor.cc",
Tianjied3865d12020-06-03 15:25:17 -0700285 "payload_consumer/partition_update_generator_android.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700286 "update_status_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700287 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700288}
289
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000290cc_library_static {
Devendra Singhi87484b02022-11-22 14:10:14 +0530291 name: "libpayload_consumer",
292 defaults: [
293 "ue_defaults",
294 "libpayload_consumer_exports",
295 "libpayload_consumer_defaults",
296 ],
297}
298
299cc_library_static {
300 name: "libpayload_consumer_proto-full",
301 defaults: [
302 "ue_defaults",
303 "libpayload_consumer_exports_proto-full",
304 "libpayload_consumer_defaults",
305 ],
306}
307
308cc_library_static {
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000309 name: "libstatslog_ue",
310 generated_sources: ["statslog_ue.cpp"],
311 generated_headers: ["statslog_ue.h"],
312 export_generated_headers: ["statslog_ue.h"],
313 shared_libs: [
314 "libstatssocket",
315 ]
316}
317
318genrule {
319 name: "statslog_ue.h",
320 tools: ["stats-log-api-gen"],
321 cmd: "$(location stats-log-api-gen) --header $(genDir)/statslog_ue.h --module update_engine --namespace chromeos_update_engine,statsd",
322 out: [
323 "statslog_ue.h",
324 ],
325}
326
327genrule {
328 name: "statslog_ue.cpp",
329 tools: ["stats-log-api-gen"],
330 cmd: "$(location stats-log-api-gen) --cpp $(genDir)/statslog_ue.cpp --module update_engine --namespace chromeos_update_engine,statsd --importHeader statslog_ue.h",
331 out: [
332 "statslog_ue.cpp",
333 ],
334}
335
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700336// libupdate_engine_boot_control (type: static_library)
337// ========================================================
338// A BootControl class implementation using Android's HIDL boot_control HAL.
339cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530340 name: "libupdate_engine_boot_control_exports_defaults",
341 defaults: ["update_metadata-protos_exports",],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700342
Yifan Hong420db9b2019-07-23 20:50:33 -0700343 static_libs: [
David Andersone7ce8212019-12-16 20:13:19 -0800344 "libcutils",
345 "libfs_mgr_binder",
346 "libgsi",
David Anderson8f2f5292023-08-03 12:28:38 -0700347 "libsnapshot_static",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000348 "libstatslog_ue",
David Anderson6c190a22020-09-21 17:09:53 -0700349 "libz",
Yifan Hong420db9b2019-07-23 20:50:33 -0700350 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700351 shared_libs: [
352 "libbootloader_message",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700353 "libhidlbase",
354 "liblp",
355 "libutils",
356 "android.hardware.boot@1.0",
David Anderson2111d062019-10-15 22:36:27 -0700357 "android.hardware.boot@1.1",
Kelvin Zhangcb419e62021-06-16 13:56:47 -0400358 "android.hardware.boot@1.2",
Kelvin Zhang8251dc02022-06-14 09:46:46 -0700359 "android.hardware.boot-V1-ndk",
Kelvin Zhange9c1d372022-06-13 15:40:44 -0700360 "libboot_control_client",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700361 ],
Yifan Hong29692902020-03-26 12:47:05 -0700362 header_libs: [
363 "avb_headers",
364 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700365 target: {
366 recovery: {
David Andersone7ce8212019-12-16 20:13:19 -0800367 static_libs: [
368 "libfs_mgr",
369 "libsnapshot_nobinder",
370 ],
371 exclude_static_libs: [
372 "libfs_mgr_binder",
David Anderson8f2f5292023-08-03 12:28:38 -0700373 "libsnapshot_static",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000374 "libstatslog_ue"
Yifan Hong212d7952020-02-04 11:08:08 -0800375 ],
Yifan Hong420db9b2019-07-23 20:50:33 -0700376 },
377 },
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700378}
379
Devendra Singhi87484b02022-11-22 14:10:14 +0530380cc_defaults {
381 name: "libupdate_engine_boot_control_exports",
382 defaults: [
383 "libupdate_engine_boot_control_exports_defaults",
384 ],
385 static_libs: [
386 "libpayload_consumer",
387 "update_metadata-protos",
388 ]
389}
390
391cc_defaults {
392 name: "libupdate_engine_boot_control_exports_proto-full",
393 defaults: [
394 "libupdate_engine_boot_control_exports_defaults",
395 ],
396 static_libs: [
397 "libpayload_consumer_proto-full",
398 "update_metadata-protos-full",
399 ]
400}
401
402cc_defaults {
403 name: "libupdate_engine_boot_control_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700404 defaults: [
405 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700406 ],
407 recovery_available: true,
408
409 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700410 "aosp/boot_control_android.cc",
411 "aosp/cleanup_previous_update_action.cc",
412 "aosp/dynamic_partition_control_android.cc",
413 "aosp/dynamic_partition_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700414 ],
415}
416
Devendra Singhi87484b02022-11-22 14:10:14 +0530417cc_library_static {
418 name: "libupdate_engine_boot_control",
419 defaults: [
420 "libupdate_engine_boot_control_defaults",
421 "libupdate_engine_boot_control_exports",
422 "libpayload_consumer_exports",
423 ],
424}
425
426cc_library_static {
Nikita Putikhine788f952024-03-11 19:21:24 +0100427 name: "libupdate_engine_boot_control_nostats",
428 cflags: ["-DUE_DISABLE_STATS"],
429 defaults: [
430 "libupdate_engine_boot_control_defaults",
431 "libupdate_engine_boot_control_exports",
432 "libpayload_consumer_exports",
433 ],
434}
435
436cc_library_static {
Devendra Singhi87484b02022-11-22 14:10:14 +0530437 name: "libupdate_engine_boot_control_proto-full",
438 defaults: [
439 "libupdate_engine_boot_control_defaults",
440 "libupdate_engine_boot_control_exports_proto-full",
441 "libpayload_consumer_exports_proto-full",
442 ],
443}
444
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700445// libupdate_engine_android (type: static_library)
446// ========================================================
447// The main daemon static_library used in Android (non-Brillo). This only has a
448// loop to apply payloads provided by the upper layer via a Binder interface.
449cc_defaults {
Devendra Singhi87484b02022-11-22 14:10:14 +0530450 name: "libupdate_engine_android_exports_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700451 defaults: [
452 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700453 ],
454
455 static_libs: [
Tianjie838793d2021-01-14 22:05:13 -0800456 "libavb",
457 "libavb_user",
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000458 "libgkiprops",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000459 "libstatslog_ue",
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000460 "libPlatformProperties",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700461 ],
462 shared_libs: [
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000463 "apex_aidl_interface-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700464 "libandroid_net",
465 "libbase",
466 "libbinder",
467 "libbinderwrapper",
468 "libbootloader_message",
469 "libbrillo-binder",
470 "libcurl",
471 "libcutils",
Pawan Wagh39fe9822024-01-03 17:03:16 +0000472 "libupdate_engine_stable-V2-cpp",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700473 "liblog",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700474 "libssl",
Vova Sharaienkod62c81b2022-09-21 05:32:43 +0000475 "libstatssocket",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700476 "libutils",
477 ],
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100478 whole_static_libs: [
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000479 "libcom.android.sysprop.apex",
Nikita Ioffeaedfef32021-04-28 13:54:14 +0100480 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700481}
482
Devendra Singhi87484b02022-11-22 14:10:14 +0530483cc_defaults {
484 name: "libupdate_engine_android_exports",
485 defaults: [
486 "libupdate_engine_android_exports_defaults",
487 "libupdate_engine_boot_control_exports",
488 "libpayload_consumer_exports",
489 ],
490 static_libs: [
491 "libpayload_consumer",
492 "libupdate_engine_boot_control",
493 ],
494}
495
496cc_defaults {
497 name: "libupdate_engine_android_exports_proto-full",
498 defaults: [
499 "libupdate_engine_android_exports_defaults",
500 "libupdate_engine_boot_control_exports_proto-full",
501 "libpayload_consumer_exports_proto-full",
502 ],
503 static_libs: [
504 "libpayload_consumer_proto-full",
505 "libupdate_engine_boot_control_proto-full",
506 ],
507}
508
Brian Daniels6d8a94d2024-10-02 17:16:49 -0400509aidl_interface {
510 name: "libupdate_engine_aidl_interface",
511 srcs: [
512 ":libupdate_engine_aidl",
513 ],
514 backend: {
515 cpp: {
516 enabled: false,
517 },
518 java: {
519 enabled: false,
520 },
521 ndk: {
522 enabled: false,
523 },
524 rust: {
525 enabled: true,
526 },
527 },
528 frozen: false,
529 unstable: true,
530}
531
Devendra Singhi87484b02022-11-22 14:10:14 +0530532cc_defaults {
533 name: "libupdate_engine_android_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700534 defaults: [
535 "ue_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700536 ],
537
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700538 aidl: {
539 local_include_dirs: ["binder_bindings"],
540 export_aidl_headers: true,
541 },
542
543 srcs: [
544 ":libupdate_engine_aidl",
Amin Hassani538bd592020-11-04 20:46:08 -0800545 "common/system_state.cc",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +0000546 "aosp/apex_handler_android.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700547 "aosp/binder_service_android.cc",
548 "aosp/binder_service_stable_android.cc",
549 "aosp/daemon_android.cc",
550 "aosp/daemon_state_android.cc",
551 "aosp/hardware_android.cc",
552 "aosp/logging_android.cc",
553 "aosp/network_selector_android.cc",
554 "aosp/update_attempter_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700555 "certificate_checker.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800556 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700557 "libcurl_http_fetcher.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700558 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700559 "update_boot_flags_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700560 ],
561}
562
Devendra Singhi87484b02022-11-22 14:10:14 +0530563cc_library_static {
564 name: "libupdate_engine_android",
565 defaults: [
566 "libupdate_engine_android_defaults",
567 "libupdate_engine_android_exports",
568 ]
569}
570
571cc_library_static {
572 name: "libupdate_engine_android_proto-full",
573 defaults: [
574 "libupdate_engine_android_defaults",
575 "libupdate_engine_android_exports_proto-full",
576 ]
577}
578
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700579// update_engine (type: executable)
580// ========================================================
581// update_engine daemon.
582cc_binary {
583 name: "update_engine",
584 defaults: [
585 "ue_defaults",
586 "libupdate_engine_android_exports",
587 ],
588
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700589 static_libs: [
590 "libupdate_engine_android",
591 "libgflags",
592 ],
Tao Bao1e1c86c2019-04-18 10:48:32 -0700593 required: [
Darren Krahn03c7be52023-11-30 15:40:12 -0800594 "cacerts",
Tianjie Xube4ea232019-10-15 18:08:31 -0700595 "otacerts",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700596 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700597
Amin Hassaniec7bc112020-10-29 16:47:58 -0700598 srcs: ["main.cc", "aosp/metrics_reporter_android.cc"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700599 init_rc: ["update_engine.rc"],
600}
601
Nikita Putikhine788f952024-03-11 19:21:24 +0100602// update_engine_nostats (type: executable)
603// ========================================================
604// update_engine daemon version without the stats integration.
605cc_binary {
606 name: "update_engine_nostats",
607 defaults: [
608 "ue_defaults",
609 "libupdate_engine_android_exports",
610 ],
611
612 static_libs: [
613 "libupdate_engine_android",
614 "libgflags",
615 "libupdate_engine_boot_control_nostats",
616 ],
617 required: [
618 "cacerts",
619 "otacerts",
620 ],
621
622 exclude_static_libs: [
623 "libstatslog_ue",
624 "libupdate_engine_boot_control"
625 ],
626
627 exclude_shared_libs: [
628 "libstatssocket",
629 ],
630
631 cflags: ["-DUE_DISABLE_STATS"],
632 srcs: [
633 "main.cc",
634 "common/metrics_reporter_stub.cc",
635 ],
636 init_rc: ["update_engine_nostats.rc"],
637}
638
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700639// update_engine_sideload (type: executable)
640// ========================================================
641// A binary executable equivalent to update_engine daemon that installs an update
642// from a local file directly instead of running in the background. Used in
643// recovery image.
644cc_binary {
645 name: "update_engine_sideload",
646 defaults: [
647 "ue_defaults",
648 "update_metadata-protos_exports",
649 "libupdate_engine_boot_control_exports",
650 "libpayload_consumer_exports",
651 ],
652 recovery: true,
653
Nikita Putikhine788f952024-03-11 19:21:24 +0100654 cflags: [
655 "-D_UE_SIDELOAD",
656 "-DUE_DISABLE_STATS",
657 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -0700658 header_libs: ["libgtest_prod_headers"],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700659
660 srcs: [
Amin Hassaniec7bc112020-10-29 16:47:58 -0700661 "aosp/hardware_android.cc",
662 "aosp/logging_android.cc",
663 "aosp/sideload_main.cc",
664 "aosp/update_attempter_android.cc",
665 "common/metrics_reporter_stub.cc",
666 "common/network_selector_stub.cc",
Amin Hassani538bd592020-11-04 20:46:08 -0800667 "common/system_state.cc",
668 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700669 "metrics_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700670 "update_boot_flags_action.cc",
671 "update_status_utils.cc",
672 ],
673
674 // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out,
675 // as it doesn't look beneficial to be installed separately due to its size. Note
676 // that we explicitly request their recovery variants, so that the expected files
677 // will be used and installed.
678 shared_libs: [
679 "libbase",
680 "liblog",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800681 "liblz4",
Kelvin Zhang0dfaf402023-10-31 17:26:58 -0700682 "libprotobuf-cpp-lite",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700683 ],
684 static_libs: [
685 "libpayload_consumer",
686 "libupdate_engine_boot_control",
687 "update_metadata-protos",
688
689 // We add the static versions of the shared libraries that are not installed to
690 // recovery image due to size concerns. Need to include all the static library
691 // dependencies of these static libraries.
Trevor Radcliffee877eac2022-06-08 14:10:21 +0000692 "libgkiprops",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700693 "libevent",
694 "libmodpb64",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700695 "libbrillo-stream",
696 "libbrillo",
697 "libchrome",
698 ],
699 target: {
700 recovery: {
701 exclude_shared_libs: [
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700702 "libbrillo-stream",
703 "libbrillo",
704 "libchrome",
705 ],
706 },
707 },
708
Tao Bao1e1c86c2019-04-18 10:48:32 -0700709 required: [
Tianjie Xube4ea232019-10-15 18:08:31 -0700710 "otacerts.recovery",
Tao Bao1e1c86c2019-04-18 10:48:32 -0700711 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700712}
713
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700714// update_engine_client (type: executable)
715// ========================================================
716// update_engine console client.
717cc_binary {
718 name: "update_engine_client",
719 defaults: ["ue_defaults"],
720
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700721 shared_libs: [
722 "libbinder",
723 "libbinderwrapper",
724 "libbrillo-binder",
725 "libutils",
726 ],
727
728 aidl: {
729 local_include_dirs: ["binder_bindings"],
730 },
731
732 srcs: [
733 ":libupdate_engine_aidl",
Amin Hassaniec7bc112020-10-29 16:47:58 -0700734 "aosp/update_engine_client_android.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700735 "common/error_code_utils.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700736 "update_status_utils.cc",
737 ],
738}
739
740// libpayload_generator (type: static_library)
741// ========================================================
742// server-side code. This is used for delta_generator and unittests but not
743// for any client code.
744cc_defaults {
745 name: "libpayload_generator_exports",
746 defaults: [
747 "libpayload_consumer_exports",
748 "update_metadata-protos_exports",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800749 "erofs-utils_export_defaults",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700750 ],
751
Tianjie37ae8562020-03-25 15:16:01 -0700752 header_libs: [
753 "bootimg_headers",
754 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700755 static_libs: [
756 "libavb",
757 "libbrotli",
758 "libbsdiff",
759 "libdivsufsort",
760 "libdivsufsort64",
761 "liblzma",
762 "libpayload_consumer",
763 "libpuffdiff",
Tianjiea69cfe22021-08-22 23:28:44 -0700764 "libzucchini",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700765 "libverity_tree",
766 "update_metadata-protos",
Kelvin Zhangeb8703b2020-12-10 14:17:21 -0500767 "libpayload_extent_utils",
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500768 "libcow_size_estimator",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800769 "liberofs",
Kelvin Zhang702ce4c2022-07-14 10:43:22 -0700770 "libselinux",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800771 "lz4diff-protos",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800772 "liblz4diff",
Kelvin Zhang27757a22023-02-15 16:58:27 -0800773 "libzstd",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700774 ],
775 shared_libs: [
776 "libbase",
777 "libext2fs",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800778 // LZ4 has to be a shared lib, as we want to override it with
779 // LD_LIBRARY_PRELOAD later
780 "liblz4",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700781 ],
782}
783
784cc_library_static {
David Andersonc1c93052020-08-26 18:22:09 +0000785 name: "libpayload_extent_ranges",
786 defaults: [
787 "ue_defaults",
788 ],
789 host_supported: true,
Kelvin Zhang9b10dba2020-09-25 17:09:11 -0400790 recovery_available: true,
David Andersonc1c93052020-08-26 18:22:09 +0000791 srcs: [
792 "payload_generator/extent_ranges.cc",
793 ],
794 static_libs: [
795 "update_metadata-protos",
796 ],
797}
798
799cc_library_static {
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500800 name: "libcow_size_estimator",
801 defaults: [
802 "ue_defaults",
803 "update_metadata-protos_exports"
804 ],
805 host_supported: true,
806 recovery_available: true,
807 srcs: [
808 "payload_generator/cow_size_estimator.cc",
809 ],
810 static_libs: [
811 "update_metadata-protos",
812 "libbase",
813 "libsnapshot_cow",
814 "libcow_operation_convert",
815 ],
816}
817
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800818cc_defaults {
819 name: "liblz4diff_defaults",
820 static_libs: [
821 "lz4diff-protos",
822 "update_metadata-protos",
823 "libssl",
824 "libbsdiff",
825 "libpuffdiff",
826 ],
827 shared_libs: [
828 "liblz4",
Kelvin Zhang893b3a12021-12-30 12:28:53 -0800829 ],
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800830}
831
832cc_library_static {
833 name: "liblz4diff",
834 host_supported: true,
835 defaults: ["ue_defaults", "liblz4diff_defaults"],
836 srcs: [
Kelvin Zhang893b3a12021-12-30 12:28:53 -0800837 "lz4diff/lz4diff.cc",
Kelvin Zhang4eae81e2021-12-09 17:07:17 -0800838 "lz4diff/lz4diff_compress.cc",
839 ],
840}
841
842cc_library_static {
843 name: "liblz4patch",
844 host_supported: true,
845 recovery_available: true,
846 defaults: ["ue_defaults"],
847 static_libs: [
848 "lz4diff-protos",
849 "update_metadata-protos",
850 "libssl",
851 "libbspatch",
852 "libpuffpatch",
853 ],
854 shared_libs: [
855 "liblz4",
856 ],
857 srcs: [
858 "lz4diff/lz4patch.cc",
859 "lz4diff/lz4diff_compress.cc",
860 ],
861}
862
Kelvin Zhang35cff4f2021-12-08 16:06:00 -0800863cc_binary_host {
864 name: "lz4diff",
865 defaults: [
866 "ue_defaults",
867 "libpayload_generator_exports",
868 ],
869 static_libs: [
870 "libpayload_generator",
871 "liblz4diff",
872 "liblz4patch",
873 ],
874 srcs: [
875 "lz4diff/lz4diff_main.cc",
876 ],
877}
878
Kelvin Zhangb93055f2021-02-03 14:22:35 -0500879cc_library_static {
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700880 name: "libpayload_generator",
881 defaults: [
882 "ue_defaults",
883 "libpayload_generator_exports",
884 ],
885 host_supported: true,
886
887 srcs: [
Amin Hassani538bd592020-11-04 20:46:08 -0800888 "common/system_state.cc",
889 "download_action.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700890 "payload_generator/ab_generator.cc",
891 "payload_generator/annotated_operation.cc",
892 "payload_generator/blob_file_writer.cc",
893 "payload_generator/block_mapping.cc",
894 "payload_generator/boot_img_filesystem.cc",
895 "payload_generator/bzip.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700896 "payload_generator/deflate_utils.cc",
897 "payload_generator/delta_diff_generator.cc",
898 "payload_generator/delta_diff_utils.cc",
899 "payload_generator/ext2_filesystem.cc",
Kelvin Zhang446989a2021-12-08 13:49:07 -0800900 "payload_generator/erofs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700901 "payload_generator/extent_ranges.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700902 "payload_generator/full_update_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700903 "payload_generator/mapfile_filesystem.cc",
Tianjiee9156ec2020-08-11 11:13:54 -0700904 "payload_generator/merge_sequence_generator.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700905 "payload_generator/payload_file.cc",
906 "payload_generator/payload_generation_config_android.cc",
907 "payload_generator/payload_generation_config.cc",
Amin Hassani79821002019-05-06 17:40:49 -0700908 "payload_generator/payload_properties.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700909 "payload_generator/payload_signer.cc",
910 "payload_generator/raw_filesystem.cc",
911 "payload_generator/squashfs_filesystem.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700912 "payload_generator/xz_android.cc",
913 ],
914}
915
916// delta_generator (type: executable)
917// ========================================================
918// server-side delta generator.
919cc_binary_host {
920 name: "delta_generator",
921 defaults: [
922 "ue_defaults",
923 "libpayload_generator_exports",
924 "libpayload_consumer_exports",
925 ],
926
927 static_libs: [
928 "libavb_host_sysdeps",
929 "libpayload_consumer",
930 "libpayload_generator",
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700931 "libgflags",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700932 ],
933
934 srcs: ["payload_generator/generate_delta_main.cc"],
935}
936
937cc_test {
Kelvin Zhangc5803b72021-09-02 09:06:16 -0700938 host_supported: true,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700939 name: "ue_unittest_delta_generator",
940 defaults: [
941 "ue_defaults",
942 "libpayload_generator_exports",
943 "libpayload_consumer_exports",
944 ],
945
946 static_libs: [
947 "libpayload_consumer",
948 "libpayload_generator",
Kelvin Zhang77cb1c62023-03-31 20:34:52 -0700949 "libgflags",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700950 ],
951
952 srcs: ["payload_generator/generate_delta_main.cc"],
953
954 gtest: false,
955 stem: "delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700956}
957
958// test_http_server (type: executable)
959// ========================================================
960// Test HTTP Server.
961cc_test {
962 name: "test_http_server",
963 defaults: ["ue_defaults"],
964 srcs: [
965 "common/http_common.cc",
966 "test_http_server.cc",
967 ],
968
969 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700970}
971
972// test_subprocess (type: executable)
973// ========================================================
974// Test helper subprocess program.
975cc_test {
976 name: "test_subprocess",
977 defaults: ["ue_defaults"],
978 srcs: ["test_subprocess.cc"],
979
980 gtest: false,
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700981}
982
983// Public keys for unittests.
984// ========================================================
985genrule {
986 name: "ue_unittest_keys",
987 cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" +
xunchangcda3c032019-03-26 15:41:14 -0700988 "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" +
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700989 "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" +
990 "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700991 srcs: [
992 "unittest_key.pem",
993 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -0700994 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -0700995 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -0700996 ],
997 out: [
998 "unittest_key.pub.pem",
999 "unittest_key2.pub.pem",
xunchangcda3c032019-03-26 15:41:14 -07001000 "unittest_key_RSA4096.pub.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -07001001 "unittest_key_EC.pub.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001002 ],
1003}
1004
1005// Sample images for unittests.
1006// ========================================================
1007// Extract sample image from the compressed sample_images.tar.bz2 file used by
1008// the unittests.
1009genrule {
1010 name: "ue_unittest_disk_imgs",
1011 cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img",
1012 srcs: ["sample_images/sample_images.tar.bz2"],
1013 out: [
1014 "gen/disk_ext2_1k.img",
1015 "gen/disk_ext2_4k.img",
1016 "gen/disk_ext2_4k_empty.img",
1017 "gen/disk_ext2_unittest.img",
1018 ],
1019}
1020
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001021genrule {
1022 name: "ue_unittest_erofs_imgs",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001023 cmd: "$(in) $(location mkfs.erofs) $(location gen/erofs_empty.img) && " +
1024 "$(in) $(location mkfs.erofs) $(location gen/erofs.img) $(location delta_generator) && " +
1025 "$(in) $(location mkfs.erofs) $(location gen/erofs_new.img) $(location delta_generator) lz4hc,7",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001026 srcs: ["sample_images/generate_test_erofs_images.sh"],
1027 out: [
1028 "gen/erofs.img",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001029 "gen/erofs_new.img",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001030 "gen/erofs_empty.img",
1031 ],
1032 tools: [
1033 "mkfs.erofs",
1034 "delta_generator",
1035 ],
1036}
1037
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001038filegroup {
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001039 name: "update_engine_host_unittest_timeout_srcs",
1040 srcs: [
1041 "common/action_processor_unittest.cc",
1042 "common/file_fetcher_unittest.cc",
1043 "payload_generator/delta_diff_utils_unittest.cc",
1044 ],
1045}
1046
1047filegroup {
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001048 name: "update_engine_host_unittest_srcs",
1049 srcs: [
1050 "common/action_pipe_unittest.cc",
1051 "common/action_processor_unittest.cc",
1052 "common/action_unittest.cc",
1053 "common/cow_operation_convert_unittest.cc",
1054 "common/cpu_limiter_unittest.cc",
1055 "common/fake_prefs.cc",
1056 "common/file_fetcher_unittest.cc",
1057 "common/hash_calculator_unittest.cc",
1058 "common/hwid_override_unittest.cc",
1059 "common/metrics_reporter_stub.cc",
1060 "common/mock_http_fetcher.cc",
1061 "common/prefs_unittest.cc",
1062 "common/terminator_unittest.cc",
1063 "common/test_utils.cc",
Kelvin Zhang55624032021-12-20 12:13:24 -08001064 "lz4diff/lz4diff_compress_unittest.cc",
Kelvin Zhang893b3a12021-12-30 12:28:53 -08001065 "lz4diff/lz4diff_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001066 "payload_generator/ab_generator_unittest.cc",
1067 "payload_generator/blob_file_writer_unittest.cc",
1068 "payload_generator/block_mapping_unittest.cc",
1069 "payload_generator/boot_img_filesystem_unittest.cc",
1070 "payload_generator/deflate_utils_unittest.cc",
1071 "payload_generator/delta_diff_utils_unittest.cc",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001072 "payload_generator/erofs_filesystem_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001073 "payload_generator/ext2_filesystem_unittest.cc",
1074 "payload_generator/extent_ranges_unittest.cc",
1075 "payload_generator/extent_utils_unittest.cc",
1076 "payload_generator/fake_filesystem.cc",
1077 "payload_generator/full_update_generator_unittest.cc",
1078 "payload_generator/mapfile_filesystem_unittest.cc",
1079 "payload_generator/merge_sequence_generator_unittest.cc",
1080 "payload_generator/payload_file_unittest.cc",
1081 "payload_generator/payload_generation_config_android_unittest.cc",
1082 "payload_generator/payload_generation_config_unittest.cc",
1083 "payload_generator/payload_properties_unittest.cc",
1084 "payload_generator/payload_signer_unittest.cc",
1085 "payload_generator/squashfs_filesystem_unittest.cc",
1086 "payload_generator/zip_unittest.cc",
Kelvin Zhange4bffe62022-03-07 09:08:38 -08001087 "payload_consumer/verity_writer_android_unittest.cc",
1088 "payload_consumer/xz_extent_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001089 "testrunner.cc",
1090 ],
1091}
1092
1093cc_test_host {
1094 name: "update_engine_host_unittests",
1095 defaults: [
1096 "ue_defaults",
1097 "libpayload_generator_exports",
1098 ],
1099 strip: {
1100 none: true,
1101 },
1102 cflags: [
1103 "-g3",
1104 ],
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001105 tidy_timeout_srcs: [":update_engine_host_unittest_timeout_srcs"],
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001106 srcs: [":update_engine_host_unittest_srcs"],
1107 data: [
1108 ":ue_unittest_delta_generator",
1109 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001110 ":ue_unittest_erofs_imgs",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001111 ":ue_unittest_keys",
1112 "otacerts.zip",
1113 "unittest_key.pem",
1114 "unittest_key2.pem",
1115 "unittest_key_RSA4096.pem",
1116 "unittest_key_EC.pem",
1117 "update_engine.conf",
Kelvin Zhanga35324f2023-06-28 10:29:16 -07001118 "testdata/cycle_nodes_product.bin",
1119 "testdata/cycle_nodes_product_no_xor.bin",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001120 ],
1121 static_libs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001122 "libgmock",
1123 "libpayload_generator",
1124 ],
1125}
1126
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001127// update_engine_unittests (type: executable)
1128// ========================================================
1129// Main unittest file.
1130cc_test {
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001131 name: "update_engine_http_unittests",
1132 defaults: [
1133 "ue_defaults",
1134 "liblz4diff_defaults",
1135 "update_metadata-protos_exports",
1136 ],
1137 require_root: true,
1138 static_libs: [
1139 "libbase",
1140 "libbrillo-test-helpers",
1141 "libchrome_test_helpers",
1142 "libcurl",
1143 "libcutils",
1144 "libdm",
1145 "libgmock",
1146 "libz",
Kelvin Zhang27757a22023-02-15 16:58:27 -08001147 "libzstd",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001148 ],
1149 shared_libs: [
1150 "libssl",
1151 "libcrypto",
1152 "libziparchive",
1153 "liblog",
1154 ],
1155
1156 data: [
1157 ":test_http_server",
1158 ":test_subprocess",
1159 ":ue_unittest_keys",
1160 "otacerts.zip",
1161 "unittest_key.pem",
1162 "unittest_key2.pem",
1163 "unittest_key_RSA4096.pem",
1164 "unittest_key_EC.pem",
1165 ],
1166
1167 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
1168 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
1169 // test_config: "test_config.xml",
1170 test_suites: ["device-tests"],
1171
1172 srcs: [
1173 "aosp/platform_constants_android.cc",
1174 "certificate_checker.cc",
1175 "common/action_processor.cc",
1176 "common/boot_control_stub.cc",
1177 "common/error_code_utils.cc",
1178 "common/file_fetcher.cc",
1179 "common/hash_calculator.cc",
1180 "common/http_fetcher.cc",
1181 "common/multi_range_http_fetcher.cc",
1182 "common/http_common.cc",
1183 "common/subprocess.cc",
1184 "common/test_utils.cc",
1185 "common/utils.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001186 "libcurl_http_fetcher.cc",
1187 "payload_consumer/certificate_parser_android.cc",
1188 "payload_consumer/payload_verifier.cc",
1189 "payload_generator/payload_signer.cc",
1190 "update_status_utils.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001191 "certificate_checker_unittest.cc",
1192 "common/http_fetcher_unittest.cc",
1193 "common/mock_http_fetcher.cc",
Kelvin Zhang7e5b4052022-03-22 12:17:59 -07001194 "common/subprocess_unittest.cc",
1195 "libcurl_http_fetcher_unittest.cc",
1196 "payload_consumer/certificate_parser_android_unittest.cc",
1197 "update_status_utils_unittest.cc",
1198 ],
1199}
1200
1201// update_engine_unittests (type: executable)
1202// ========================================================
1203// Main unittest file.
1204cc_test {
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001205 name: "update_engine_unittests",
1206 defaults: [
1207 "ue_defaults",
1208 "libpayload_generator_exports",
1209 "libupdate_engine_android_exports",
1210 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001211
1212 static_libs: [
1213 "libpayload_generator",
1214 "libbrillo-test-helpers",
1215 "libgmock",
1216 "libchrome_test_helpers",
1217 "libupdate_engine_android",
Tianjie Xu173e6192019-12-10 10:56:01 -08001218 "libdm",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001219 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001220
Yifan Hong87ea73f2019-09-12 13:07:37 -07001221 header_libs: [
1222 "libstorage_literals_headers",
1223 ],
1224
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001225 data: [
Tao Bao9456b6f2019-04-29 18:14:58 -07001226 ":ue_unittest_delta_generator",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001227 ":ue_unittest_disk_imgs",
Kelvin Zhang759e8b92021-12-21 16:46:58 -08001228 ":ue_unittest_erofs_imgs",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001229 ":ue_unittest_keys",
Tianjie Xu7a78d632019-10-08 16:32:39 -07001230 "otacerts.zip",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001231 "unittest_key.pem",
1232 "unittest_key2.pem",
xunchangcda3c032019-03-26 15:41:14 -07001233 "unittest_key_RSA4096.pem",
Tianjie Xu7bbe0152019-10-09 18:11:15 -07001234 "unittest_key_EC.pem",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001235 "update_engine.conf",
Kelvin Zhanga35324f2023-06-28 10:29:16 -07001236 "testdata/cycle_nodes_product.bin",
1237 "testdata/cycle_nodes_product_no_xor.bin",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001238 ],
1239
Tao Bao9456b6f2019-04-29 18:14:58 -07001240 // We cannot use the default generated AndroidTest.xml because of the use of helper modules
1241 // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator).
1242 test_config: "test_config.xml",
1243 test_suites: ["device-tests"],
1244
Chih-Hung Hsieh85ad1472022-02-17 17:32:12 -08001245 tidy_timeout_srcs: [
1246 ":update_engine_host_unittest_timeout_srcs",
1247 "aosp/dynamic_partition_control_android_unittest.cc",
1248 "common/http_fetcher_unittest.cc",
1249 "payload_consumer/delta_performer_integration_test.cc",
1250 "payload_consumer/delta_performer_unittest.cc",
1251 ],
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001252 srcs: [
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001253 ":update_engine_host_unittest_srcs",
Mohammad Samiul Islam24a82792021-02-12 16:52:36 +00001254 "aosp/apex_handler_android_unittest.cc",
Kelvin Zhangb4b95c22021-04-05 15:56:26 -04001255 "aosp/cleanup_previous_update_action_unittest.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -07001256 "aosp/dynamic_partition_control_android_unittest.cc",
Kelvin Zhang3fe49642021-10-04 15:35:02 -07001257 "aosp/update_attempter_android_integration_test.cc",
Amin Hassaniec7bc112020-10-29 16:47:58 -07001258 "aosp/update_attempter_android_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001259 "common/utils_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001260 "download_action_android_unittest.cc",
Kelvin Zhange47767a2023-05-16 13:00:58 -07001261 "payload_consumer/block_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001262 "payload_consumer/bzip_extent_writer_unittest.cc",
1263 "payload_consumer/cached_file_descriptor_unittest.cc",
Kelvin Zhang46d6c492021-04-26 17:51:25 -04001264 "payload_consumer/cow_writer_file_descriptor_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001265 "payload_consumer/delta_performer_integration_test.cc",
1266 "payload_consumer/delta_performer_unittest.cc",
1267 "payload_consumer/extent_reader_unittest.cc",
1268 "payload_consumer/extent_writer_unittest.cc",
Kelvin Zhangc5803b72021-09-02 09:06:16 -07001269 "payload_consumer/extent_map_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001270 "payload_consumer/fake_file_descriptor.cc",
1271 "payload_consumer/file_descriptor_utils_unittest.cc",
1272 "payload_consumer/file_writer_unittest.cc",
1273 "payload_consumer/filesystem_verifier_action_unittest.cc",
Amin Hassani23795032020-11-24 14:38:55 -08001274 "payload_consumer/install_plan_unittest.cc",
Kelvin Zhang40d96662021-02-24 14:21:29 -05001275 "payload_consumer/install_operation_executor_unittest.cc",
Tianjie99d570d2020-06-04 14:57:19 -07001276 "payload_consumer/partition_update_generator_android_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001277 "payload_consumer/partition_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001278 "payload_consumer/postinstall_runner_action_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001279 "payload_consumer/snapshot_extent_writer_unittest.cc",
1280 "payload_consumer/vabc_partition_writer_unittest.cc",
Kelvin Zhang4e93cf12021-09-13 16:03:24 -07001281 "payload_consumer/xor_extent_writer_unittest.cc",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001282 ],
1283}
1284
1285// Brillo update payload generation script
1286// ========================================================
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +01001287sh_binary {
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001288 name: "brillo_update_payload",
1289 device_supported: false,
1290 host_supported: true,
1291
Martin Stjernholm18e9f3c2020-09-08 13:56:59 +01001292 src: "scripts/brillo_update_payload",
Dan Willemsenf5a904e2018-10-23 01:02:44 -07001293 required: [
1294 "delta_generator",
1295 "shflags",
1296 "simg2img",
1297 ],
1298
1299 target: {
1300 darwin: {
1301 enabled: false,
1302 },
1303 },
Colin Cross606913a2017-11-14 13:05:37 -08001304}
Yifan Hongd51738c2020-07-23 17:06:25 -07001305
1306// update_engine header library
1307cc_library_headers {
1308 name: "libupdate_engine_headers",
Yifan Hong309c8a82020-10-06 18:31:08 -07001309
1310 // This header library is available to core and product modules.
Justin Yun6d121de2020-11-11 19:31:57 +09001311 product_available: true,
Yifan Hong309c8a82020-10-06 18:31:08 -07001312
Yifan Hongd51738c2020-07-23 17:06:25 -07001313 export_include_dirs: ["."],
1314 apex_available: [
1315 "com.android.gki.*",
David Anderson5e6dfe32020-09-17 15:50:33 -07001316 "//apex_available:platform",
Yifan Hongd51738c2020-07-23 17:06:25 -07001317 ],
David Andersonc1c93052020-08-26 18:22:09 +00001318 host_supported: true,
David Anderson5e6dfe32020-09-17 15:50:33 -07001319 recovery_available: true,
1320 ramdisk_available: true,
David Andersona4b7ba62023-05-10 21:41:37 -07001321 vendor_ramdisk_available: true,
David Anderson5e6dfe32020-09-17 15:50:33 -07001322
1323 target: {
1324 darwin: {
1325 enabled: false,
1326 },
1327 }
Yifan Hongd51738c2020-07-23 17:06:25 -07001328}
Kelvin Zhangb93055f2021-02-03 14:22:35 -05001329
1330cc_binary_host {
1331 name: "cow_converter",
1332 defaults: [
1333 "ue_defaults",
1334 "libpayload_consumer_exports",
1335 ],
1336 srcs: [
1337 "aosp/cow_converter.cc",
1338 ],
1339 static_libs: [
1340 "liblog",
1341 "libbrotli",
1342 "libbase",
1343 "libcow_operation_convert",
1344 "libcow_size_estimator",
Kelvin Zhang901c7d52022-06-21 09:35:45 -07001345 "libgflags",
Kelvin Zhangb93055f2021-02-03 14:22:35 -05001346 "libpayload_consumer",
1347 "libpayload_extent_ranges",
1348 "libpayload_extent_utils",
1349 "libsnapshot_cow",
1350 "libz",
1351 "update_metadata-protos",
1352 ],
Elliott Hughes88f3c8c2021-04-22 13:47:21 -07001353}
Kelvin Zhang98001b22021-12-08 14:10:11 -08001354
1355cc_library_static {
1356 name: "lz4diff-protos",
1357 host_supported: true,
1358 ramdisk_available: true,
1359 recovery_available: true,
1360
1361 srcs: ["lz4diff/lz4diff.proto"],
1362 cflags: [
1363 "-Wall",
1364 "-Werror",
1365 ],
1366 proto: {
1367 canonical_path_from_root: false,
1368 export_proto_headers: true,
1369 },
1370}
Kelvin Zhang596a3202022-03-07 14:13:42 -08001371
1372cc_binary_host {
1373 name: "ota_extractor",
1374 defaults: [
1375 "ue_defaults",
1376 "libpayload_consumer_exports",
1377 ],
1378 srcs: [
1379 "aosp/ota_extractor.cc",
1380 ],
1381 static_libs: [
1382 "liblog",
1383 "libbrotli",
1384 "libbase",
1385 "libpayload_consumer",
1386 "libpayload_extent_ranges",
1387 "libpayload_extent_utils",
1388 "libz",
1389 "libgflags",
1390 "update_metadata-protos",
1391 ],
1392}
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001393
1394cc_binary_host {
1395 name: "map_file_generator",
1396 defaults: [
1397 "ue_defaults",
1398 "libpayload_generator_exports",
1399 ],
1400 srcs: [
1401 "aosp/map_file_generator.cc",
1402 ],
1403 static_libs: [
1404 "liblog",
1405 "libbase",
1406 "libpayload_generator",
1407 "libpayload_extent_ranges",
1408 "libpayload_extent_utils",
1409 "libgflags",
Kelvin Zhang8bd5c4c2023-06-08 11:21:27 -07001410 "libsparse",
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001411 "update_metadata-protos",
1412 ],
Kelvin Zhangdf9821b2023-06-12 10:04:34 -07001413 required: [
1414 "unsquashfs",
1415 ],
Kelvin Zhang83b594b2023-05-25 13:43:06 -07001416}
Pawan Waghdaa52652023-06-08 23:57:11 +00001417
1418cc_fuzz {
1419 name: "update_engine_service_fuzzer",
1420 defaults: [
1421 "ue_defaults",
1422 "libupdate_engine_android_exports",
1423 "service_fuzzer_defaults",
1424 "fuzzer_disable_leaks",
1425 ],
1426 static_libs: [
1427 "libupdate_engine_android",
1428 "libgflags",
1429 ],
1430 srcs: [
1431 "fuzzers/update_engine_service_fuzzer.cpp",
1432 "aosp/metrics_reporter_android.cc",
1433 ],
1434 fuzz_config: {
1435 triage_assignee: "waghpawan@google.com",
1436 cc: [
1437 "elsk@google.com",
1438 "zhangkelvin@google.com",
1439 ]
1440 },
1441}