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