btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 1 | # Copyright 2018 The Chromium Authors. All rights reserved. |
| 2 | # Use of this source code is governed by a BSD-style license that can be |
| 3 | # found in the LICENSE file. |
| 4 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 5 | import("//build_overrides/build.gni") |
btolsch | 5292c94 | 2018-07-26 00:06:22 -0700 | [diff] [blame] | 6 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 7 | source_set("platform") { |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 8 | sources = [ |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 9 | "api/event_waiter.cc", |
| 10 | "api/event_waiter.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 11 | "api/logging.h", |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 12 | "api/logging_util.cc", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 13 | "api/network_interface.cc", |
| 14 | "api/network_interface.h", |
btolsch | 4051e72 | 2019-06-07 16:15:17 -0700 | [diff] [blame] | 15 | "api/network_runner.h", |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 16 | "api/network_waiter.h", |
Jordan Bayles | f3cf17d | 2019-06-11 15:29:43 -0700 | [diff] [blame] | 17 | "api/scoped_wake_lock.cc", |
| 18 | "api/scoped_wake_lock.h", |
btolsch | 4051e72 | 2019-06-07 16:15:17 -0700 | [diff] [blame] | 19 | "api/socket.h", |
Jordan Bayles | b0c191e | 2019-03-26 15:49:57 -0700 | [diff] [blame] | 20 | "api/task_runner.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 21 | "api/time.h", |
Jordan Bayles | a5ac5c8 | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 22 | "api/tls_socket.h", |
| 23 | "api/tls_socket_creds.h", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 24 | "api/udp_socket.cc", |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 25 | "api/udp_socket.h", |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 26 | "api/upd_read_callback.h", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 27 | "impl/ssl_context.cc", |
| 28 | "impl/ssl_context.h", |
| 29 | "impl/time.cc", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 30 | ] |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 31 | |
| 32 | public_deps = [ |
Jordan Bayles | f1e4bb7 | 2019-05-01 12:38:39 -0700 | [diff] [blame] | 33 | "../osp_base", |
btolsch | 2f2e7fa | 2019-03-29 16:48:49 -0700 | [diff] [blame] | 34 | "../third_party/abseil", |
Jordan Bayles | b9262f4 | 2019-05-30 14:10:02 -0700 | [diff] [blame] | 35 | "../third_party/boringssl", |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 36 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 37 | |
Jordan Bayles | f1e4bb7 | 2019-05-01 12:38:39 -0700 | [diff] [blame] | 38 | allow_circular_includes_from = [ "../osp_base" ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 39 | |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 40 | configs += [ "../build:allow_build_from_embedder" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 41 | |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 42 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 43 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 44 | "impl/event_loop.cc", |
| 45 | "impl/event_loop.h", |
| 46 | "impl/network_reader.cc", |
| 47 | "impl/network_reader.h", |
| 48 | "impl/network_runner.cc", |
| 49 | "impl/network_runner.h", |
| 50 | "impl/task_runner_impl.cc", |
| 51 | "impl/task_runner_impl.h", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 52 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 53 | |
| 54 | if (is_linux) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 55 | sources += [ "impl/network_interface_linux.cc" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 56 | } else if (is_mac) { |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 57 | defines = [ |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 58 | # Required, to use the new IPv6 Sockets options introduced by RFC 3542. |
| 59 | "__APPLE_USE_RFC_3542", |
| 60 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 61 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 62 | sources += [ "impl/network_interface_mac.cc" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 63 | } |
| 64 | |
| 65 | if (is_posix) { |
| 66 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 67 | "impl/event_waiter_posix.cc", |
| 68 | "impl/network_waiter_posix.cc", |
| 69 | "impl/network_waiter_posix.h", |
| 70 | "impl/scoped_wake_lock_posix.cc", |
| 71 | "impl/scoped_wake_lock_posix.h", |
| 72 | "impl/udp_socket_posix.cc", |
| 73 | "impl/udp_socket_posix.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 74 | ] |
| 75 | } |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 76 | |
| 77 | deps = [ |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 78 | ":default_logger", |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 79 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 80 | } |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 81 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 82 | |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 83 | source_set("test") { |
| 84 | testonly = true |
| 85 | sources = [ |
| 86 | "test/fake_clock.cc", |
| 87 | "test/fake_clock.h", |
Yuri Wiitala | ec35361 | 2019-06-18 17:32:39 -0700 | [diff] [blame] | 88 | "test/fake_task_runner.cc", |
| 89 | "test/fake_task_runner.h", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 90 | "test/mock_udp_socket.cc", |
| 91 | "test/mock_udp_socket.h", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 92 | ] |
| 93 | |
Jordan Bayles | 7bc7f10 | 2019-05-30 12:38:43 -0700 | [diff] [blame] | 94 | configs += [ "../build:allow_build_from_embedder" ] |
| 95 | |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 96 | deps = [ |
| 97 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 98 | "../third_party/googletest:gmock", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 99 | ] |
| 100 | } |
| 101 | |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 102 | source_set("default_logger") { |
| 103 | sources = [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 104 | "impl/logging.cc", |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 105 | ] |
| 106 | |
| 107 | if (is_posix) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 108 | sources += [ "impl/log_initializer_posix.cc" ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 109 | } |
| 110 | |
| 111 | configs += [ "../build:allow_build_from_embedder" ] |
| 112 | |
| 113 | deps = [ |
| 114 | "../osp_base", |
| 115 | "../third_party/abseil", |
| 116 | ] |
| 117 | } |
| 118 | |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 119 | source_set("platform_unittests") { |
| 120 | testonly = true |
| 121 | |
| 122 | sources = [ |
| 123 | "api/time_unittest.cc", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 124 | "api/udp_socket_unittest.cc", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 125 | "impl/ssl_context_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 126 | ] |
| 127 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 128 | # The unit tests in impl/ assume the standalone implementation is being used. |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 129 | # Exclude them if an embedder is providing the implementation. |
| 130 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 131 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 132 | "impl/network_reader_unittest.cc", |
| 133 | "impl/task_runner_impl_unittest.cc", |
| 134 | "impl/time_unittest.cc", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 135 | ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 136 | if (is_posix) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame^] | 137 | sources += [ "impl/network_waiter_posix_unittest.cc" ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 138 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 139 | } |
| 140 | |
| 141 | deps = [ |
| 142 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 143 | "../third_party/googletest:gmock", |
btolsch | 4666ed2 | 2019-04-25 15:58:07 -0700 | [diff] [blame] | 144 | "../third_party/googletest:gtest", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 145 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 146 | |
| 147 | configs += [ "../build:allow_build_from_embedder" ] |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 148 | } |