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