blob: a31d27d8d2a3c4f9c00d25ebebd7127b0d65b057 [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
Yuri Wiitalab2d13232019-02-04 18:07:28 -08007source_set("platform") {
Ryan Keane1d9c0c42019-07-29 15:22:19 -07008 defines = []
9
Yuri Wiitalab2d13232019-02-04 18:07:28 -080010 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -070011 "api/internal/trace_logging_internal.cc",
12 "api/internal/trace_logging_internal.h",
13 "api/internal/trace_logging_macros_internal.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080014 "api/logging.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070015 "api/logging_util.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080016 "api/network_interface.cc",
17 "api/network_interface.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070018 "api/scoped_wake_lock.cc",
19 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070020 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070021 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080022 "api/time.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070023 "api/tls_connection.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070024 "api/tls_connection.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070025 "api/tls_connection_factory.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070026 "api/tls_connection_factory.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070027 "api/trace_logging.h",
28 "api/trace_logging_platform.cc",
29 "api/trace_logging_platform.h",
30 "api/trace_logging_types.h",
Max Yakimakha04362e22019-07-22 17:54:45 -070031 "api/udp_packet.h",
32 "api/udp_read_callback.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070033 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070034 "api/udp_socket.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070035 "base/error.cc",
36 "base/error.h",
37 "base/ip_address.cc",
38 "base/ip_address.h",
39 "base/location.cc",
40 "base/location.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070041 "base/socket_state.h",
42 "base/tls_connect_options.h",
43 "base/tls_credentials.cc",
44 "base/tls_credentials.h",
45 "base/tls_listen_options.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080046 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080047
48 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070049 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070050 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070051 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080052 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070053
Jordan Baylesa80724b2019-05-02 17:17:26 -070054 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080055
Jordan Baylesa80724b2019-05-02 17:17:26 -070056 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070057 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070058 "impl/network_reader.cc",
59 "impl/network_reader.h",
Ryan Keanebcc7ba82019-09-20 14:17:59 -070060 "impl/network_waiter.cc",
Ryan Keane3b88a252019-09-17 09:55:33 -070061 "impl/network_waiter.h",
62 "impl/socket_handle.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070063 "impl/task_runner.cc",
64 "impl/task_runner.h",
Ryan Keaneecdb30e2019-09-04 12:17:34 -070065 "impl/task_runner_thread.cc",
66 "impl/task_runner_thread.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070067 "impl/text_trace_logging_platform.cc",
68 "impl/text_trace_logging_platform.h",
btolsch4397c292019-07-22 12:42:10 -070069 "impl/time.cc",
Ryan Keanec5e56e72019-09-18 18:21:40 -070070 "impl/tls_write_buffer.cc",
71 "impl/tls_write_buffer.h",
btolschc92ba2f2019-04-10 11:46:01 -070072 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080073
74 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070075 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080076 } else if (is_mac) {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070077 defines += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080078 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
79 "__APPLE_USE_RFC_3542",
80 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070081
Jordan Baylescc471802019-07-09 14:25:02 -070082 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080083 }
84
85 if (is_posix) {
86 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070087 "impl/network_waiter_posix.cc",
88 "impl/network_waiter_posix.h",
Ryan Keanebcc7ba82019-09-20 14:17:59 -070089 "impl/network_waiter_thread.cc",
90 "impl/network_waiter_thread.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070091 "impl/scoped_pipe.h",
Jordan Baylescc471802019-07-09 14:25:02 -070092 "impl/scoped_wake_lock_posix.cc",
93 "impl/scoped_wake_lock_posix.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -070094 "impl/socket_address_posix.cc",
95 "impl/socket_address_posix.h",
Ryan Keane6e542522019-09-10 16:05:44 -070096 "impl/socket_handle_posix.cc",
97 "impl/socket_handle_posix.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070098 "impl/stream_socket.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -070099 "impl/stream_socket_posix.cc",
100 "impl/stream_socket_posix.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -0700101 "impl/tls_connection_factory_posix.cc",
102 "impl/tls_connection_factory_posix.h",
103 "impl/tls_connection_posix.cc",
104 "impl/tls_connection_posix.h",
Jordan Baylescc471802019-07-09 14:25:02 -0700105 "impl/udp_socket_posix.cc",
106 "impl/udp_socket_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -0800107 ]
108 }
Jordan Bayles9ade4152019-05-08 17:03:24 -0700109
110 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -0700111 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700112 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -0800113 }
btolsch9d6900c2018-05-30 18:22:53 -0700114}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700115
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700116source_set("test") {
117 testonly = true
118 sources = [
119 "test/fake_clock.cc",
120 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700121 "test/fake_task_runner.cc",
122 "test/fake_task_runner.h",
Ryan Keane7d4b5fc2019-08-30 12:38:39 -0700123 "test/fake_udp_socket.cc",
124 "test/fake_udp_socket.h",
Ryan Keane38e7d512019-08-02 15:37:49 -0700125 "test/trace_logging_helpers.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700126 ]
127
Jordan Bayles7bc7f102019-05-30 12:38:43 -0700128 configs += [ "../build:allow_build_from_embedder" ]
129
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700130 deps = [
131 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700132 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700133 ]
134}
135
Jordan Bayles9ade4152019-05-08 17:03:24 -0700136source_set("default_logger") {
137 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700138 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700139 ]
140
141 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700142 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700143 }
144
145 configs += [ "../build:allow_build_from_embedder" ]
146
147 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700148 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700149 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700150 ]
151}
152
mark a. foltz3fe46172019-09-18 05:50:30 -0700153source_set("unittests") {
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700154 testonly = true
155
156 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700157 "api/internal/trace_logging_internal_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700158 "api/time_unittest.cc",
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700159 "api/trace_logging_unittest.cc",
Ryan Keane493029d2019-08-19 14:01:04 -0700160 "api/udp_socket_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700161 "base/error_unittest.cc",
162 "base/ip_address_unittest.cc",
163 "base/location_unittest.cc",
Jordan Bayles05ce6b62019-09-06 14:09:10 -0700164 "base/tls_credentials_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700165 ]
166
Jordan Baylescc471802019-07-09 14:25:02 -0700167 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700168 # Exclude them if an embedder is providing the implementation.
169 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700170 sources += [
Jordan Bayles063c3b52019-08-13 18:14:55 -0700171 # TODO(jophba): move over to general sources when UDP socket create
172 # is implemented in Chromium, as part of the NetworkRunner work.
Ryan Keane493029d2019-08-19 14:01:04 -0700173 "api/socket_integration_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700174 "impl/network_reader_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700175 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700176 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700177 ]
Jordan Bayles063c3b52019-08-13 18:14:55 -0700178
Ryan Keane32c88d02019-07-02 18:46:14 -0700179 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700180 sources += [
181 "impl/network_waiter_posix_unittest.cc",
182 "impl/scoped_pipe_unittest.cc",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700183 "impl/socket_address_posix_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700184 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700185 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700186 }
187
188 deps = [
189 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700190 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700191 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700192 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700193
194 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700195}