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 | |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 7 | declare_args() { |
| 8 | enable_trace_logging = true |
| 9 | } |
| 10 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 11 | source_set("platform") { |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 12 | defines = [] |
| 13 | |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 14 | sources = [ |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 15 | "api/internal/trace_logging_internal.cc", |
| 16 | "api/internal/trace_logging_internal.h", |
| 17 | "api/internal/trace_logging_macros_internal.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 18 | "api/logging.h", |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 19 | "api/logging_util.cc", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 20 | "api/network_interface.cc", |
| 21 | "api/network_interface.h", |
btolsch | 4051e72 | 2019-06-07 16:15:17 -0700 | [diff] [blame] | 22 | "api/network_runner.h", |
Ryan Keane | a973b51 | 2019-07-29 15:50:39 -0700 | [diff] [blame] | 23 | "api/network_runner_lifetime_manager.h", |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 24 | "api/network_waiter.h", |
Jordan Bayles | f3cf17d | 2019-06-11 15:29:43 -0700 | [diff] [blame] | 25 | "api/scoped_wake_lock.cc", |
| 26 | "api/scoped_wake_lock.h", |
btolsch | 4051e72 | 2019-06-07 16:15:17 -0700 | [diff] [blame] | 27 | "api/socket.h", |
Jordan Bayles | b0c191e | 2019-03-26 15:49:57 -0700 | [diff] [blame] | 28 | "api/task_runner.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 29 | "api/time.h", |
Jordan Bayles | a5ac5c8 | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 30 | "api/tls_socket.h", |
| 31 | "api/tls_socket_creds.h", |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 32 | "api/trace_logging.h", |
| 33 | "api/trace_logging_platform.cc", |
| 34 | "api/trace_logging_platform.h", |
| 35 | "api/trace_logging_types.h", |
Max Yakimakha | 04362e2 | 2019-07-22 17:54:45 -0700 | [diff] [blame] | 36 | "api/udp_packet.h", |
| 37 | "api/udp_read_callback.h", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 38 | "api/udp_socket.cc", |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 39 | "api/udp_socket.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 40 | "base/error.cc", |
| 41 | "base/error.h", |
| 42 | "base/ip_address.cc", |
| 43 | "base/ip_address.h", |
| 44 | "base/location.cc", |
| 45 | "base/location.h", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 46 | "impl/ssl_context.cc", |
| 47 | "impl/ssl_context.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 48 | ] |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 49 | |
| 50 | public_deps = [ |
btolsch | 2f2e7fa | 2019-03-29 16:48:49 -0700 | [diff] [blame] | 51 | "../third_party/abseil", |
Jordan Bayles | b9262f4 | 2019-05-30 14:10:02 -0700 | [diff] [blame] | 52 | "../third_party/boringssl", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 53 | "../util", |
Jordan Bayles | 9eb0974 | 2019-01-15 14:04:52 -0800 | [diff] [blame] | 54 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 55 | |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 56 | configs += [ "../build:allow_build_from_embedder" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 57 | |
Jordan Bayles | a80724b | 2019-05-02 17:17:26 -0700 | [diff] [blame] | 58 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 59 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 60 | "impl/network_reader.cc", |
| 61 | "impl/network_reader.h", |
| 62 | "impl/network_runner.cc", |
| 63 | "impl/network_runner.h", |
Ryan Keane | a973b51 | 2019-07-29 15:50:39 -0700 | [diff] [blame] | 64 | "impl/network_runner_lifetime_manager.cc", |
| 65 | "impl/network_runner_lifetime_manager.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 66 | "impl/task_runner.cc", |
| 67 | "impl/task_runner.h", |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 68 | "impl/text_trace_logging_platform.cc", |
| 69 | "impl/text_trace_logging_platform.h", |
btolsch | 4397c29 | 2019-07-22 12:42:10 -0700 | [diff] [blame] | 70 | "impl/time.cc", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 71 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 72 | |
| 73 | if (is_linux) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 74 | sources += [ "impl/network_interface_linux.cc" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 75 | } else if (is_mac) { |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 76 | defines += [ |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 77 | # Required, to use the new IPv6 Sockets options introduced by RFC 3542. |
| 78 | "__APPLE_USE_RFC_3542", |
| 79 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 80 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 81 | sources += [ "impl/network_interface_mac.cc" ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 82 | } |
| 83 | |
| 84 | if (is_posix) { |
| 85 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 86 | "impl/network_waiter_posix.cc", |
| 87 | "impl/network_waiter_posix.h", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 88 | "impl/scoped_pipe.h", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 89 | "impl/scoped_wake_lock_posix.cc", |
| 90 | "impl/scoped_wake_lock_posix.h", |
| 91 | "impl/udp_socket_posix.cc", |
| 92 | "impl/udp_socket_posix.h", |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 93 | ] |
| 94 | } |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 95 | |
| 96 | deps = [ |
Jordan Bayles | ad2d2cd | 2019-05-22 14:49:40 -0700 | [diff] [blame] | 97 | ":default_logger", |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 98 | ] |
Yuri Wiitala | b2d1323 | 2019-02-04 18:07:28 -0800 | [diff] [blame] | 99 | } |
Ryan Keane | 1d9c0c4 | 2019-07-29 15:22:19 -0700 | [diff] [blame] | 100 | |
| 101 | if (enable_trace_logging) { |
| 102 | defines += [ "ENABLE_TRACE_LOGGING" ] |
| 103 | } |
btolsch | 9d6900c | 2018-05-30 18:22:53 -0700 | [diff] [blame] | 104 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 105 | |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 106 | source_set("test") { |
| 107 | testonly = true |
| 108 | sources = [ |
| 109 | "test/fake_clock.cc", |
| 110 | "test/fake_clock.h", |
Ryan Keane | a973b51 | 2019-07-29 15:50:39 -0700 | [diff] [blame] | 111 | "test/fake_network_runner.cc", |
| 112 | "test/fake_network_runner.h", |
Yuri Wiitala | ec35361 | 2019-06-18 17:32:39 -0700 | [diff] [blame] | 113 | "test/fake_task_runner.cc", |
| 114 | "test/fake_task_runner.h", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 115 | "test/mock_udp_socket.cc", |
| 116 | "test/mock_udp_socket.h", |
Ryan Keane | 38e7d51 | 2019-08-02 15:37:49 -0700 | [diff] [blame^] | 117 | "test/trace_logging_helpers.h", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 118 | ] |
| 119 | |
Jordan Bayles | 7bc7f10 | 2019-05-30 12:38:43 -0700 | [diff] [blame] | 120 | configs += [ "../build:allow_build_from_embedder" ] |
| 121 | |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 122 | deps = [ |
| 123 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 124 | "../third_party/googletest:gmock", |
Jordan Bayles | aa021ce | 2019-05-29 13:57:44 -0700 | [diff] [blame] | 125 | ] |
| 126 | } |
| 127 | |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 128 | source_set("default_logger") { |
| 129 | sources = [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 130 | "impl/logging.cc", |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 131 | ] |
| 132 | |
| 133 | if (is_posix) { |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 134 | sources += [ "impl/log_initializer_posix.cc" ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 135 | } |
| 136 | |
| 137 | configs += [ "../build:allow_build_from_embedder" ] |
| 138 | |
| 139 | deps = [ |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 140 | "../third_party/abseil", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 141 | "../util", |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 142 | ] |
| 143 | } |
| 144 | |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 145 | source_set("platform_unittests") { |
| 146 | testonly = true |
| 147 | |
| 148 | sources = [ |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 149 | "api/internal/trace_logging_internal_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 150 | "api/time_unittest.cc", |
Ryan Keane | efab2ed | 2019-07-22 12:36:53 -0700 | [diff] [blame] | 151 | "api/trace_logging_unittest.cc", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 152 | "api/udp_socket_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 153 | "base/error_unittest.cc", |
| 154 | "base/ip_address_unittest.cc", |
| 155 | "base/location_unittest.cc", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 156 | "impl/ssl_context_unittest.cc", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 157 | ] |
| 158 | |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 159 | # The unit tests in impl/ assume the standalone implementation is being used. |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 160 | # Exclude them if an embedder is providing the implementation. |
| 161 | if (!build_with_chromium) { |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 162 | sources += [ |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 163 | "impl/network_reader_unittest.cc", |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 164 | "impl/task_runner_unittest.cc", |
Jordan Bayles | cc47180 | 2019-07-09 14:25:02 -0700 | [diff] [blame] | 165 | "impl/time_unittest.cc", |
btolsch | c92ba2f | 2019-04-10 11:46:01 -0700 | [diff] [blame] | 166 | ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 167 | if (is_posix) { |
Jordan Bayles | a26582d | 2019-07-10 14:44:58 -0700 | [diff] [blame] | 168 | sources += [ |
| 169 | "impl/network_waiter_posix_unittest.cc", |
| 170 | "impl/scoped_pipe_unittest.cc", |
| 171 | ] |
Ryan Keane | 32c88d0 | 2019-07-02 18:46:14 -0700 | [diff] [blame] | 172 | } |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 173 | } |
| 174 | |
| 175 | deps = [ |
| 176 | ":platform", |
Ryan Keane | deb48b3 | 2019-06-28 16:24:40 -0700 | [diff] [blame] | 177 | "../third_party/googletest:gmock", |
btolsch | 4666ed2 | 2019-04-25 15:58:07 -0700 | [diff] [blame] | 178 | "../third_party/googletest:gtest", |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 179 | ] |
Jordan Bayles | 9ade415 | 2019-05-08 17:03:24 -0700 | [diff] [blame] | 180 | |
| 181 | configs += [ "../build:allow_build_from_embedder" ] |
Yuri Wiitala | eb8eee7 | 2019-03-26 15:52:43 -0700 | [diff] [blame] | 182 | } |