Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 1 | # |
| 2 | # Copyright (C) 2019 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 | |
Amin Hassani | 165d4b4 | 2019-06-27 11:04:14 -0700 | [diff] [blame] | 17 | # Stop linter from complaining XXX_unittest.cc naming. |
| 18 | # gnlint: disable=GnLintSourceFileNames |
| 19 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 20 | import("//common-mk/generate-dbus-adaptors.gni") |
| 21 | import("//common-mk/generate-dbus-proxies.gni") |
| 22 | import("//common-mk/openssl_pem.gni") |
| 23 | import("//common-mk/pkg_config.gni") |
| 24 | import("//common-mk/proto_library.gni") |
| 25 | import("//update_engine/tar_bunzip2.gni") |
| 26 | |
| 27 | group("all") { |
| 28 | deps = [ |
| 29 | ":delta_generator", |
| 30 | ":libpayload_consumer", |
| 31 | ":libpayload_generator", |
| 32 | ":libupdate_engine", |
| 33 | ":libupdate_engine_client", |
| 34 | ":update_engine", |
| 35 | ":update_engine-dbus-adaptor", |
| 36 | ":update_engine-dbus-kiosk-app-client", |
| 37 | ":update_engine_client", |
| 38 | ":update_metadata-protos", |
| 39 | ] |
| 40 | |
| 41 | if (use.test) { |
| 42 | deps += [ |
| 43 | ":test_http_server", |
| 44 | ":test_subprocess", |
| 45 | ":update_engine-test_images", |
| 46 | ":update_engine-testkeys", |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame] | 47 | ":update_engine-testkeys-ec", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 48 | ":update_engine_test_libs", |
| 49 | ":update_engine_unittests", |
| 50 | ] |
| 51 | } |
| 52 | |
| 53 | if (use.fuzzer) { |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 54 | deps += [ |
| 55 | ":update_engine_delta_performer_fuzzer", |
| 56 | ":update_engine_omaha_request_action_fuzzer", |
| 57 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 58 | } |
| 59 | } |
| 60 | |
| 61 | pkg_config("target_defaults") { |
| 62 | cflags_cc = [ |
| 63 | "-fno-strict-aliasing", |
Amin Hassani | d894644 | 2020-08-28 12:26:35 -0700 | [diff] [blame] | 64 | "-std=gnu++17", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 65 | "-Wnon-virtual-dtor", |
| 66 | ] |
| 67 | cflags = [ |
| 68 | "-g", |
| 69 | "-ffunction-sections", |
| 70 | "-Wall", |
| 71 | "-Wextra", |
| 72 | "-Werror", |
| 73 | "-Wno-unused-parameter", |
| 74 | ] |
| 75 | ldflags = [ "-Wl,--gc-sections" ] |
| 76 | defines = [ |
| 77 | "__CHROMEOS__", |
| 78 | "_FILE_OFFSET_BITS=64", |
| 79 | "_POSIX_C_SOURCE=199309L", |
Matt Ziegelbaum | 7cfadf7 | 2020-06-09 18:51:16 -0400 | [diff] [blame] | 80 | "USE_CFM=${use.cfm}", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 81 | "USE_DBUS=${use.dbus}", |
| 82 | "USE_FEC=0", |
| 83 | "USE_HWID_OVERRIDE=${use.hwid_override}", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 84 | ] |
| 85 | include_dirs = [ |
| 86 | # We need this include dir because we include all the local code as |
| 87 | # "update_engine/...". |
| 88 | "${platform2_root}", |
| 89 | "${platform2_root}/update_engine/client_library/include", |
| 90 | ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 91 | |
| 92 | # NOSORT |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 93 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 94 | "libbrillo", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 95 | "libchrome", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 96 | |
| 97 | # system_api depends on protobuf (or protobuf-lite). It must appear |
| 98 | # before protobuf here or the linker flags won't be in the right |
| 99 | # order. |
| 100 | "system_api", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 101 | ] |
Allen Webb | 816193f | 2019-10-25 10:06:46 -0700 | [diff] [blame] | 102 | if (use.fuzzer) { |
| 103 | pkg_deps += [ "protobuf" ] |
| 104 | } else { |
| 105 | pkg_deps += [ "protobuf-lite" ] |
| 106 | } |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 107 | } |
| 108 | |
| 109 | # Protobufs. |
| 110 | proto_library("update_metadata-protos") { |
| 111 | proto_in_dir = "." |
| 112 | proto_out_dir = "include/update_engine" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 113 | sources = [ "update_metadata.proto" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 114 | } |
| 115 | |
| 116 | # Chrome D-Bus bindings. |
| 117 | generate_dbus_adaptors("update_engine-dbus-adaptor") { |
| 118 | dbus_adaptors_out_dir = "include/dbus_bindings" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 119 | sources = [ "dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 120 | } |
| 121 | |
| 122 | generate_dbus_proxies("update_engine-dbus-kiosk-app-client") { |
| 123 | mock_output_file = "include/kiosk-app/dbus-proxy-mocks.h" |
| 124 | proxy_output_file = "include/kiosk-app/dbus-proxies.h" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 125 | sources = [ "dbus_bindings/org.chromium.KioskAppService.dbus-xml" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 126 | } |
| 127 | |
| 128 | # The payload application component and common dependencies. |
| 129 | static_library("libpayload_consumer") { |
| 130 | sources = [ |
| 131 | "common/action_processor.cc", |
| 132 | "common/boot_control_stub.cc", |
| 133 | "common/clock.cc", |
| 134 | "common/constants.cc", |
| 135 | "common/cpu_limiter.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 136 | "common/dynamic_partition_control_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 137 | "common/error_code_utils.cc", |
| 138 | "common/hash_calculator.cc", |
| 139 | "common/http_common.cc", |
| 140 | "common/http_fetcher.cc", |
| 141 | "common/hwid_override.cc", |
| 142 | "common/multi_range_http_fetcher.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 143 | "common/prefs.cc", |
| 144 | "common/proxy_resolver.cc", |
| 145 | "common/subprocess.cc", |
| 146 | "common/terminator.cc", |
| 147 | "common/utils.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 148 | "cros/platform_constants_chromeos.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 149 | "payload_consumer/bzip_extent_writer.cc", |
| 150 | "payload_consumer/cached_file_descriptor.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 151 | "payload_consumer/certificate_parser_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 152 | "payload_consumer/delta_performer.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 153 | "payload_consumer/extent_reader.cc", |
| 154 | "payload_consumer/extent_writer.cc", |
| 155 | "payload_consumer/file_descriptor.cc", |
| 156 | "payload_consumer/file_descriptor_utils.cc", |
| 157 | "payload_consumer/file_writer.cc", |
| 158 | "payload_consumer/filesystem_verifier_action.cc", |
| 159 | "payload_consumer/install_plan.cc", |
| 160 | "payload_consumer/mount_history.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 161 | "payload_consumer/partition_update_generator_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 162 | "payload_consumer/payload_constants.cc", |
| 163 | "payload_consumer/payload_metadata.cc", |
| 164 | "payload_consumer/payload_verifier.cc", |
| 165 | "payload_consumer/postinstall_runner_action.cc", |
| 166 | "payload_consumer/verity_writer_stub.cc", |
| 167 | "payload_consumer/xz_extent_writer.cc", |
| 168 | ] |
| 169 | configs += [ ":target_defaults" ] |
| 170 | libs = [ |
| 171 | "bz2", |
| 172 | "rt", |
| 173 | ] |
| 174 | |
Allen Webb | 975e866 | 2020-05-14 14:33:13 -0700 | [diff] [blame] | 175 | # TODO(crbug.com/1082873): Remove after fixing usage of deprecated |
| 176 | # declarations. |
| 177 | cflags_cc = [ "-Wno-error=deprecated-declarations" ] |
| 178 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 179 | # TODO(deymo): Remove unused dependencies once we stop including files |
| 180 | # from the root directory. |
| 181 | all_dependent_pkg_deps = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 182 | "libbspatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 183 | "libcrypto", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 184 | "libpuffpatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 185 | "xz-embedded", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 186 | ] |
Tatsuhisa Yamaguchi | 74e47d9 | 2020-05-27 05:32:16 +0000 | [diff] [blame] | 187 | public_deps = [ ":update_metadata-protos" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 188 | } |
| 189 | |
| 190 | # The main daemon static_library with all the code used to check for updates |
| 191 | # with Omaha and expose a DBus daemon. |
| 192 | static_library("libupdate_engine") { |
| 193 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 194 | "certificate_checker.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 195 | "common/connection_utils.cc", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame] | 196 | "common/system_state.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 197 | "cros/boot_control_chromeos.cc", |
| 198 | "cros/common_service.cc", |
| 199 | "cros/connection_manager.cc", |
| 200 | "cros/daemon_chromeos.cc", |
| 201 | "cros/dbus_connection.cc", |
| 202 | "cros/dbus_service.cc", |
| 203 | "cros/hardware_chromeos.cc", |
| 204 | "cros/image_properties_chromeos.cc", |
| 205 | "cros/logging.cc", |
| 206 | "cros/metrics_reporter_omaha.cc", |
| 207 | "cros/omaha_request_action.cc", |
| 208 | "cros/omaha_request_builder_xml.cc", |
| 209 | "cros/omaha_request_params.cc", |
| 210 | "cros/omaha_response_handler_action.cc", |
| 211 | "cros/omaha_utils.cc", |
| 212 | "cros/p2p_manager.cc", |
| 213 | "cros/payload_state.cc", |
| 214 | "cros/power_manager_chromeos.cc", |
| 215 | "cros/real_system_state.cc", |
| 216 | "cros/requisition_util.cc", |
| 217 | "cros/shill_proxy.cc", |
| 218 | "cros/update_attempter.cc", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame] | 219 | "download_action.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 220 | "libcurl_http_fetcher.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 221 | "metrics_utils.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 222 | "update_boot_flags_action.cc", |
| 223 | "update_manager/boxed_value.cc", |
| 224 | "update_manager/chromeos_policy.cc", |
| 225 | "update_manager/default_policy.cc", |
| 226 | "update_manager/enough_slots_ab_updates_policy_impl.cc", |
| 227 | "update_manager/enterprise_device_policy_impl.cc", |
Saurabh Nijhara | ac83488 | 2020-11-11 14:10:47 +0100 | [diff] [blame^] | 228 | "update_manager/enterprise_rollback_policy_impl.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 229 | "update_manager/evaluation_context.cc", |
| 230 | "update_manager/interactive_update_policy_impl.cc", |
Saurabh Nijhara | 79fec2d | 2020-11-10 23:22:58 +0100 | [diff] [blame] | 231 | "update_manager/minimum_version_policy_impl.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 232 | "update_manager/next_update_check_policy_impl.cc", |
| 233 | "update_manager/official_build_check_policy_impl.cc", |
| 234 | "update_manager/out_of_box_experience_policy_impl.cc", |
| 235 | "update_manager/policy.cc", |
| 236 | "update_manager/policy_test_utils.cc", |
| 237 | "update_manager/real_config_provider.cc", |
| 238 | "update_manager/real_device_policy_provider.cc", |
| 239 | "update_manager/real_random_provider.cc", |
| 240 | "update_manager/real_shill_provider.cc", |
| 241 | "update_manager/real_system_provider.cc", |
| 242 | "update_manager/real_time_provider.cc", |
| 243 | "update_manager/real_updater_provider.cc", |
| 244 | "update_manager/staging_utils.cc", |
| 245 | "update_manager/state_factory.cc", |
| 246 | "update_manager/update_manager.cc", |
| 247 | "update_manager/update_time_restrictions_policy_impl.cc", |
| 248 | "update_manager/weekly_time.cc", |
| 249 | "update_status_utils.cc", |
| 250 | ] |
| 251 | configs += [ ":target_defaults" ] |
| 252 | libs = [ |
| 253 | "bz2", |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 254 | "policy", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 255 | "rootdev", |
| 256 | "rt", |
| 257 | ] |
| 258 | all_dependent_pkg_deps = [ |
| 259 | "dbus-1", |
| 260 | "expat", |
| 261 | "libcurl", |
| 262 | "libdebugd-client", |
Qijiang Fan | b9c8210 | 2020-08-28 16:06:33 +0900 | [diff] [blame] | 263 | "libmetrics", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 264 | "libpower_manager-client", |
| 265 | "libsession_manager-client", |
| 266 | "libshill-client", |
| 267 | "libssl", |
| 268 | "libupdate_engine-client", |
| 269 | "vboot_host", |
| 270 | ] |
| 271 | deps = [ |
| 272 | ":libpayload_consumer", |
| 273 | ":update_engine-dbus-adaptor", |
Amin Hassani | 64a8016 | 2020-11-09 16:58:17 -0800 | [diff] [blame] | 274 | ":update_engine-dbus-kiosk-app-client", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 275 | ":update_metadata-protos", |
| 276 | ] |
| 277 | |
| 278 | if (use.dlc) { |
| 279 | all_dependent_pkg_deps += [ "libdlcservice-client" ] |
| 280 | } |
| 281 | |
| 282 | if (use.chrome_network_proxy) { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 283 | sources += [ "cros/chrome_browser_proxy_resolver.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 284 | } |
| 285 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 286 | if (use.dlc) { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 287 | sources += [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 288 | "cros/dlcservice_chromeos.cc", |
| 289 | "cros/excluder_chromeos.cc", |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 290 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 291 | } else { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 292 | sources += [ |
| 293 | "common/dlcservice_stub.cc", |
| 294 | "common/excluder_stub.cc", |
| 295 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 296 | } |
| 297 | } |
| 298 | |
| 299 | # update_engine daemon. |
| 300 | executable("update_engine") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 301 | sources = [ "main.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 302 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 303 | deps = [ ":libupdate_engine" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 304 | } |
| 305 | |
| 306 | # update_engine client library. |
| 307 | static_library("libupdate_engine_client") { |
| 308 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 309 | "client_library/client_dbus.cc", |
| 310 | "update_status_utils.cc", |
| 311 | ] |
| 312 | include_dirs = [ "client_library/include" ] |
| 313 | configs += [ ":target_defaults" ] |
| 314 | pkg_deps = [ |
| 315 | "dbus-1", |
| 316 | "libupdate_engine-client", |
| 317 | ] |
| 318 | } |
| 319 | |
| 320 | # update_engine console client. |
| 321 | executable("update_engine_client") { |
| 322 | sources = [ |
| 323 | "common/error_code_utils.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 324 | "cros/omaha_utils.cc", |
| 325 | "cros/update_engine_client.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 326 | ] |
| 327 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 328 | deps = [ ":libupdate_engine_client" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 329 | } |
| 330 | |
| 331 | # server-side code. This is used for delta_generator and unittests but not |
| 332 | # for any client code. |
| 333 | static_library("libpayload_generator") { |
| 334 | sources = [ |
| 335 | "common/file_fetcher.cc", |
Amin Hassani | 538bd59 | 2020-11-04 20:46:08 -0800 | [diff] [blame] | 336 | "common/system_state.cc", |
| 337 | "cros/real_system_state.cc", |
| 338 | "download_action.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 339 | "payload_generator/ab_generator.cc", |
| 340 | "payload_generator/annotated_operation.cc", |
| 341 | "payload_generator/blob_file_writer.cc", |
| 342 | "payload_generator/block_mapping.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 343 | "payload_generator/boot_img_filesystem_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 344 | "payload_generator/bzip.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 345 | "payload_generator/deflate_utils.cc", |
| 346 | "payload_generator/delta_diff_generator.cc", |
| 347 | "payload_generator/delta_diff_utils.cc", |
| 348 | "payload_generator/ext2_filesystem.cc", |
| 349 | "payload_generator/extent_ranges.cc", |
| 350 | "payload_generator/extent_utils.cc", |
| 351 | "payload_generator/full_update_generator.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 352 | "payload_generator/mapfile_filesystem.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 353 | "payload_generator/merge_sequence_generator.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 354 | "payload_generator/payload_file.cc", |
| 355 | "payload_generator/payload_generation_config.cc", |
| 356 | "payload_generator/payload_generation_config_chromeos.cc", |
Amin Hassani | 7982100 | 2019-05-06 17:40:49 -0700 | [diff] [blame] | 357 | "payload_generator/payload_properties.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 358 | "payload_generator/payload_signer.cc", |
| 359 | "payload_generator/raw_filesystem.cc", |
| 360 | "payload_generator/squashfs_filesystem.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 361 | "payload_generator/xz_chromeos.cc", |
| 362 | ] |
| 363 | configs += [ ":target_defaults" ] |
| 364 | all_dependent_pkg_deps = [ |
| 365 | "ext2fs", |
| 366 | "libbsdiff", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 367 | "liblzma", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 368 | "libpuffdiff", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 369 | ] |
| 370 | deps = [ |
| 371 | ":libpayload_consumer", |
| 372 | ":update_metadata-protos", |
| 373 | ] |
Allen Webb | 975e866 | 2020-05-14 14:33:13 -0700 | [diff] [blame] | 374 | |
| 375 | # TODO(crbug.com/1082873): Remove after fixing usage of deprecated |
| 376 | # declarations. |
| 377 | cflags_cc = [ "-Wno-error=deprecated-declarations" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 378 | } |
| 379 | |
| 380 | # server-side delta generator. |
| 381 | executable("delta_generator") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 382 | sources = [ "payload_generator/generate_delta_main.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 383 | configs += [ ":target_defaults" ] |
| 384 | configs -= [ "//common-mk:pie" ] |
| 385 | deps = [ |
| 386 | ":libpayload_consumer", |
| 387 | ":libpayload_generator", |
| 388 | ] |
| 389 | } |
| 390 | |
| 391 | if (use.test || use.fuzzer) { |
| 392 | static_library("update_engine_test_libs") { |
| 393 | sources = [ |
| 394 | "common/fake_prefs.cc", |
| 395 | "common/mock_http_fetcher.cc", |
| 396 | "common/test_utils.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 397 | "cros/fake_shill_proxy.cc", |
| 398 | "cros/fake_system_state.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 399 | "payload_consumer/fake_file_descriptor.cc", |
| 400 | "payload_generator/fake_filesystem.cc", |
| 401 | "update_manager/umtest_utils.cc", |
| 402 | ] |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 403 | |
| 404 | # TODO(crbug.com/887845): After library odering issue is fixed, |
| 405 | # //common-mk:test can be moved in all_dependent_configs and |
| 406 | # //common-mk:test in each test configs can be removed. |
| 407 | configs += [ |
| 408 | "//common-mk:test", |
| 409 | ":target_defaults", |
| 410 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 411 | pkg_deps = [ "libshill-client-test" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 412 | deps = [ ":libupdate_engine" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 413 | } |
| 414 | } |
| 415 | |
| 416 | if (use.test) { |
| 417 | # Public keys used for unit testing. |
| 418 | genopenssl_key("update_engine-testkeys") { |
| 419 | openssl_pem_in_dir = "." |
| 420 | openssl_pem_out_dir = "include/update_engine" |
| 421 | sources = [ |
| 422 | "unittest_key.pem", |
| 423 | "unittest_key2.pem", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 424 | "unittest_key_RSA4096.pem", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 425 | ] |
| 426 | } |
| 427 | |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame] | 428 | genopenssl_key("update_engine-testkeys-ec") { |
| 429 | openssl_pem_in_dir = "." |
| 430 | openssl_pem_out_dir = "include/update_engine" |
| 431 | openssl_pem_algorithm = "ec" |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 432 | sources = [ "unittest_key_EC.pem" ] |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame] | 433 | } |
| 434 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 435 | # Unpacks sample images used for testing. |
| 436 | tar_bunzip2("update_engine-test_images") { |
| 437 | image_out_dir = "." |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 438 | sources = [ "sample_images/sample_images.tar.bz2" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 439 | } |
| 440 | |
| 441 | # Test HTTP Server. |
| 442 | executable("test_http_server") { |
| 443 | sources = [ |
| 444 | "common/http_common.cc", |
| 445 | "test_http_server.cc", |
| 446 | ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 447 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 448 | # //common-mk:test should be on the top. |
| 449 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 450 | configs += [ |
| 451 | "//common-mk:test", |
| 452 | ":target_defaults", |
| 453 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 454 | } |
| 455 | |
| 456 | # Test subprocess helper. |
| 457 | executable("test_subprocess") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 458 | sources = [ "test_subprocess.cc" ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 459 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 460 | # //common-mk:test should be on the top. |
| 461 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 462 | configs += [ |
| 463 | "//common-mk:test", |
| 464 | ":target_defaults", |
| 465 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 466 | } |
| 467 | |
| 468 | # Main unittest file. |
| 469 | executable("update_engine_unittests") { |
| 470 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 471 | "certificate_checker_unittest.cc", |
| 472 | "common/action_pipe_unittest.cc", |
| 473 | "common/action_processor_unittest.cc", |
| 474 | "common/action_unittest.cc", |
| 475 | "common/cpu_limiter_unittest.cc", |
| 476 | "common/hash_calculator_unittest.cc", |
| 477 | "common/http_fetcher_unittest.cc", |
| 478 | "common/hwid_override_unittest.cc", |
| 479 | "common/prefs_unittest.cc", |
| 480 | "common/proxy_resolver_unittest.cc", |
| 481 | "common/subprocess_unittest.cc", |
| 482 | "common/terminator_unittest.cc", |
| 483 | "common/utils_unittest.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 484 | "cros/boot_control_chromeos_unittest.cc", |
| 485 | "cros/common_service_unittest.cc", |
| 486 | "cros/connection_manager_unittest.cc", |
| 487 | "cros/hardware_chromeos_unittest.cc", |
| 488 | "cros/image_properties_chromeos_unittest.cc", |
| 489 | "cros/metrics_reporter_omaha_unittest.cc", |
| 490 | "cros/omaha_request_action_unittest.cc", |
| 491 | "cros/omaha_request_builder_xml_unittest.cc", |
| 492 | "cros/omaha_request_params_unittest.cc", |
| 493 | "cros/omaha_response_handler_action_unittest.cc", |
| 494 | "cros/omaha_utils_unittest.cc", |
| 495 | "cros/p2p_manager_unittest.cc", |
| 496 | "cros/payload_state_unittest.cc", |
| 497 | "cros/requisition_util_unittest.cc", |
| 498 | "cros/update_attempter_unittest.cc", |
| 499 | "download_action_unittest.cc", |
Jae Hoon Kim | 0ae8fe1 | 2019-06-26 14:32:50 -0700 | [diff] [blame] | 500 | "libcurl_http_fetcher_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 501 | "metrics_utils_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 502 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 503 | "payload_consumer/cached_file_descriptor_unittest.cc", |
| 504 | "payload_consumer/delta_performer_integration_test.cc", |
| 505 | "payload_consumer/delta_performer_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 506 | "payload_consumer/extent_reader_unittest.cc", |
| 507 | "payload_consumer/extent_writer_unittest.cc", |
| 508 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 509 | "payload_consumer/file_writer_unittest.cc", |
| 510 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
| 511 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 512 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 513 | "payload_generator/ab_generator_unittest.cc", |
| 514 | "payload_generator/blob_file_writer_unittest.cc", |
| 515 | "payload_generator/block_mapping_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 516 | "payload_generator/deflate_utils_unittest.cc", |
| 517 | "payload_generator/delta_diff_utils_unittest.cc", |
| 518 | "payload_generator/ext2_filesystem_unittest.cc", |
| 519 | "payload_generator/extent_ranges_unittest.cc", |
| 520 | "payload_generator/extent_utils_unittest.cc", |
| 521 | "payload_generator/full_update_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 522 | "payload_generator/mapfile_filesystem_unittest.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 523 | "payload_generator/merge_sequence_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 524 | "payload_generator/payload_file_unittest.cc", |
| 525 | "payload_generator/payload_generation_config_unittest.cc", |
Jae Hoon Kim | 4b6d126 | 2019-06-20 10:41:18 -0700 | [diff] [blame] | 526 | "payload_generator/payload_properties_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 527 | "payload_generator/payload_signer_unittest.cc", |
| 528 | "payload_generator/squashfs_filesystem_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 529 | "payload_generator/zip_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 530 | "testrunner.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 531 | "update_boot_flags_action_unittest.cc", |
| 532 | "update_manager/boxed_value_unittest.cc", |
| 533 | "update_manager/chromeos_policy_unittest.cc", |
Miriam Polzer | aff7200 | 2020-08-27 08:20:39 +0200 | [diff] [blame] | 534 | "update_manager/enterprise_device_policy_impl_unittest.cc", |
Saurabh Nijhara | ac83488 | 2020-11-11 14:10:47 +0100 | [diff] [blame^] | 535 | "update_manager/enterprise_rollback_policy_impl_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 536 | "update_manager/evaluation_context_unittest.cc", |
| 537 | "update_manager/generic_variables_unittest.cc", |
Saurabh Nijhara | 79fec2d | 2020-11-10 23:22:58 +0100 | [diff] [blame] | 538 | "update_manager/minimum_version_policy_impl_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 539 | "update_manager/prng_unittest.cc", |
| 540 | "update_manager/real_device_policy_provider_unittest.cc", |
| 541 | "update_manager/real_random_provider_unittest.cc", |
| 542 | "update_manager/real_shill_provider_unittest.cc", |
| 543 | "update_manager/real_system_provider_unittest.cc", |
| 544 | "update_manager/real_time_provider_unittest.cc", |
| 545 | "update_manager/real_updater_provider_unittest.cc", |
| 546 | "update_manager/staging_utils_unittest.cc", |
| 547 | "update_manager/update_manager_unittest.cc", |
| 548 | "update_manager/update_time_restrictions_policy_impl_unittest.cc", |
| 549 | "update_manager/variable_unittest.cc", |
| 550 | "update_manager/weekly_time_unittest.cc", |
Jae Hoon Kim | 916af85 | 2019-08-01 17:45:30 -0700 | [diff] [blame] | 551 | "update_status_utils_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 552 | ] |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 553 | if (use.dlc) { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 554 | sources += [ "cros/excluder_chromeos_unittest.cc" ] |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 555 | } |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 556 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 557 | # //common-mk:test should be on the top. |
| 558 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 559 | configs += [ |
| 560 | "//common-mk:test", |
| 561 | ":target_defaults", |
| 562 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 563 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 564 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 565 | "libchrome-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 566 | "libdebugd-client-test", |
| 567 | "libpower_manager-client-test", |
| 568 | "libsession_manager-client-test", |
| 569 | "libshill-client-test", |
| 570 | ] |
| 571 | deps = [ |
| 572 | ":libpayload_generator", |
| 573 | ":libupdate_engine", |
| 574 | ":update_engine_test_libs", |
| 575 | ] |
| 576 | } |
| 577 | } |
| 578 | |
| 579 | # Fuzzer target. |
| 580 | if (use.fuzzer) { |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 581 | executable("update_engine_delta_performer_fuzzer") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 582 | sources = [ "payload_consumer/delta_performer_fuzzer.cc" ] |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 583 | configs += [ |
| 584 | "//common-mk/common_fuzzer", |
| 585 | ":target_defaults", |
| 586 | ] |
| 587 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 588 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 589 | "libchrome-test", |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 590 | ] |
| 591 | deps = [ |
| 592 | ":libupdate_engine", |
| 593 | ":update_engine_test_libs", |
| 594 | ] |
| 595 | } |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 596 | executable("update_engine_omaha_request_action_fuzzer") { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 597 | sources = [ "cros/omaha_request_action_fuzzer.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 598 | configs += [ |
| 599 | "//common-mk/common_fuzzer", |
| 600 | ":target_defaults", |
| 601 | ] |
| 602 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 603 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 604 | "libchrome-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 605 | ] |
| 606 | deps = [ |
| 607 | ":libupdate_engine", |
| 608 | ":update_engine_test_libs", |
| 609 | ] |
| 610 | } |
| 611 | } |