blob: 075d3b59c4ad32ecee91a5a708f1a0727b8d7784 [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",
Ryan Keane52e2fd82019-10-08 11:44:11 -070018 "api/platform_client.cc",
19 "api/platform_client.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070020 "api/scoped_wake_lock.cc",
21 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070022 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070023 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080024 "api/time.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070025 "api/tls_connection.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070026 "api/tls_connection.h",
Ryan Keanefdebe6c2019-09-06 14:12:51 -070027 "api/tls_connection_factory.cc",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070028 "api/tls_connection_factory.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070029 "api/trace_logging.h",
30 "api/trace_logging_platform.cc",
31 "api/trace_logging_platform.h",
32 "api/trace_logging_types.h",
Max Yakimakha04362e22019-07-22 17:54:45 -070033 "api/udp_packet.h",
34 "api/udp_read_callback.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070035 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070036 "api/udp_socket.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070037 "base/error.cc",
38 "base/error.h",
39 "base/ip_address.cc",
40 "base/ip_address.h",
41 "base/location.cc",
42 "base/location.h",
Jordan Baylesc56f0382019-10-10 16:57:56 -070043 "base/serial_delete_ptr.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -070044 "base/socket_state.h",
45 "base/tls_connect_options.h",
46 "base/tls_credentials.cc",
47 "base/tls_credentials.h",
48 "base/tls_listen_options.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080049 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080050
51 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070052 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070053 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070054 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080055 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070056
Jordan Bayles21b5adc2019-10-25 12:01:20 -070057 public_configs = [ "../build:openscreen_include_dirs" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080058
Jordan Baylesa80724b2019-05-02 17:17:26 -070059 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070060 sources += [
Ryan Keane3b88a252019-09-17 09:55:33 -070061 "impl/socket_handle.h",
Ryan Keane2fdf9662019-09-25 13:29:32 -070062 "impl/socket_handle_waiter.cc",
63 "impl/socket_handle_waiter.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070064 "impl/task_runner.cc",
65 "impl/task_runner.h",
Ryan Keaneecdb30e2019-09-04 12:17:34 -070066 "impl/task_runner_thread.cc",
67 "impl/task_runner_thread.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",
Ryan Keanec5e56e72019-09-18 18:21:40 -070071 "impl/tls_write_buffer.cc",
72 "impl/tls_write_buffer.h",
btolschc92ba2f2019-04-10 11:46:01 -070073 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080074
75 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070076 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080077 } else if (is_mac) {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070078 defines += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080079 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
80 "__APPLE_USE_RFC_3542",
81 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070082
Jordan Baylesc56f0382019-10-10 16:57:56 -070083 libs = [
84 "CoreFoundation.framework",
85 "IOKit.framework",
86 ]
87
88 sources += [
89 "impl/network_interface_mac.cc",
90 "impl/scoped_wake_lock_mac.cc",
91 "impl/scoped_wake_lock_mac.h",
92 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080093 }
94
95 if (is_posix) {
96 sources += [
Ryan Keane52e2fd82019-10-08 11:44:11 -070097 "impl/platform_client_posix.cc",
98 "impl/platform_client_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070099 "impl/scoped_pipe.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700100 "impl/socket_address_posix.cc",
101 "impl/socket_address_posix.h",
Ryan Keane6e542522019-09-10 16:05:44 -0700102 "impl/socket_handle_posix.cc",
103 "impl/socket_handle_posix.h",
Ryan Keane2fdf9662019-09-25 13:29:32 -0700104 "impl/socket_handle_waiter_posix.cc",
105 "impl/socket_handle_waiter_posix.h",
106 "impl/socket_handle_waiter_thread.cc",
107 "impl/socket_handle_waiter_thread.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -0700108 "impl/stream_socket.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700109 "impl/stream_socket_posix.cc",
110 "impl/stream_socket_posix.h",
Jordan Bayles1c785bd2019-08-15 10:32:33 -0700111 "impl/tls_connection_factory_posix.cc",
112 "impl/tls_connection_factory_posix.h",
113 "impl/tls_connection_posix.cc",
114 "impl/tls_connection_posix.h",
Ryan Keaneffa8c1e2019-09-23 10:42:48 -0700115 "impl/tls_data_router_posix.cc",
116 "impl/tls_data_router_posix.h",
Jordan Baylescc471802019-07-09 14:25:02 -0700117 "impl/udp_socket_posix.cc",
118 "impl/udp_socket_posix.h",
Ryan Keanee93f8c72019-09-25 12:35:00 -0700119 "impl/udp_socket_reader_posix.cc",
120 "impl/udp_socket_reader_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -0800121 ]
122 }
Jordan Bayles9ade4152019-05-08 17:03:24 -0700123
124 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -0700125 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700126 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -0800127 }
btolsch9d6900c2018-05-30 18:22:53 -0700128}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700129
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700130source_set("test") {
131 testonly = true
132 sources = [
133 "test/fake_clock.cc",
134 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700135 "test/fake_task_runner.cc",
136 "test/fake_task_runner.h",
Ryan Keane7d4b5fc2019-08-30 12:38:39 -0700137 "test/fake_udp_socket.cc",
138 "test/fake_udp_socket.h",
Ryan Keane38e7d512019-08-02 15:37:49 -0700139 "test/trace_logging_helpers.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700140 ]
141
142 deps = [
143 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700144 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700145 ]
146}
147
Jordan Bayles9ade4152019-05-08 17:03:24 -0700148source_set("default_logger") {
149 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700150 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700151 ]
152
153 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700154 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700155 }
156
Jordan Bayles9ade4152019-05-08 17:03:24 -0700157 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700158 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700159 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700160 ]
161}
162
mark a. foltz3fe46172019-09-18 05:50:30 -0700163source_set("unittests") {
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700164 testonly = true
165
166 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700167 "api/internal/trace_logging_internal_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700168 "api/time_unittest.cc",
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700169 "api/trace_logging_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700170 "base/error_unittest.cc",
171 "base/ip_address_unittest.cc",
172 "base/location_unittest.cc",
Jordan Baylesc56f0382019-10-10 16:57:56 -0700173 "base/serial_delete_ptr_unittest.cc",
Jordan Bayles05ce6b62019-09-06 14:09:10 -0700174 "base/tls_credentials_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700175 ]
176
Jordan Baylescc471802019-07-09 14:25:02 -0700177 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700178 # Exclude them if an embedder is providing the implementation.
179 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700180 sources += [
Jordan Bayles063c3b52019-08-13 18:14:55 -0700181 # TODO(jophba): move over to general sources when UDP socket create
182 # is implemented in Chromium, as part of the NetworkRunner work.
Ryan Keane493029d2019-08-19 14:01:04 -0700183 "api/socket_integration_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700184 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700185 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700186 ]
Jordan Bayles063c3b52019-08-13 18:14:55 -0700187
Ryan Keane32c88d02019-07-02 18:46:14 -0700188 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700189 sources += [
Jordan Baylesa26582d2019-07-10 14:44:58 -0700190 "impl/scoped_pipe_unittest.cc",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700191 "impl/socket_address_posix_unittest.cc",
Ryan Keane2fdf9662019-09-25 13:29:32 -0700192 "impl/socket_handle_waiter_posix_unittest.cc",
Ryan Keaned838a252019-09-25 12:48:15 -0700193 "impl/tls_data_router_posix_unittest.cc",
Ryan Keanef2776122019-10-11 09:07:33 -0700194 "impl/tls_write_buffer_unittest.cc",
Ryan Keanee93f8c72019-09-25 12:35:00 -0700195 "impl/udp_socket_reader_posix_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700196 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700197 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700198 }
199
200 deps = [
201 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700202 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700203 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700204 ]
205}