Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 1 | // |
| 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 Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 17 | // AIDL interface between libupdate_engine and framework.jar |
| 18 | filegroup { |
| 19 | name: "libupdate_engine_aidl", |
| 20 | srcs: [ |
| 21 | "binder_bindings/android/os/IUpdateEngine.aidl", |
| 22 | "binder_bindings/android/os/IUpdateEngineCallback.aidl", |
| 23 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 24 | path: "binder_bindings", |
| 25 | } |
| 26 | |
| 27 | cc_defaults { |
| 28 | name: "ue_defaults", |
| 29 | |
| 30 | cflags: [ |
Amin Hassani | 2e4eda5 | 2019-01-07 14:01:17 -0800 | [diff] [blame] | 31 | "-DBASE_VER=576279", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 32 | "-DUSE_BINDER=1", |
| 33 | "-DUSE_CHROME_NETWORK_PROXY=0", |
| 34 | "-DUSE_CHROME_KIOSK_APP=0", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 35 | "-DUSE_HWID_OVERRIDE=0", |
| 36 | "-DUSE_MTD=0", |
| 37 | "-DUSE_OMAHA=0", |
| 38 | "-D_FILE_OFFSET_BITS=64", |
| 39 | "-D_POSIX_C_SOURCE=199309L", |
| 40 | "-Wa,--noexecstack", |
| 41 | "-Wall", |
| 42 | "-Werror", |
| 43 | "-Wextra", |
| 44 | "-Wformat=2", |
| 45 | "-Wno-psabi", |
| 46 | "-Wno-unused-parameter", |
| 47 | "-ffunction-sections", |
| 48 | "-fstack-protector-strong", |
| 49 | "-fvisibility=hidden", |
| 50 | ], |
| 51 | cppflags: [ |
| 52 | "-Wnon-virtual-dtor", |
| 53 | "-fno-strict-aliasing", |
| 54 | ], |
| 55 | include_dirs: ["system"], |
| 56 | local_include_dirs: ["client_library/include"], |
| 57 | static_libs: ["libgtest_prod"], |
| 58 | shared_libs: [ |
| 59 | "libbrillo-stream", |
| 60 | "libbrillo", |
| 61 | "libchrome", |
| 62 | ], |
| 63 | ldflags: ["-Wl,--gc-sections"], |
| 64 | |
| 65 | product_variables: { |
| 66 | pdk: { |
| 67 | enabled: false, |
| 68 | }, |
| 69 | }, |
| 70 | |
| 71 | target: { |
Sen Jiang | b5f631d | 2018-12-18 16:59:57 -0800 | [diff] [blame] | 72 | android: { |
| 73 | cflags: [ |
| 74 | "-DUSE_FEC=1", |
| 75 | ], |
| 76 | }, |
| 77 | host: { |
| 78 | cflags: [ |
| 79 | "-DUSE_FEC=0", |
| 80 | ], |
| 81 | }, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 82 | darwin: { |
| 83 | enabled: false, |
| 84 | }, |
| 85 | }, |
| 86 | } |
| 87 | |
| 88 | // update_metadata-protos (type: static_library) |
| 89 | // ======================================================== |
| 90 | // Protobufs. |
| 91 | cc_defaults { |
| 92 | name: "update_metadata-protos_exports", |
| 93 | |
| 94 | shared_libs: ["libprotobuf-cpp-lite"], |
| 95 | } |
| 96 | |
| 97 | cc_library_static { |
| 98 | name: "update_metadata-protos", |
| 99 | host_supported: true, |
| 100 | recovery_available: true, |
| 101 | |
| 102 | srcs: ["update_engine/update_metadata.proto"], |
| 103 | cflags: [ |
| 104 | "-Wall", |
| 105 | "-Werror", |
| 106 | ], |
| 107 | proto: { |
| 108 | canonical_path_from_root: false, |
| 109 | export_proto_headers: true, |
| 110 | }, |
| 111 | } |
| 112 | |
| 113 | // libpayload_consumer (type: static_library) |
| 114 | // ======================================================== |
| 115 | // The payload application component and common dependencies. |
| 116 | cc_defaults { |
| 117 | name: "libpayload_consumer_exports", |
| 118 | defaults: ["update_metadata-protos_exports"], |
| 119 | |
| 120 | static_libs: [ |
| 121 | "update_metadata-protos", |
| 122 | "libxz", |
| 123 | "libbz", |
| 124 | "libbspatch", |
| 125 | "libbrotli", |
| 126 | "libfec_rs", |
| 127 | "libpuffpatch", |
| 128 | "libverity_tree", |
| 129 | ], |
| 130 | shared_libs: [ |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 131 | "libziparchive", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 132 | "libbase", |
| 133 | "libcrypto", |
Sen Jiang | b5f631d | 2018-12-18 16:59:57 -0800 | [diff] [blame] | 134 | "libfec", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 135 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 136 | } |
| 137 | |
| 138 | cc_library_static { |
| 139 | name: "libpayload_consumer", |
| 140 | defaults: [ |
| 141 | "ue_defaults", |
| 142 | "libpayload_consumer_exports", |
| 143 | ], |
| 144 | host_supported: true, |
| 145 | recovery_available: true, |
| 146 | |
| 147 | srcs: [ |
| 148 | "common/action_processor.cc", |
| 149 | "common/boot_control_stub.cc", |
| 150 | "common/clock.cc", |
| 151 | "common/constants.cc", |
| 152 | "common/cpu_limiter.cc", |
Yifan Hong | daac732 | 2019-11-07 10:48:26 -0800 | [diff] [blame] | 153 | "common/dynamic_partition_control_stub.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 154 | "common/error_code_utils.cc", |
| 155 | "common/file_fetcher.cc", |
| 156 | "common/hash_calculator.cc", |
| 157 | "common/http_common.cc", |
| 158 | "common/http_fetcher.cc", |
| 159 | "common/hwid_override.cc", |
| 160 | "common/multi_range_http_fetcher.cc", |
| 161 | "common/platform_constants_android.cc", |
| 162 | "common/prefs.cc", |
| 163 | "common/proxy_resolver.cc", |
| 164 | "common/subprocess.cc", |
| 165 | "common/terminator.cc", |
| 166 | "common/utils.cc", |
| 167 | "payload_consumer/bzip_extent_writer.cc", |
| 168 | "payload_consumer/cached_file_descriptor.cc", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 169 | "payload_consumer/certificate_parser_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 170 | "payload_consumer/delta_performer.cc", |
| 171 | "payload_consumer/download_action.cc", |
| 172 | "payload_consumer/extent_reader.cc", |
| 173 | "payload_consumer/extent_writer.cc", |
| 174 | "payload_consumer/file_descriptor.cc", |
| 175 | "payload_consumer/file_descriptor_utils.cc", |
| 176 | "payload_consumer/file_writer.cc", |
| 177 | "payload_consumer/filesystem_verifier_action.cc", |
| 178 | "payload_consumer/install_plan.cc", |
| 179 | "payload_consumer/mount_history.cc", |
| 180 | "payload_consumer/payload_constants.cc", |
| 181 | "payload_consumer/payload_metadata.cc", |
| 182 | "payload_consumer/payload_verifier.cc", |
| 183 | "payload_consumer/postinstall_runner_action.cc", |
| 184 | "payload_consumer/verity_writer_android.cc", |
| 185 | "payload_consumer/xz_extent_writer.cc", |
| 186 | "payload_consumer/fec_file_descriptor.cc", |
| 187 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | // libupdate_engine_boot_control (type: static_library) |
| 191 | // ======================================================== |
| 192 | // A BootControl class implementation using Android's HIDL boot_control HAL. |
| 193 | cc_defaults { |
| 194 | name: "libupdate_engine_boot_control_exports", |
| 195 | defaults: ["update_metadata-protos_exports"], |
| 196 | |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 197 | static_libs: [ |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 198 | "libcutils", |
| 199 | "libfs_mgr_binder", |
| 200 | "libgsi", |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 201 | "libsnapshot", |
| 202 | "update_metadata-protos", |
| 203 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 204 | shared_libs: [ |
| 205 | "libbootloader_message", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 206 | "libhidlbase", |
| 207 | "liblp", |
| 208 | "libutils", |
| 209 | "android.hardware.boot@1.0", |
David Anderson | 2111d06 | 2019-10-15 22:36:27 -0700 | [diff] [blame] | 210 | "android.hardware.boot@1.1", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 211 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 212 | target: { |
| 213 | recovery: { |
David Anderson | e7ce821 | 2019-12-16 20:13:19 -0800 | [diff] [blame] | 214 | static_libs: [ |
| 215 | "libfs_mgr", |
| 216 | "libsnapshot_nobinder", |
| 217 | ], |
| 218 | exclude_static_libs: [ |
| 219 | "libfs_mgr_binder", |
| 220 | "libsnapshot", |
| 221 | ], |
Yifan Hong | 420db9b | 2019-07-23 20:50:33 -0700 | [diff] [blame] | 222 | }, |
| 223 | }, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 224 | } |
| 225 | |
| 226 | cc_library_static { |
| 227 | name: "libupdate_engine_boot_control", |
| 228 | defaults: [ |
| 229 | "ue_defaults", |
| 230 | "libupdate_engine_boot_control_exports", |
| 231 | ], |
| 232 | recovery_available: true, |
| 233 | |
| 234 | srcs: [ |
| 235 | "boot_control_android.cc", |
| 236 | "dynamic_partition_control_android.cc", |
Yifan Hong | 012508e | 2019-07-22 18:30:40 -0700 | [diff] [blame] | 237 | "dynamic_partition_utils.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 238 | ], |
| 239 | } |
| 240 | |
| 241 | // libupdate_engine_android (type: static_library) |
| 242 | // ======================================================== |
| 243 | // The main daemon static_library used in Android (non-Brillo). This only has a |
| 244 | // loop to apply payloads provided by the upper layer via a Binder interface. |
| 245 | cc_defaults { |
| 246 | name: "libupdate_engine_android_exports", |
| 247 | defaults: [ |
| 248 | "ue_defaults", |
| 249 | "libpayload_consumer_exports", |
| 250 | "libupdate_engine_boot_control_exports", |
| 251 | ], |
| 252 | |
| 253 | static_libs: [ |
| 254 | "libpayload_consumer", |
| 255 | "libupdate_engine_boot_control", |
| 256 | ], |
| 257 | shared_libs: [ |
| 258 | "libandroid_net", |
| 259 | "libbase", |
| 260 | "libbinder", |
| 261 | "libbinderwrapper", |
| 262 | "libbootloader_message", |
| 263 | "libbrillo-binder", |
| 264 | "libcurl", |
| 265 | "libcutils", |
| 266 | "liblog", |
| 267 | "libmetricslogger", |
| 268 | "libssl", |
Tianjie Xu | 75cc9f2 | 2019-08-02 14:53:38 -0700 | [diff] [blame^] | 269 | "libstatslog", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 270 | "libutils", |
| 271 | ], |
| 272 | } |
| 273 | |
| 274 | cc_library_static { |
| 275 | name: "libupdate_engine_android", |
| 276 | defaults: [ |
| 277 | "ue_defaults", |
| 278 | "libupdate_engine_android_exports", |
| 279 | ], |
| 280 | |
| 281 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 282 | // out of the DBus interface. |
| 283 | include_dirs: ["external/cros/system_api/dbus"], |
| 284 | |
| 285 | aidl: { |
| 286 | local_include_dirs: ["binder_bindings"], |
| 287 | export_aidl_headers: true, |
| 288 | }, |
| 289 | |
| 290 | srcs: [ |
| 291 | ":libupdate_engine_aidl", |
| 292 | "binder_service_android.cc", |
| 293 | "certificate_checker.cc", |
| 294 | "daemon.cc", |
| 295 | "daemon_state_android.cc", |
| 296 | "hardware_android.cc", |
| 297 | "libcurl_http_fetcher.cc", |
| 298 | "metrics_reporter_android.cc", |
| 299 | "metrics_utils.cc", |
| 300 | "network_selector_android.cc", |
| 301 | "update_attempter_android.cc", |
| 302 | "update_boot_flags_action.cc", |
| 303 | "update_status_utils.cc", |
| 304 | ], |
| 305 | } |
| 306 | |
| 307 | // update_engine (type: executable) |
| 308 | // ======================================================== |
| 309 | // update_engine daemon. |
| 310 | cc_binary { |
| 311 | name: "update_engine", |
| 312 | defaults: [ |
| 313 | "ue_defaults", |
| 314 | "libupdate_engine_android_exports", |
| 315 | ], |
| 316 | |
| 317 | static_libs: ["libupdate_engine_android"], |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 318 | required: [ |
| 319 | "cacerts_google", |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 320 | "otacerts", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 321 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 322 | |
| 323 | srcs: ["main.cc"], |
| 324 | init_rc: ["update_engine.rc"], |
| 325 | } |
| 326 | |
| 327 | // update_engine_sideload (type: executable) |
| 328 | // ======================================================== |
| 329 | // A binary executable equivalent to update_engine daemon that installs an update |
| 330 | // from a local file directly instead of running in the background. Used in |
| 331 | // recovery image. |
| 332 | cc_binary { |
| 333 | name: "update_engine_sideload", |
| 334 | defaults: [ |
| 335 | "ue_defaults", |
| 336 | "update_metadata-protos_exports", |
| 337 | "libupdate_engine_boot_control_exports", |
| 338 | "libpayload_consumer_exports", |
| 339 | ], |
| 340 | recovery: true, |
| 341 | |
| 342 | cflags: ["-D_UE_SIDELOAD"], |
| 343 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 344 | // out of the DBus interface. |
| 345 | include_dirs: ["external/cros/system_api/dbus"], |
| 346 | |
| 347 | srcs: [ |
| 348 | "hardware_android.cc", |
| 349 | "metrics_reporter_stub.cc", |
| 350 | "metrics_utils.cc", |
| 351 | "network_selector_stub.cc", |
Yifan Hong | c73cb8c | 2019-10-24 18:28:31 -0700 | [diff] [blame] | 352 | "sideload_logging_android.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 353 | "sideload_main.cc", |
| 354 | "update_attempter_android.cc", |
| 355 | "update_boot_flags_action.cc", |
| 356 | "update_status_utils.cc", |
| 357 | ], |
| 358 | |
| 359 | // Use commonly used shared libraries. libprotobuf-cpp-lite.so is filtered out, |
| 360 | // as it doesn't look beneficial to be installed separately due to its size. Note |
| 361 | // that we explicitly request their recovery variants, so that the expected files |
| 362 | // will be used and installed. |
| 363 | shared_libs: [ |
| 364 | "libbase", |
| 365 | "liblog", |
| 366 | ], |
| 367 | static_libs: [ |
| 368 | "libpayload_consumer", |
| 369 | "libupdate_engine_boot_control", |
| 370 | "update_metadata-protos", |
| 371 | |
| 372 | // We add the static versions of the shared libraries that are not installed to |
| 373 | // recovery image due to size concerns. Need to include all the static library |
| 374 | // dependencies of these static libraries. |
| 375 | "libevent", |
| 376 | "libmodpb64", |
| 377 | "libgtest_prod", |
| 378 | "libprotobuf-cpp-lite", |
| 379 | "libbrillo-stream", |
| 380 | "libbrillo", |
| 381 | "libchrome", |
| 382 | ], |
| 383 | target: { |
| 384 | recovery: { |
| 385 | exclude_shared_libs: [ |
| 386 | "libprotobuf-cpp-lite", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 387 | "libbrillo-stream", |
| 388 | "libbrillo", |
| 389 | "libchrome", |
| 390 | ], |
| 391 | }, |
| 392 | }, |
| 393 | |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 394 | required: [ |
Tianjie Xu | be4ea23 | 2019-10-15 18:08:31 -0700 | [diff] [blame] | 395 | "otacerts.recovery", |
Tao Bao | 1e1c86c | 2019-04-18 10:48:32 -0700 | [diff] [blame] | 396 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 397 | } |
| 398 | |
| 399 | // libupdate_engine_client (type: shared_library) |
| 400 | // ======================================================== |
| 401 | cc_library_shared { |
| 402 | name: "libupdate_engine_client", |
| 403 | |
| 404 | cflags: [ |
| 405 | "-Wall", |
| 406 | "-Werror", |
| 407 | "-Wno-unused-parameter", |
| 408 | "-DUSE_BINDER=1", |
| 409 | ], |
| 410 | export_include_dirs: ["client_library/include"], |
| 411 | include_dirs: [ |
| 412 | // TODO(deymo): Remove "external/cros/system_api/dbus" when dbus is not used. |
| 413 | "external/cros/system_api/dbus", |
| 414 | "system", |
| 415 | ], |
| 416 | |
| 417 | aidl: { |
| 418 | local_include_dirs: ["binder_bindings"], |
| 419 | }, |
| 420 | |
| 421 | shared_libs: [ |
| 422 | "libchrome", |
| 423 | "libbrillo", |
| 424 | "libbinder", |
| 425 | "libbrillo-binder", |
| 426 | "libutils", |
| 427 | ], |
| 428 | |
| 429 | srcs: [ |
Dan Willemsen | 3c7e4b6 | 2019-06-06 14:56:15 -0700 | [diff] [blame] | 430 | ":libupdate_engine_client_aidl", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 431 | "client_library/client.cc", |
| 432 | "client_library/client_binder.cc", |
| 433 | "parcelable_update_engine_status.cc", |
| 434 | "update_status_utils.cc", |
| 435 | ], |
| 436 | } |
| 437 | |
Dan Willemsen | 3c7e4b6 | 2019-06-06 14:56:15 -0700 | [diff] [blame] | 438 | filegroup { |
| 439 | name: "libupdate_engine_client_aidl", |
| 440 | srcs: [ |
| 441 | "binder_bindings/android/brillo/IUpdateEngine.aidl", |
| 442 | "binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl", |
| 443 | ], |
| 444 | path: "binder_bindings", |
| 445 | } |
| 446 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 447 | // update_engine_client (type: executable) |
| 448 | // ======================================================== |
| 449 | // update_engine console client. |
| 450 | cc_binary { |
| 451 | name: "update_engine_client", |
| 452 | defaults: ["ue_defaults"], |
| 453 | |
| 454 | // TODO(deymo): Remove external/cros/system_api/dbus once the strings are moved |
| 455 | // out of the DBus interface. |
| 456 | include_dirs: ["external/cros/system_api/dbus"], |
| 457 | |
| 458 | shared_libs: [ |
| 459 | "libbinder", |
| 460 | "libbinderwrapper", |
| 461 | "libbrillo-binder", |
| 462 | "libutils", |
| 463 | ], |
| 464 | |
| 465 | aidl: { |
| 466 | local_include_dirs: ["binder_bindings"], |
| 467 | }, |
| 468 | |
| 469 | srcs: [ |
| 470 | ":libupdate_engine_aidl", |
| 471 | "common/error_code_utils.cc", |
| 472 | "update_engine_client_android.cc", |
| 473 | "update_status_utils.cc", |
| 474 | ], |
| 475 | } |
| 476 | |
| 477 | // libpayload_generator (type: static_library) |
| 478 | // ======================================================== |
| 479 | // server-side code. This is used for delta_generator and unittests but not |
| 480 | // for any client code. |
| 481 | cc_defaults { |
| 482 | name: "libpayload_generator_exports", |
| 483 | defaults: [ |
| 484 | "libpayload_consumer_exports", |
| 485 | "update_metadata-protos_exports", |
| 486 | ], |
| 487 | |
| 488 | static_libs: [ |
| 489 | "libavb", |
| 490 | "libbrotli", |
| 491 | "libbsdiff", |
| 492 | "libdivsufsort", |
| 493 | "libdivsufsort64", |
| 494 | "liblzma", |
| 495 | "libpayload_consumer", |
| 496 | "libpuffdiff", |
| 497 | "libverity_tree", |
| 498 | "update_metadata-protos", |
| 499 | ], |
| 500 | shared_libs: [ |
| 501 | "libbase", |
| 502 | "libext2fs", |
| 503 | ], |
| 504 | } |
| 505 | |
| 506 | cc_library_static { |
| 507 | name: "libpayload_generator", |
| 508 | defaults: [ |
| 509 | "ue_defaults", |
| 510 | "libpayload_generator_exports", |
| 511 | ], |
| 512 | host_supported: true, |
| 513 | |
| 514 | srcs: [ |
| 515 | "payload_generator/ab_generator.cc", |
| 516 | "payload_generator/annotated_operation.cc", |
| 517 | "payload_generator/blob_file_writer.cc", |
| 518 | "payload_generator/block_mapping.cc", |
| 519 | "payload_generator/boot_img_filesystem.cc", |
| 520 | "payload_generator/bzip.cc", |
| 521 | "payload_generator/cycle_breaker.cc", |
| 522 | "payload_generator/deflate_utils.cc", |
| 523 | "payload_generator/delta_diff_generator.cc", |
| 524 | "payload_generator/delta_diff_utils.cc", |
| 525 | "payload_generator/ext2_filesystem.cc", |
| 526 | "payload_generator/extent_ranges.cc", |
| 527 | "payload_generator/extent_utils.cc", |
| 528 | "payload_generator/full_update_generator.cc", |
| 529 | "payload_generator/graph_types.cc", |
| 530 | "payload_generator/graph_utils.cc", |
| 531 | "payload_generator/inplace_generator.cc", |
| 532 | "payload_generator/mapfile_filesystem.cc", |
| 533 | "payload_generator/payload_file.cc", |
| 534 | "payload_generator/payload_generation_config_android.cc", |
| 535 | "payload_generator/payload_generation_config.cc", |
| 536 | "payload_generator/payload_signer.cc", |
| 537 | "payload_generator/raw_filesystem.cc", |
| 538 | "payload_generator/squashfs_filesystem.cc", |
| 539 | "payload_generator/tarjan.cc", |
| 540 | "payload_generator/topological_sort.cc", |
| 541 | "payload_generator/xz_android.cc", |
| 542 | ], |
| 543 | } |
| 544 | |
| 545 | // delta_generator (type: executable) |
| 546 | // ======================================================== |
| 547 | // server-side delta generator. |
| 548 | cc_binary_host { |
| 549 | name: "delta_generator", |
| 550 | defaults: [ |
| 551 | "ue_defaults", |
| 552 | "libpayload_generator_exports", |
| 553 | "libpayload_consumer_exports", |
| 554 | ], |
| 555 | |
| 556 | static_libs: [ |
| 557 | "libavb_host_sysdeps", |
| 558 | "libpayload_consumer", |
| 559 | "libpayload_generator", |
| 560 | ], |
| 561 | |
| 562 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 563 | } |
| 564 | |
| 565 | cc_test { |
| 566 | name: "ue_unittest_delta_generator", |
| 567 | defaults: [ |
| 568 | "ue_defaults", |
| 569 | "libpayload_generator_exports", |
| 570 | "libpayload_consumer_exports", |
| 571 | ], |
| 572 | |
| 573 | static_libs: [ |
| 574 | "libpayload_consumer", |
| 575 | "libpayload_generator", |
| 576 | ], |
| 577 | |
| 578 | srcs: ["payload_generator/generate_delta_main.cc"], |
| 579 | |
| 580 | gtest: false, |
| 581 | stem: "delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 582 | } |
| 583 | |
| 584 | // test_http_server (type: executable) |
| 585 | // ======================================================== |
| 586 | // Test HTTP Server. |
| 587 | cc_test { |
| 588 | name: "test_http_server", |
| 589 | defaults: ["ue_defaults"], |
| 590 | srcs: [ |
| 591 | "common/http_common.cc", |
| 592 | "test_http_server.cc", |
| 593 | ], |
| 594 | |
| 595 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 596 | } |
| 597 | |
| 598 | // test_subprocess (type: executable) |
| 599 | // ======================================================== |
| 600 | // Test helper subprocess program. |
| 601 | cc_test { |
| 602 | name: "test_subprocess", |
| 603 | defaults: ["ue_defaults"], |
| 604 | srcs: ["test_subprocess.cc"], |
| 605 | |
| 606 | gtest: false, |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 607 | } |
| 608 | |
| 609 | // Public keys for unittests. |
| 610 | // ======================================================== |
| 611 | genrule { |
| 612 | name: "ue_unittest_keys", |
| 613 | cmd: "openssl rsa -in $(location unittest_key.pem) -pubout -out $(location unittest_key.pub.pem) &&" + |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 614 | "openssl rsa -in $(location unittest_key2.pem) -pubout -out $(location unittest_key2.pub.pem) &&" + |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 615 | "openssl rsa -in $(location unittest_key_RSA4096.pem) -pubout -out $(location unittest_key_RSA4096.pub.pem) &&" + |
| 616 | "openssl pkey -in $(location unittest_key_EC.pem) -pubout -out $(location unittest_key_EC.pub.pem)", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 617 | srcs: [ |
| 618 | "unittest_key.pem", |
| 619 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 620 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 621 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 622 | ], |
| 623 | out: [ |
| 624 | "unittest_key.pub.pem", |
| 625 | "unittest_key2.pub.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 626 | "unittest_key_RSA4096.pub.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 627 | "unittest_key_EC.pub.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 628 | ], |
| 629 | } |
| 630 | |
| 631 | // Sample images for unittests. |
| 632 | // ======================================================== |
| 633 | // Extract sample image from the compressed sample_images.tar.bz2 file used by |
| 634 | // the unittests. |
| 635 | genrule { |
| 636 | name: "ue_unittest_disk_imgs", |
| 637 | cmd: "tar -jxf $(in) -C $(genDir)/gen disk_ext2_1k.img disk_ext2_4k.img disk_ext2_4k_empty.img disk_ext2_unittest.img", |
| 638 | srcs: ["sample_images/sample_images.tar.bz2"], |
| 639 | out: [ |
| 640 | "gen/disk_ext2_1k.img", |
| 641 | "gen/disk_ext2_4k.img", |
| 642 | "gen/disk_ext2_4k_empty.img", |
| 643 | "gen/disk_ext2_unittest.img", |
| 644 | ], |
| 645 | } |
| 646 | |
| 647 | // update_engine_unittests (type: executable) |
| 648 | // ======================================================== |
| 649 | // Main unittest file. |
| 650 | cc_test { |
| 651 | name: "update_engine_unittests", |
| 652 | defaults: [ |
| 653 | "ue_defaults", |
| 654 | "libpayload_generator_exports", |
| 655 | "libupdate_engine_android_exports", |
| 656 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 657 | |
| 658 | static_libs: [ |
| 659 | "libpayload_generator", |
| 660 | "libbrillo-test-helpers", |
| 661 | "libgmock", |
| 662 | "libchrome_test_helpers", |
| 663 | "libupdate_engine_android", |
Tianjie Xu | 173e619 | 2019-12-10 10:56:01 -0800 | [diff] [blame] | 664 | "libdm", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 665 | ], |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 666 | |
Yifan Hong | 87ea73f | 2019-09-12 13:07:37 -0700 | [diff] [blame] | 667 | header_libs: [ |
| 668 | "libstorage_literals_headers", |
| 669 | ], |
| 670 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 671 | data: [ |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 672 | ":test_http_server", |
| 673 | ":test_subprocess", |
| 674 | ":ue_unittest_delta_generator", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 675 | ":ue_unittest_disk_imgs", |
| 676 | ":ue_unittest_keys", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 677 | "otacerts.zip", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 678 | "unittest_key.pem", |
| 679 | "unittest_key2.pem", |
xunchang | cda3c03 | 2019-03-26 15:41:14 -0700 | [diff] [blame] | 680 | "unittest_key_RSA4096.pem", |
Tianjie Xu | 7bbe015 | 2019-10-09 18:11:15 -0700 | [diff] [blame] | 681 | "unittest_key_EC.pem", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 682 | "update_engine.conf", |
| 683 | ], |
| 684 | |
Tao Bao | 9456b6f | 2019-04-29 18:14:58 -0700 | [diff] [blame] | 685 | // We cannot use the default generated AndroidTest.xml because of the use of helper modules |
| 686 | // (i.e. test_http_server, test_subprocess, ue_unittest_delta_generator). |
| 687 | test_config: "test_config.xml", |
| 688 | test_suites: ["device-tests"], |
| 689 | |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 690 | srcs: [ |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 691 | "certificate_checker_unittest.cc", |
| 692 | "common/action_pipe_unittest.cc", |
| 693 | "common/action_processor_unittest.cc", |
| 694 | "common/action_unittest.cc", |
| 695 | "common/cpu_limiter_unittest.cc", |
| 696 | "common/fake_prefs.cc", |
| 697 | "common/file_fetcher_unittest.cc", |
| 698 | "common/hash_calculator_unittest.cc", |
| 699 | "common/http_fetcher_unittest.cc", |
| 700 | "common/hwid_override_unittest.cc", |
| 701 | "common/mock_http_fetcher.cc", |
| 702 | "common/prefs_unittest.cc", |
| 703 | "common/proxy_resolver_unittest.cc", |
| 704 | "common/subprocess_unittest.cc", |
| 705 | "common/terminator_unittest.cc", |
| 706 | "common/test_utils.cc", |
| 707 | "common/utils_unittest.cc", |
Yifan Hong | c049f93 | 2019-07-23 15:06:05 -0700 | [diff] [blame] | 708 | "dynamic_partition_control_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 709 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 710 | "payload_consumer/cached_file_descriptor_unittest.cc", |
Tianjie Xu | 7a78d63 | 2019-10-08 16:32:39 -0700 | [diff] [blame] | 711 | "payload_consumer/certificate_parser_android_unittest.cc", |
Dan Willemsen | f5a904e | 2018-10-23 01:02:44 -0700 | [diff] [blame] | 712 | "payload_consumer/delta_performer_integration_test.cc", |
| 713 | "payload_consumer/delta_performer_unittest.cc", |
| 714 | "payload_consumer/extent_reader_unittest.cc", |
| 715 | "payload_consumer/extent_writer_unittest.cc", |
| 716 | "payload_consumer/fake_file_descriptor.cc", |
| 717 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 718 | "payload_consumer/file_writer_unittest.cc", |
| 719 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
| 720 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 721 | "payload_consumer/verity_writer_android_unittest.cc", |
| 722 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 723 | "payload_generator/ab_generator_unittest.cc", |
| 724 | "payload_generator/blob_file_writer_unittest.cc", |
| 725 | "payload_generator/block_mapping_unittest.cc", |
| 726 | "payload_generator/boot_img_filesystem_unittest.cc", |
| 727 | "payload_generator/cycle_breaker_unittest.cc", |
| 728 | "payload_generator/deflate_utils_unittest.cc", |
| 729 | "payload_generator/delta_diff_utils_unittest.cc", |
| 730 | "payload_generator/ext2_filesystem_unittest.cc", |
| 731 | "payload_generator/extent_ranges_unittest.cc", |
| 732 | "payload_generator/extent_utils_unittest.cc", |
| 733 | "payload_generator/fake_filesystem.cc", |
| 734 | "payload_generator/full_update_generator_unittest.cc", |
| 735 | "payload_generator/graph_utils_unittest.cc", |
| 736 | "payload_generator/inplace_generator_unittest.cc", |
| 737 | "payload_generator/mapfile_filesystem_unittest.cc", |
| 738 | "payload_generator/payload_file_unittest.cc", |
| 739 | "payload_generator/payload_generation_config_android_unittest.cc", |
| 740 | "payload_generator/payload_generation_config_unittest.cc", |
| 741 | "payload_generator/payload_signer_unittest.cc", |
| 742 | "payload_generator/squashfs_filesystem_unittest.cc", |
| 743 | "payload_generator/tarjan_unittest.cc", |
| 744 | "payload_generator/topological_sort_unittest.cc", |
| 745 | "payload_generator/zip_unittest.cc", |
| 746 | "testrunner.cc", |
| 747 | "update_attempter_android_unittest.cc", |
| 748 | ], |
| 749 | } |
| 750 | |
| 751 | // Brillo update payload generation script |
| 752 | // ======================================================== |
| 753 | cc_prebuilt_binary { |
| 754 | name: "brillo_update_payload", |
| 755 | device_supported: false, |
| 756 | host_supported: true, |
| 757 | |
| 758 | srcs: ["scripts/brillo_update_payload"], |
| 759 | required: [ |
| 760 | "delta_generator", |
| 761 | "shflags", |
| 762 | "simg2img", |
| 763 | ], |
| 764 | |
| 765 | target: { |
| 766 | darwin: { |
| 767 | enabled: false, |
| 768 | }, |
| 769 | }, |
Colin Cross | 606913a | 2017-11-14 13:05:37 -0800 | [diff] [blame] | 770 | } |
Ralph Nathan | ab8026c | 2018-08-08 15:43:02 -0700 | [diff] [blame] | 771 | |
| 772 | // AIDL interface between libupdate_engine and the Things jar. |
| 773 | filegroup { |
| 774 | name: "things_update_engine_aidl", |
| 775 | srcs: [ |
| 776 | "binder_bindings/android/brillo/IUpdateEngine.aidl", |
| 777 | "binder_bindings/android/brillo/IUpdateEngineStatusCallback.aidl", |
| 778 | ], |
| 779 | } |