blob: abd7f6238eb358537fd807a49cb64b103f47da88 [file] [log] [blame]
btolsch9d6900c2018-05-30 18:22:53 -07001# 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 Wiitalab2d13232019-02-04 18:07:28 -08005import("//build_overrides/build.gni")
btolsch5292c942018-07-26 00:06:22 -07006
Ryan Keane1d9c0c42019-07-29 15:22:19 -07007declare_args() {
8 enable_trace_logging = true
9}
10
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011source_set("platform") {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070012 defines = []
13
Yuri Wiitalab2d13232019-02-04 18:07:28 -080014 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -070015 "api/internal/trace_logging_internal.cc",
16 "api/internal/trace_logging_internal.h",
17 "api/internal/trace_logging_macros_internal.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080018 "api/logging.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070019 "api/logging_util.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080020 "api/network_interface.cc",
21 "api/network_interface.h",
btolsch4051e722019-06-07 16:15:17 -070022 "api/network_runner.h",
Ryan Keanea973b512019-07-29 15:50:39 -070023 "api/network_runner_lifetime_manager.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070024 "api/network_waiter.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070025 "api/scoped_wake_lock.cc",
26 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070027 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070028 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080029 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070030 "api/tls_socket.h",
31 "api/tls_socket_creds.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070032 "api/trace_logging.h",
33 "api/trace_logging_platform.cc",
34 "api/trace_logging_platform.h",
35 "api/trace_logging_types.h",
Max Yakimakha04362e22019-07-22 17:54:45 -070036 "api/udp_packet.h",
37 "api/udp_read_callback.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070038 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070039 "api/udp_socket.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070040 "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 Baylescc471802019-07-09 14:25:02 -070046 "impl/ssl_context.cc",
47 "impl/ssl_context.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080048 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080049
50 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070051 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070052 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070053 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080054 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070055
Jordan Baylesa80724b2019-05-02 17:17:26 -070056 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080057
Jordan Baylesa80724b2019-05-02 17:17:26 -070058 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070059 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070060 "impl/network_reader.cc",
61 "impl/network_reader.h",
62 "impl/network_runner.cc",
63 "impl/network_runner.h",
Ryan Keanea973b512019-07-29 15:50:39 -070064 "impl/network_runner_lifetime_manager.cc",
65 "impl/network_runner_lifetime_manager.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070066 "impl/task_runner.cc",
67 "impl/task_runner.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070068 "impl/text_trace_logging_platform.cc",
69 "impl/text_trace_logging_platform.h",
btolsch4397c292019-07-22 12:42:10 -070070 "impl/time.cc",
btolschc92ba2f2019-04-10 11:46:01 -070071 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080072
73 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070074 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080075 } else if (is_mac) {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070076 defines += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080077 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
78 "__APPLE_USE_RFC_3542",
79 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070080
Jordan Baylescc471802019-07-09 14:25:02 -070081 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080082 }
83
84 if (is_posix) {
85 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070086 "impl/network_waiter_posix.cc",
87 "impl/network_waiter_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070088 "impl/scoped_pipe.h",
Jordan Baylescc471802019-07-09 14:25:02 -070089 "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 Wiitalab2d13232019-02-04 18:07:28 -080093 ]
94 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070095
96 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070097 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070098 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080099 }
Ryan Keane1d9c0c42019-07-29 15:22:19 -0700100
101 if (enable_trace_logging) {
102 defines += [ "ENABLE_TRACE_LOGGING" ]
103 }
btolsch9d6900c2018-05-30 18:22:53 -0700104}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700105
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700106source_set("test") {
107 testonly = true
108 sources = [
109 "test/fake_clock.cc",
110 "test/fake_clock.h",
Ryan Keanea973b512019-07-29 15:50:39 -0700111 "test/fake_network_runner.cc",
112 "test/fake_network_runner.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700113 "test/fake_task_runner.cc",
114 "test/fake_task_runner.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700115 "test/mock_udp_socket.cc",
116 "test/mock_udp_socket.h",
Ryan Keane38e7d512019-08-02 15:37:49 -0700117 "test/trace_logging_helpers.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700118 ]
119
Jordan Bayles7bc7f102019-05-30 12:38:43 -0700120 configs += [ "../build:allow_build_from_embedder" ]
121
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700122 deps = [
123 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700124 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700125 ]
126}
127
Jordan Bayles9ade4152019-05-08 17:03:24 -0700128source_set("default_logger") {
129 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700130 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700131 ]
132
133 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700134 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700135 }
136
137 configs += [ "../build:allow_build_from_embedder" ]
138
139 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700140 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700141 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700142 ]
143}
144
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700145source_set("platform_unittests") {
146 testonly = true
147
148 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700149 "api/internal/trace_logging_internal_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700150 "api/time_unittest.cc",
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700151 "api/trace_logging_unittest.cc",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700152 "api/udp_socket_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700153 "base/error_unittest.cc",
154 "base/ip_address_unittest.cc",
155 "base/location_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700156 "impl/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700157 ]
158
Jordan Baylescc471802019-07-09 14:25:02 -0700159 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700160 # Exclude them if an embedder is providing the implementation.
161 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700162 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -0700163 "impl/network_reader_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700164 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700165 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700166 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700167 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700168 sources += [
169 "impl/network_waiter_posix_unittest.cc",
170 "impl/scoped_pipe_unittest.cc",
171 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700172 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700173 }
174
175 deps = [
176 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700177 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700178 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700179 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700180
181 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700182}