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}", |
| 84 | "USE_CHROME_KIOSK_APP=${use.chrome_kiosk_app}", |
| 85 | "USE_CHROME_NETWORK_PROXY=${use.chrome_network_proxy}", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 86 | "USE_SHILL=1", |
| 87 | ] |
| 88 | include_dirs = [ |
| 89 | # We need this include dir because we include all the local code as |
| 90 | # "update_engine/...". |
| 91 | "${platform2_root}", |
| 92 | "${platform2_root}/update_engine/client_library/include", |
| 93 | ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 94 | |
| 95 | # NOSORT |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 96 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 97 | "libbrillo", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 98 | "libchrome-${libbase_ver}", |
| 99 | |
| 100 | # system_api depends on protobuf (or protobuf-lite). It must appear |
| 101 | # before protobuf here or the linker flags won't be in the right |
| 102 | # order. |
| 103 | "system_api", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 104 | ] |
Allen Webb | 816193f | 2019-10-25 10:06:46 -0700 | [diff] [blame] | 105 | if (use.fuzzer) { |
| 106 | pkg_deps += [ "protobuf" ] |
| 107 | } else { |
| 108 | pkg_deps += [ "protobuf-lite" ] |
| 109 | } |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 110 | } |
| 111 | |
| 112 | # Protobufs. |
| 113 | proto_library("update_metadata-protos") { |
| 114 | proto_in_dir = "." |
| 115 | proto_out_dir = "include/update_engine" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 116 | sources = [ "update_metadata.proto" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 117 | } |
| 118 | |
| 119 | # Chrome D-Bus bindings. |
| 120 | generate_dbus_adaptors("update_engine-dbus-adaptor") { |
| 121 | dbus_adaptors_out_dir = "include/dbus_bindings" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 122 | sources = [ "dbus_bindings/org.chromium.UpdateEngineInterface.dbus-xml" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 123 | } |
| 124 | |
| 125 | generate_dbus_proxies("update_engine-dbus-kiosk-app-client") { |
| 126 | mock_output_file = "include/kiosk-app/dbus-proxy-mocks.h" |
| 127 | proxy_output_file = "include/kiosk-app/dbus-proxies.h" |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 128 | sources = [ "dbus_bindings/org.chromium.KioskAppService.dbus-xml" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 129 | } |
| 130 | |
| 131 | # The payload application component and common dependencies. |
| 132 | static_library("libpayload_consumer") { |
| 133 | sources = [ |
| 134 | "common/action_processor.cc", |
| 135 | "common/boot_control_stub.cc", |
| 136 | "common/clock.cc", |
| 137 | "common/constants.cc", |
| 138 | "common/cpu_limiter.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 139 | "common/dynamic_partition_control_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 140 | "common/error_code_utils.cc", |
| 141 | "common/hash_calculator.cc", |
| 142 | "common/http_common.cc", |
| 143 | "common/http_fetcher.cc", |
| 144 | "common/hwid_override.cc", |
| 145 | "common/multi_range_http_fetcher.cc", |
| 146 | "common/platform_constants_chromeos.cc", |
| 147 | "common/prefs.cc", |
| 148 | "common/proxy_resolver.cc", |
| 149 | "common/subprocess.cc", |
| 150 | "common/terminator.cc", |
| 151 | "common/utils.cc", |
| 152 | "payload_consumer/bzip_extent_writer.cc", |
| 153 | "payload_consumer/cached_file_descriptor.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 154 | "payload_consumer/certificate_parser_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 155 | "payload_consumer/delta_performer.cc", |
| 156 | "payload_consumer/download_action.cc", |
| 157 | "payload_consumer/extent_reader.cc", |
| 158 | "payload_consumer/extent_writer.cc", |
| 159 | "payload_consumer/file_descriptor.cc", |
| 160 | "payload_consumer/file_descriptor_utils.cc", |
| 161 | "payload_consumer/file_writer.cc", |
| 162 | "payload_consumer/filesystem_verifier_action.cc", |
| 163 | "payload_consumer/install_plan.cc", |
| 164 | "payload_consumer/mount_history.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 165 | "payload_consumer/partition_update_generator_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 166 | "payload_consumer/payload_constants.cc", |
| 167 | "payload_consumer/payload_metadata.cc", |
| 168 | "payload_consumer/payload_verifier.cc", |
| 169 | "payload_consumer/postinstall_runner_action.cc", |
| 170 | "payload_consumer/verity_writer_stub.cc", |
| 171 | "payload_consumer/xz_extent_writer.cc", |
| 172 | ] |
| 173 | configs += [ ":target_defaults" ] |
| 174 | libs = [ |
| 175 | "bz2", |
| 176 | "rt", |
| 177 | ] |
| 178 | |
Allen Webb | 975e866 | 2020-05-14 14:33:13 -0700 | [diff] [blame] | 179 | # TODO(crbug.com/1082873): Remove after fixing usage of deprecated |
| 180 | # declarations. |
| 181 | cflags_cc = [ "-Wno-error=deprecated-declarations" ] |
| 182 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 183 | # TODO(deymo): Remove unused dependencies once we stop including files |
| 184 | # from the root directory. |
| 185 | all_dependent_pkg_deps = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 186 | "libbspatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 187 | "libcrypto", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 188 | "libpuffpatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 189 | "xz-embedded", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 190 | ] |
Tatsuhisa Yamaguchi | 74e47d9 | 2020-05-27 05:32:16 +0000 | [diff] [blame] | 191 | public_deps = [ ":update_metadata-protos" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 192 | } |
| 193 | |
| 194 | # The main daemon static_library with all the code used to check for updates |
| 195 | # with Omaha and expose a DBus daemon. |
| 196 | static_library("libupdate_engine") { |
| 197 | sources = [ |
| 198 | "boot_control_chromeos.cc", |
| 199 | "certificate_checker.cc", |
| 200 | "common_service.cc", |
| 201 | "connection_manager.cc", |
| 202 | "connection_utils.cc", |
Amin Hassani | 565331e | 2019-06-24 14:11:29 -0700 | [diff] [blame] | 203 | "daemon_chromeos.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 204 | "dbus_connection.cc", |
| 205 | "dbus_service.cc", |
| 206 | "hardware_chromeos.cc", |
| 207 | "image_properties_chromeos.cc", |
| 208 | "libcurl_http_fetcher.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 209 | "logging.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 210 | "metrics_reporter_omaha.cc", |
| 211 | "metrics_utils.cc", |
| 212 | "omaha_request_action.cc", |
| 213 | "omaha_request_builder_xml.cc", |
| 214 | "omaha_request_params.cc", |
| 215 | "omaha_response_handler_action.cc", |
| 216 | "omaha_utils.cc", |
| 217 | "p2p_manager.cc", |
| 218 | "payload_state.cc", |
| 219 | "power_manager_chromeos.cc", |
| 220 | "real_system_state.cc", |
Matt Ziegelbaum | 91ba9be | 2020-06-10 16:56:40 -0400 | [diff] [blame] | 221 | "requisition_util.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 222 | "shill_proxy.cc", |
| 223 | "update_attempter.cc", |
| 224 | "update_boot_flags_action.cc", |
| 225 | "update_manager/boxed_value.cc", |
| 226 | "update_manager/chromeos_policy.cc", |
| 227 | "update_manager/default_policy.cc", |
| 228 | "update_manager/enough_slots_ab_updates_policy_impl.cc", |
| 229 | "update_manager/enterprise_device_policy_impl.cc", |
| 230 | "update_manager/evaluation_context.cc", |
| 231 | "update_manager/interactive_update_policy_impl.cc", |
| 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", |
| 274 | ":update_metadata-protos", |
| 275 | ] |
| 276 | |
| 277 | if (use.dlc) { |
| 278 | all_dependent_pkg_deps += [ "libdlcservice-client" ] |
| 279 | } |
| 280 | |
| 281 | if (use.chrome_network_proxy) { |
| 282 | sources += [ "chrome_browser_proxy_resolver.cc" ] |
| 283 | } |
| 284 | |
| 285 | if (use.chrome_kiosk_app) { |
| 286 | deps += [ ":update_engine-dbus-kiosk-app-client" ] |
| 287 | } |
| 288 | |
| 289 | if (use.dlc) { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 290 | sources += [ |
| 291 | "dlcservice_chromeos.cc", |
| 292 | "excluder_chromeos.cc", |
| 293 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 294 | } else { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 295 | sources += [ |
| 296 | "common/dlcservice_stub.cc", |
| 297 | "common/excluder_stub.cc", |
| 298 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 299 | } |
| 300 | } |
| 301 | |
| 302 | # update_engine daemon. |
| 303 | executable("update_engine") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 304 | sources = [ "main.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 305 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 306 | deps = [ ":libupdate_engine" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 307 | } |
| 308 | |
| 309 | # update_engine client library. |
| 310 | static_library("libupdate_engine_client") { |
| 311 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 312 | "client_library/client_dbus.cc", |
| 313 | "update_status_utils.cc", |
| 314 | ] |
| 315 | include_dirs = [ "client_library/include" ] |
| 316 | configs += [ ":target_defaults" ] |
| 317 | pkg_deps = [ |
| 318 | "dbus-1", |
| 319 | "libupdate_engine-client", |
| 320 | ] |
| 321 | } |
| 322 | |
| 323 | # update_engine console client. |
| 324 | executable("update_engine_client") { |
| 325 | sources = [ |
| 326 | "common/error_code_utils.cc", |
| 327 | "omaha_utils.cc", |
| 328 | "update_engine_client.cc", |
| 329 | ] |
| 330 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 331 | deps = [ ":libupdate_engine_client" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 332 | } |
| 333 | |
| 334 | # server-side code. This is used for delta_generator and unittests but not |
| 335 | # for any client code. |
| 336 | static_library("libpayload_generator") { |
| 337 | sources = [ |
| 338 | "common/file_fetcher.cc", |
| 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", |
| 397 | "fake_shill_proxy.cc", |
| 398 | "fake_system_state.cc", |
| 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", |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame^] | 423 | "unittest_key_RSA4096.pem", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 424 | "unittest_key2.pem", |
| 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" |
| 432 | sources = [ |
| 433 | "unittest_key_EC.pem", |
| 434 | ] |
| 435 | } |
| 436 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 437 | # Unpacks sample images used for testing. |
| 438 | tar_bunzip2("update_engine-test_images") { |
| 439 | image_out_dir = "." |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 440 | sources = [ "sample_images/sample_images.tar.bz2" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 441 | } |
| 442 | |
| 443 | # Test HTTP Server. |
| 444 | executable("test_http_server") { |
| 445 | sources = [ |
| 446 | "common/http_common.cc", |
| 447 | "test_http_server.cc", |
| 448 | ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 449 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 450 | # //common-mk:test should be on the top. |
| 451 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 452 | configs += [ |
| 453 | "//common-mk:test", |
| 454 | ":target_defaults", |
| 455 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 456 | } |
| 457 | |
| 458 | # Test subprocess helper. |
| 459 | executable("test_subprocess") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 460 | sources = [ "test_subprocess.cc" ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 461 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 462 | # //common-mk:test should be on the top. |
| 463 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 464 | configs += [ |
| 465 | "//common-mk:test", |
| 466 | ":target_defaults", |
| 467 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 468 | } |
| 469 | |
| 470 | # Main unittest file. |
| 471 | executable("update_engine_unittests") { |
| 472 | sources = [ |
| 473 | "boot_control_chromeos_unittest.cc", |
| 474 | "certificate_checker_unittest.cc", |
| 475 | "common/action_pipe_unittest.cc", |
| 476 | "common/action_processor_unittest.cc", |
| 477 | "common/action_unittest.cc", |
| 478 | "common/cpu_limiter_unittest.cc", |
| 479 | "common/hash_calculator_unittest.cc", |
| 480 | "common/http_fetcher_unittest.cc", |
| 481 | "common/hwid_override_unittest.cc", |
| 482 | "common/prefs_unittest.cc", |
| 483 | "common/proxy_resolver_unittest.cc", |
| 484 | "common/subprocess_unittest.cc", |
| 485 | "common/terminator_unittest.cc", |
| 486 | "common/utils_unittest.cc", |
| 487 | "common_service_unittest.cc", |
| 488 | "connection_manager_unittest.cc", |
| 489 | "hardware_chromeos_unittest.cc", |
| 490 | "image_properties_chromeos_unittest.cc", |
Jae Hoon Kim | 0ae8fe1 | 2019-06-26 14:32:50 -0700 | [diff] [blame] | 491 | "libcurl_http_fetcher_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 492 | "metrics_reporter_omaha_unittest.cc", |
| 493 | "metrics_utils_unittest.cc", |
| 494 | "omaha_request_action_unittest.cc", |
| 495 | "omaha_request_builder_xml_unittest.cc", |
| 496 | "omaha_request_params_unittest.cc", |
| 497 | "omaha_response_handler_action_unittest.cc", |
| 498 | "omaha_utils_unittest.cc", |
| 499 | "p2p_manager_unittest.cc", |
| 500 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 501 | "payload_consumer/cached_file_descriptor_unittest.cc", |
| 502 | "payload_consumer/delta_performer_integration_test.cc", |
| 503 | "payload_consumer/delta_performer_unittest.cc", |
| 504 | "payload_consumer/download_action_unittest.cc", |
| 505 | "payload_consumer/extent_reader_unittest.cc", |
| 506 | "payload_consumer/extent_writer_unittest.cc", |
| 507 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 508 | "payload_consumer/file_writer_unittest.cc", |
| 509 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
| 510 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 511 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 512 | "payload_generator/ab_generator_unittest.cc", |
| 513 | "payload_generator/blob_file_writer_unittest.cc", |
| 514 | "payload_generator/block_mapping_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 515 | "payload_generator/deflate_utils_unittest.cc", |
| 516 | "payload_generator/delta_diff_utils_unittest.cc", |
| 517 | "payload_generator/ext2_filesystem_unittest.cc", |
| 518 | "payload_generator/extent_ranges_unittest.cc", |
| 519 | "payload_generator/extent_utils_unittest.cc", |
| 520 | "payload_generator/full_update_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 521 | "payload_generator/mapfile_filesystem_unittest.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 522 | "payload_generator/merge_sequence_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 523 | "payload_generator/payload_file_unittest.cc", |
| 524 | "payload_generator/payload_generation_config_unittest.cc", |
Jae Hoon Kim | 4b6d126 | 2019-06-20 10:41:18 -0700 | [diff] [blame] | 525 | "payload_generator/payload_properties_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 526 | "payload_generator/payload_signer_unittest.cc", |
| 527 | "payload_generator/squashfs_filesystem_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 528 | "payload_generator/zip_unittest.cc", |
| 529 | "payload_state_unittest.cc", |
Matt Ziegelbaum | 91ba9be | 2020-06-10 16:56:40 -0400 | [diff] [blame] | 530 | "requisition_util_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 531 | "testrunner.cc", |
| 532 | "update_attempter_unittest.cc", |
| 533 | "update_boot_flags_action_unittest.cc", |
| 534 | "update_manager/boxed_value_unittest.cc", |
| 535 | "update_manager/chromeos_policy_unittest.cc", |
| 536 | "update_manager/evaluation_context_unittest.cc", |
| 537 | "update_manager/generic_variables_unittest.cc", |
| 538 | "update_manager/prng_unittest.cc", |
| 539 | "update_manager/real_device_policy_provider_unittest.cc", |
| 540 | "update_manager/real_random_provider_unittest.cc", |
| 541 | "update_manager/real_shill_provider_unittest.cc", |
| 542 | "update_manager/real_system_provider_unittest.cc", |
| 543 | "update_manager/real_time_provider_unittest.cc", |
| 544 | "update_manager/real_updater_provider_unittest.cc", |
| 545 | "update_manager/staging_utils_unittest.cc", |
| 546 | "update_manager/update_manager_unittest.cc", |
| 547 | "update_manager/update_time_restrictions_policy_impl_unittest.cc", |
| 548 | "update_manager/variable_unittest.cc", |
| 549 | "update_manager/weekly_time_unittest.cc", |
Jae Hoon Kim | 916af85 | 2019-08-01 17:45:30 -0700 | [diff] [blame] | 550 | "update_status_utils_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 551 | ] |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 552 | if (use.dlc) { |
| 553 | sources += [ "excluder_chromeos_unittest.cc" ] |
| 554 | } |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 555 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 556 | # //common-mk:test should be on the top. |
| 557 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 558 | configs += [ |
| 559 | "//common-mk:test", |
| 560 | ":target_defaults", |
| 561 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 562 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 563 | "libbrillo-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 564 | "libchrome-test-${libbase_ver}", |
| 565 | "libdebugd-client-test", |
| 566 | "libpower_manager-client-test", |
| 567 | "libsession_manager-client-test", |
| 568 | "libshill-client-test", |
| 569 | ] |
| 570 | deps = [ |
| 571 | ":libpayload_generator", |
| 572 | ":libupdate_engine", |
| 573 | ":update_engine_test_libs", |
| 574 | ] |
| 575 | } |
| 576 | } |
| 577 | |
| 578 | # Fuzzer target. |
| 579 | if (use.fuzzer) { |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 580 | executable("update_engine_delta_performer_fuzzer") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 581 | sources = [ "payload_consumer/delta_performer_fuzzer.cc" ] |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 582 | configs += [ |
| 583 | "//common-mk/common_fuzzer", |
| 584 | ":target_defaults", |
| 585 | ] |
| 586 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 587 | "libbrillo-test", |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 588 | "libchrome-test-${libbase_ver}", |
| 589 | ] |
| 590 | deps = [ |
| 591 | ":libupdate_engine", |
| 592 | ":update_engine_test_libs", |
| 593 | ] |
| 594 | } |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 595 | executable("update_engine_omaha_request_action_fuzzer") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 596 | sources = [ "omaha_request_action_fuzzer.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 597 | configs += [ |
| 598 | "//common-mk/common_fuzzer", |
| 599 | ":target_defaults", |
| 600 | ] |
| 601 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 602 | "libbrillo-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 603 | "libchrome-test-${libbase_ver}", |
| 604 | ] |
| 605 | deps = [ |
| 606 | ":libupdate_engine", |
| 607 | ":update_engine_test_libs", |
| 608 | ] |
| 609 | } |
| 610 | } |