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", |
| 149 | "download_action.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 150 | "payload_consumer/bzip_extent_writer.cc", |
| 151 | "payload_consumer/cached_file_descriptor.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 152 | "payload_consumer/certificate_parser_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 153 | "payload_consumer/delta_performer.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 154 | "payload_consumer/extent_reader.cc", |
| 155 | "payload_consumer/extent_writer.cc", |
| 156 | "payload_consumer/file_descriptor.cc", |
| 157 | "payload_consumer/file_descriptor_utils.cc", |
| 158 | "payload_consumer/file_writer.cc", |
| 159 | "payload_consumer/filesystem_verifier_action.cc", |
| 160 | "payload_consumer/install_plan.cc", |
| 161 | "payload_consumer/mount_history.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 162 | "payload_consumer/partition_update_generator_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 163 | "payload_consumer/payload_constants.cc", |
| 164 | "payload_consumer/payload_metadata.cc", |
| 165 | "payload_consumer/payload_verifier.cc", |
| 166 | "payload_consumer/postinstall_runner_action.cc", |
| 167 | "payload_consumer/verity_writer_stub.cc", |
| 168 | "payload_consumer/xz_extent_writer.cc", |
| 169 | ] |
| 170 | configs += [ ":target_defaults" ] |
| 171 | libs = [ |
| 172 | "bz2", |
| 173 | "rt", |
| 174 | ] |
| 175 | |
Allen Webb | 975e866 | 2020-05-14 14:33:13 -0700 | [diff] [blame] | 176 | # TODO(crbug.com/1082873): Remove after fixing usage of deprecated |
| 177 | # declarations. |
| 178 | cflags_cc = [ "-Wno-error=deprecated-declarations" ] |
| 179 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 180 | # TODO(deymo): Remove unused dependencies once we stop including files |
| 181 | # from the root directory. |
| 182 | all_dependent_pkg_deps = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 183 | "libbspatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 184 | "libcrypto", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 185 | "libpuffpatch", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 186 | "xz-embedded", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 187 | ] |
Tatsuhisa Yamaguchi | 74e47d9 | 2020-05-27 05:32:16 +0000 | [diff] [blame] | 188 | public_deps = [ ":update_metadata-protos" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 189 | } |
| 190 | |
| 191 | # The main daemon static_library with all the code used to check for updates |
| 192 | # with Omaha and expose a DBus daemon. |
| 193 | static_library("libupdate_engine") { |
| 194 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 195 | "certificate_checker.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 196 | "common/connection_utils.cc", |
| 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", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 219 | "libcurl_http_fetcher.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 220 | "metrics_utils.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 221 | "update_boot_flags_action.cc", |
| 222 | "update_manager/boxed_value.cc", |
| 223 | "update_manager/chromeos_policy.cc", |
| 224 | "update_manager/default_policy.cc", |
| 225 | "update_manager/enough_slots_ab_updates_policy_impl.cc", |
| 226 | "update_manager/enterprise_device_policy_impl.cc", |
| 227 | "update_manager/evaluation_context.cc", |
| 228 | "update_manager/interactive_update_policy_impl.cc", |
Saurabh Nijhara | 79fec2d | 2020-11-10 23:22:58 +0100 | [diff] [blame^] | 229 | "update_manager/minimum_version_policy_impl.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 230 | "update_manager/next_update_check_policy_impl.cc", |
| 231 | "update_manager/official_build_check_policy_impl.cc", |
| 232 | "update_manager/out_of_box_experience_policy_impl.cc", |
| 233 | "update_manager/policy.cc", |
| 234 | "update_manager/policy_test_utils.cc", |
| 235 | "update_manager/real_config_provider.cc", |
| 236 | "update_manager/real_device_policy_provider.cc", |
| 237 | "update_manager/real_random_provider.cc", |
| 238 | "update_manager/real_shill_provider.cc", |
| 239 | "update_manager/real_system_provider.cc", |
| 240 | "update_manager/real_time_provider.cc", |
| 241 | "update_manager/real_updater_provider.cc", |
| 242 | "update_manager/staging_utils.cc", |
| 243 | "update_manager/state_factory.cc", |
| 244 | "update_manager/update_manager.cc", |
| 245 | "update_manager/update_time_restrictions_policy_impl.cc", |
| 246 | "update_manager/weekly_time.cc", |
| 247 | "update_status_utils.cc", |
| 248 | ] |
| 249 | configs += [ ":target_defaults" ] |
| 250 | libs = [ |
| 251 | "bz2", |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 252 | "policy", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 253 | "rootdev", |
| 254 | "rt", |
| 255 | ] |
| 256 | all_dependent_pkg_deps = [ |
| 257 | "dbus-1", |
| 258 | "expat", |
| 259 | "libcurl", |
| 260 | "libdebugd-client", |
Qijiang Fan | b9c8210 | 2020-08-28 16:06:33 +0900 | [diff] [blame] | 261 | "libmetrics", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 262 | "libpower_manager-client", |
| 263 | "libsession_manager-client", |
| 264 | "libshill-client", |
| 265 | "libssl", |
| 266 | "libupdate_engine-client", |
| 267 | "vboot_host", |
| 268 | ] |
| 269 | deps = [ |
| 270 | ":libpayload_consumer", |
| 271 | ":update_engine-dbus-adaptor", |
Amin Hassani | 64a8016 | 2020-11-09 16:58:17 -0800 | [diff] [blame] | 272 | ":update_engine-dbus-kiosk-app-client", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 273 | ":update_metadata-protos", |
| 274 | ] |
| 275 | |
| 276 | if (use.dlc) { |
| 277 | all_dependent_pkg_deps += [ "libdlcservice-client" ] |
| 278 | } |
| 279 | |
| 280 | if (use.chrome_network_proxy) { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 281 | sources += [ "cros/chrome_browser_proxy_resolver.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 282 | } |
| 283 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 284 | if (use.dlc) { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 285 | sources += [ |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 286 | "cros/dlcservice_chromeos.cc", |
| 287 | "cros/excluder_chromeos.cc", |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 288 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 289 | } else { |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 290 | sources += [ |
| 291 | "common/dlcservice_stub.cc", |
| 292 | "common/excluder_stub.cc", |
| 293 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 294 | } |
| 295 | } |
| 296 | |
| 297 | # update_engine daemon. |
| 298 | executable("update_engine") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 299 | sources = [ "main.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 300 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 301 | deps = [ ":libupdate_engine" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 302 | } |
| 303 | |
| 304 | # update_engine client library. |
| 305 | static_library("libupdate_engine_client") { |
| 306 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 307 | "client_library/client_dbus.cc", |
| 308 | "update_status_utils.cc", |
| 309 | ] |
| 310 | include_dirs = [ "client_library/include" ] |
| 311 | configs += [ ":target_defaults" ] |
| 312 | pkg_deps = [ |
| 313 | "dbus-1", |
| 314 | "libupdate_engine-client", |
| 315 | ] |
| 316 | } |
| 317 | |
| 318 | # update_engine console client. |
| 319 | executable("update_engine_client") { |
| 320 | sources = [ |
| 321 | "common/error_code_utils.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 322 | "cros/omaha_utils.cc", |
| 323 | "cros/update_engine_client.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 324 | ] |
| 325 | configs += [ ":target_defaults" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 326 | deps = [ ":libupdate_engine_client" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 327 | } |
| 328 | |
| 329 | # server-side code. This is used for delta_generator and unittests but not |
| 330 | # for any client code. |
| 331 | static_library("libpayload_generator") { |
| 332 | sources = [ |
| 333 | "common/file_fetcher.cc", |
| 334 | "payload_generator/ab_generator.cc", |
| 335 | "payload_generator/annotated_operation.cc", |
| 336 | "payload_generator/blob_file_writer.cc", |
| 337 | "payload_generator/block_mapping.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 338 | "payload_generator/boot_img_filesystem_stub.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 339 | "payload_generator/bzip.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 340 | "payload_generator/deflate_utils.cc", |
| 341 | "payload_generator/delta_diff_generator.cc", |
| 342 | "payload_generator/delta_diff_utils.cc", |
| 343 | "payload_generator/ext2_filesystem.cc", |
| 344 | "payload_generator/extent_ranges.cc", |
| 345 | "payload_generator/extent_utils.cc", |
| 346 | "payload_generator/full_update_generator.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 347 | "payload_generator/mapfile_filesystem.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 348 | "payload_generator/merge_sequence_generator.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 349 | "payload_generator/payload_file.cc", |
| 350 | "payload_generator/payload_generation_config.cc", |
| 351 | "payload_generator/payload_generation_config_chromeos.cc", |
Amin Hassani | 7982100 | 2019-05-06 17:40:49 -0700 | [diff] [blame] | 352 | "payload_generator/payload_properties.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 353 | "payload_generator/payload_signer.cc", |
| 354 | "payload_generator/raw_filesystem.cc", |
| 355 | "payload_generator/squashfs_filesystem.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 356 | "payload_generator/xz_chromeos.cc", |
| 357 | ] |
| 358 | configs += [ ":target_defaults" ] |
| 359 | all_dependent_pkg_deps = [ |
| 360 | "ext2fs", |
| 361 | "libbsdiff", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 362 | "liblzma", |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 363 | "libpuffdiff", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 364 | ] |
| 365 | deps = [ |
| 366 | ":libpayload_consumer", |
| 367 | ":update_metadata-protos", |
| 368 | ] |
Allen Webb | 975e866 | 2020-05-14 14:33:13 -0700 | [diff] [blame] | 369 | |
| 370 | # TODO(crbug.com/1082873): Remove after fixing usage of deprecated |
| 371 | # declarations. |
| 372 | cflags_cc = [ "-Wno-error=deprecated-declarations" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 373 | } |
| 374 | |
| 375 | # server-side delta generator. |
| 376 | executable("delta_generator") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 377 | sources = [ "payload_generator/generate_delta_main.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 378 | configs += [ ":target_defaults" ] |
| 379 | configs -= [ "//common-mk:pie" ] |
| 380 | deps = [ |
| 381 | ":libpayload_consumer", |
| 382 | ":libpayload_generator", |
| 383 | ] |
| 384 | } |
| 385 | |
| 386 | if (use.test || use.fuzzer) { |
| 387 | static_library("update_engine_test_libs") { |
| 388 | sources = [ |
| 389 | "common/fake_prefs.cc", |
| 390 | "common/mock_http_fetcher.cc", |
| 391 | "common/test_utils.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 392 | "cros/fake_shill_proxy.cc", |
| 393 | "cros/fake_system_state.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 394 | "payload_consumer/fake_file_descriptor.cc", |
| 395 | "payload_generator/fake_filesystem.cc", |
| 396 | "update_manager/umtest_utils.cc", |
| 397 | ] |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 398 | |
| 399 | # TODO(crbug.com/887845): After library odering issue is fixed, |
| 400 | # //common-mk:test can be moved in all_dependent_configs and |
| 401 | # //common-mk:test in each test configs can be removed. |
| 402 | configs += [ |
| 403 | "//common-mk:test", |
| 404 | ":target_defaults", |
| 405 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 406 | pkg_deps = [ "libshill-client-test" ] |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 407 | deps = [ ":libupdate_engine" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 408 | } |
| 409 | } |
| 410 | |
| 411 | if (use.test) { |
| 412 | # Public keys used for unit testing. |
| 413 | genopenssl_key("update_engine-testkeys") { |
| 414 | openssl_pem_in_dir = "." |
| 415 | openssl_pem_out_dir = "include/update_engine" |
| 416 | sources = [ |
| 417 | "unittest_key.pem", |
| 418 | "unittest_key2.pem", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 419 | "unittest_key_RSA4096.pem", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 420 | ] |
| 421 | } |
| 422 | |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame] | 423 | genopenssl_key("update_engine-testkeys-ec") { |
| 424 | openssl_pem_in_dir = "." |
| 425 | openssl_pem_out_dir = "include/update_engine" |
| 426 | openssl_pem_algorithm = "ec" |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 427 | sources = [ "unittest_key_EC.pem" ] |
Amin Hassani | e53b39b | 2020-09-16 11:19:28 -0700 | [diff] [blame] | 428 | } |
| 429 | |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 430 | # Unpacks sample images used for testing. |
| 431 | tar_bunzip2("update_engine-test_images") { |
| 432 | image_out_dir = "." |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 433 | sources = [ "sample_images/sample_images.tar.bz2" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 434 | } |
| 435 | |
| 436 | # Test HTTP Server. |
| 437 | executable("test_http_server") { |
| 438 | sources = [ |
| 439 | "common/http_common.cc", |
| 440 | "test_http_server.cc", |
| 441 | ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 442 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 443 | # //common-mk:test should be on the top. |
| 444 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 445 | configs += [ |
| 446 | "//common-mk:test", |
| 447 | ":target_defaults", |
| 448 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 449 | } |
| 450 | |
| 451 | # Test subprocess helper. |
| 452 | executable("test_subprocess") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 453 | sources = [ "test_subprocess.cc" ] |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 454 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 455 | # //common-mk:test should be on the top. |
| 456 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 457 | configs += [ |
| 458 | "//common-mk:test", |
| 459 | ":target_defaults", |
| 460 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 461 | } |
| 462 | |
| 463 | # Main unittest file. |
| 464 | executable("update_engine_unittests") { |
| 465 | sources = [ |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 466 | "certificate_checker_unittest.cc", |
| 467 | "common/action_pipe_unittest.cc", |
| 468 | "common/action_processor_unittest.cc", |
| 469 | "common/action_unittest.cc", |
| 470 | "common/cpu_limiter_unittest.cc", |
| 471 | "common/hash_calculator_unittest.cc", |
| 472 | "common/http_fetcher_unittest.cc", |
| 473 | "common/hwid_override_unittest.cc", |
| 474 | "common/prefs_unittest.cc", |
| 475 | "common/proxy_resolver_unittest.cc", |
| 476 | "common/subprocess_unittest.cc", |
| 477 | "common/terminator_unittest.cc", |
| 478 | "common/utils_unittest.cc", |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 479 | "cros/boot_control_chromeos_unittest.cc", |
| 480 | "cros/common_service_unittest.cc", |
| 481 | "cros/connection_manager_unittest.cc", |
| 482 | "cros/hardware_chromeos_unittest.cc", |
| 483 | "cros/image_properties_chromeos_unittest.cc", |
| 484 | "cros/metrics_reporter_omaha_unittest.cc", |
| 485 | "cros/omaha_request_action_unittest.cc", |
| 486 | "cros/omaha_request_builder_xml_unittest.cc", |
| 487 | "cros/omaha_request_params_unittest.cc", |
| 488 | "cros/omaha_response_handler_action_unittest.cc", |
| 489 | "cros/omaha_utils_unittest.cc", |
| 490 | "cros/p2p_manager_unittest.cc", |
| 491 | "cros/payload_state_unittest.cc", |
| 492 | "cros/requisition_util_unittest.cc", |
| 493 | "cros/update_attempter_unittest.cc", |
| 494 | "download_action_unittest.cc", |
Jae Hoon Kim | 0ae8fe1 | 2019-06-26 14:32:50 -0700 | [diff] [blame] | 495 | "libcurl_http_fetcher_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 496 | "metrics_utils_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 497 | "payload_consumer/bzip_extent_writer_unittest.cc", |
| 498 | "payload_consumer/cached_file_descriptor_unittest.cc", |
| 499 | "payload_consumer/delta_performer_integration_test.cc", |
| 500 | "payload_consumer/delta_performer_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 501 | "payload_consumer/extent_reader_unittest.cc", |
| 502 | "payload_consumer/extent_writer_unittest.cc", |
| 503 | "payload_consumer/file_descriptor_utils_unittest.cc", |
| 504 | "payload_consumer/file_writer_unittest.cc", |
| 505 | "payload_consumer/filesystem_verifier_action_unittest.cc", |
| 506 | "payload_consumer/postinstall_runner_action_unittest.cc", |
| 507 | "payload_consumer/xz_extent_writer_unittest.cc", |
| 508 | "payload_generator/ab_generator_unittest.cc", |
| 509 | "payload_generator/blob_file_writer_unittest.cc", |
| 510 | "payload_generator/block_mapping_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 511 | "payload_generator/deflate_utils_unittest.cc", |
| 512 | "payload_generator/delta_diff_utils_unittest.cc", |
| 513 | "payload_generator/ext2_filesystem_unittest.cc", |
| 514 | "payload_generator/extent_ranges_unittest.cc", |
| 515 | "payload_generator/extent_utils_unittest.cc", |
| 516 | "payload_generator/full_update_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 517 | "payload_generator/mapfile_filesystem_unittest.cc", |
Amin Hassani | d0ec651 | 2020-09-15 15:30:08 -0700 | [diff] [blame] | 518 | "payload_generator/merge_sequence_generator_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 519 | "payload_generator/payload_file_unittest.cc", |
| 520 | "payload_generator/payload_generation_config_unittest.cc", |
Jae Hoon Kim | 4b6d126 | 2019-06-20 10:41:18 -0700 | [diff] [blame] | 521 | "payload_generator/payload_properties_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 522 | "payload_generator/payload_signer_unittest.cc", |
| 523 | "payload_generator/squashfs_filesystem_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 524 | "payload_generator/zip_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 525 | "testrunner.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 526 | "update_boot_flags_action_unittest.cc", |
| 527 | "update_manager/boxed_value_unittest.cc", |
| 528 | "update_manager/chromeos_policy_unittest.cc", |
Miriam Polzer | aff7200 | 2020-08-27 08:20:39 +0200 | [diff] [blame] | 529 | "update_manager/enterprise_device_policy_impl_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 530 | "update_manager/evaluation_context_unittest.cc", |
| 531 | "update_manager/generic_variables_unittest.cc", |
Saurabh Nijhara | 79fec2d | 2020-11-10 23:22:58 +0100 | [diff] [blame^] | 532 | "update_manager/minimum_version_policy_impl_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 533 | "update_manager/prng_unittest.cc", |
| 534 | "update_manager/real_device_policy_provider_unittest.cc", |
| 535 | "update_manager/real_random_provider_unittest.cc", |
| 536 | "update_manager/real_shill_provider_unittest.cc", |
| 537 | "update_manager/real_system_provider_unittest.cc", |
| 538 | "update_manager/real_time_provider_unittest.cc", |
| 539 | "update_manager/real_updater_provider_unittest.cc", |
| 540 | "update_manager/staging_utils_unittest.cc", |
| 541 | "update_manager/update_manager_unittest.cc", |
| 542 | "update_manager/update_time_restrictions_policy_impl_unittest.cc", |
| 543 | "update_manager/variable_unittest.cc", |
| 544 | "update_manager/weekly_time_unittest.cc", |
Jae Hoon Kim | 916af85 | 2019-08-01 17:45:30 -0700 | [diff] [blame] | 545 | "update_status_utils_unittest.cc", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 546 | ] |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 547 | if (use.dlc) { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 548 | sources += [ "cros/excluder_chromeos_unittest.cc" ] |
Jae Hoon Kim | 38de3b1 | 2020-04-29 19:41:23 -0700 | [diff] [blame] | 549 | } |
Brian Norris | 0ffa71f | 2019-07-08 10:25:54 -0700 | [diff] [blame] | 550 | |
Keigo Oka | ec39a22 | 2019-06-27 13:51:07 +0900 | [diff] [blame] | 551 | # //common-mk:test should be on the top. |
| 552 | # TODO(crbug.com/887845): Remove this after library odering issue is fixed. |
| 553 | configs += [ |
| 554 | "//common-mk:test", |
| 555 | ":target_defaults", |
| 556 | ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 557 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 558 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 559 | "libchrome-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 560 | "libdebugd-client-test", |
| 561 | "libpower_manager-client-test", |
| 562 | "libsession_manager-client-test", |
| 563 | "libshill-client-test", |
| 564 | ] |
| 565 | deps = [ |
| 566 | ":libpayload_generator", |
| 567 | ":libupdate_engine", |
| 568 | ":update_engine_test_libs", |
| 569 | ] |
| 570 | } |
| 571 | } |
| 572 | |
| 573 | # Fuzzer target. |
| 574 | if (use.fuzzer) { |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 575 | executable("update_engine_delta_performer_fuzzer") { |
Clark Chung | e6b888c | 2020-04-20 15:50:37 +0800 | [diff] [blame] | 576 | sources = [ "payload_consumer/delta_performer_fuzzer.cc" ] |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 577 | configs += [ |
| 578 | "//common-mk/common_fuzzer", |
| 579 | ":target_defaults", |
| 580 | ] |
| 581 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 582 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 583 | "libchrome-test", |
Amin Hassani | 6f0366d | 2019-10-14 14:56:43 -0700 | [diff] [blame] | 584 | ] |
| 585 | deps = [ |
| 586 | ":libupdate_engine", |
| 587 | ":update_engine_test_libs", |
| 588 | ] |
| 589 | } |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 590 | executable("update_engine_omaha_request_action_fuzzer") { |
Amin Hassani | ec7bc11 | 2020-10-29 16:47:58 -0700 | [diff] [blame] | 591 | sources = [ "cros/omaha_request_action_fuzzer.cc" ] |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 592 | configs += [ |
| 593 | "//common-mk/common_fuzzer", |
| 594 | ":target_defaults", |
| 595 | ] |
| 596 | pkg_deps = [ |
Grace Cham | b6d1b41 | 2019-10-31 14:53:42 +0900 | [diff] [blame] | 597 | "libbrillo-test", |
Qijiang Fan | b78e1bc | 2020-10-27 16:31:39 +0900 | [diff] [blame] | 598 | "libchrome-test", |
Keigo Oka | 0ede7bd | 2019-05-13 17:35:13 +0900 | [diff] [blame] | 599 | ] |
| 600 | deps = [ |
| 601 | ":libupdate_engine", |
| 602 | ":update_engine_test_libs", |
| 603 | ] |
| 604 | } |
| 605 | } |