blob: 4fb720c5d08044e5c62a5dd3029f7d545b25a0b0 [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 Keane32c88d02019-07-02 18:46:14 -070018 "api/network_waiter.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070019 "api/scoped_wake_lock.cc",
20 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070021 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070022 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080023 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070024 "api/tls_socket.h",
25 "api/tls_socket_creds.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070026 "api/trace_logging.h",
27 "api/trace_logging_platform.cc",
28 "api/trace_logging_platform.h",
29 "api/trace_logging_types.h",
Max Yakimakha04362e22019-07-22 17:54:45 -070030 "api/udp_packet.h",
31 "api/udp_read_callback.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070032 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070033 "api/udp_socket.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070034 "base/error.cc",
35 "base/error.h",
36 "base/ip_address.cc",
37 "base/ip_address.h",
38 "base/location.cc",
39 "base/location.h",
Jordan Baylescc471802019-07-09 14:25:02 -070040 "impl/ssl_context.cc",
41 "impl/ssl_context.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080042 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080043
44 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070045 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070046 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070047 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080048 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070049
Jordan Baylesa80724b2019-05-02 17:17:26 -070050 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080051
Jordan Baylesa80724b2019-05-02 17:17:26 -070052 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070053 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070054 "impl/network_reader.cc",
55 "impl/network_reader.h",
Ryan Keaneecdb30e2019-09-04 12:17:34 -070056 "impl/network_reader_thread.cc",
57 "impl/network_reader_thread.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070058 "impl/task_runner.cc",
59 "impl/task_runner.h",
Ryan Keaneecdb30e2019-09-04 12:17:34 -070060 "impl/task_runner_thread.cc",
61 "impl/task_runner_thread.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070062 "impl/text_trace_logging_platform.cc",
63 "impl/text_trace_logging_platform.h",
btolsch4397c292019-07-22 12:42:10 -070064 "impl/time.cc",
btolschc92ba2f2019-04-10 11:46:01 -070065 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080066
67 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070068 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080069 } else if (is_mac) {
Ryan Keane1d9c0c42019-07-29 15:22:19 -070070 defines += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080071 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
72 "__APPLE_USE_RFC_3542",
73 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070074
Jordan Baylescc471802019-07-09 14:25:02 -070075 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080076 }
77
78 if (is_posix) {
79 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070080 "impl/network_waiter_posix.cc",
81 "impl/network_waiter_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070082 "impl/scoped_pipe.h",
Jordan Baylescc471802019-07-09 14:25:02 -070083 "impl/scoped_wake_lock_posix.cc",
84 "impl/scoped_wake_lock_posix.h",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -070085 "impl/socket_address_posix.cc",
86 "impl/socket_address_posix.h",
87 "impl/stream_socket_posix.cc",
88 "impl/stream_socket_posix.h",
Jordan Baylescc471802019-07-09 14:25:02 -070089 "impl/udp_socket_posix.cc",
90 "impl/udp_socket_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080091 ]
92 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070093
94 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070095 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070096 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080097 }
btolsch9d6900c2018-05-30 18:22:53 -070098}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070099
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700100source_set("test") {
101 testonly = true
102 sources = [
103 "test/fake_clock.cc",
104 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700105 "test/fake_task_runner.cc",
106 "test/fake_task_runner.h",
Ryan Keane7d4b5fc2019-08-30 12:38:39 -0700107 "test/fake_udp_socket.cc",
108 "test/fake_udp_socket.h",
Ryan Keane38e7d512019-08-02 15:37:49 -0700109 "test/trace_logging_helpers.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700110 ]
111
Jordan Bayles7bc7f102019-05-30 12:38:43 -0700112 configs += [ "../build:allow_build_from_embedder" ]
113
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700114 deps = [
115 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700116 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700117 ]
118}
119
Jordan Bayles9ade4152019-05-08 17:03:24 -0700120source_set("default_logger") {
121 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700122 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700123 ]
124
125 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700126 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700127 }
128
129 configs += [ "../build:allow_build_from_embedder" ]
130
131 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700132 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700133 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700134 ]
135}
136
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700137source_set("platform_unittests") {
138 testonly = true
139
140 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700141 "api/internal/trace_logging_internal_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700142 "api/time_unittest.cc",
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700143 "api/trace_logging_unittest.cc",
Ryan Keane493029d2019-08-19 14:01:04 -0700144 "api/udp_socket_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700145 "base/error_unittest.cc",
146 "base/ip_address_unittest.cc",
147 "base/location_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700148 ]
149
Jordan Baylescc471802019-07-09 14:25:02 -0700150 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700151 # Exclude them if an embedder is providing the implementation.
152 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700153 sources += [
Jordan Bayles063c3b52019-08-13 18:14:55 -0700154 # TODO(jophba): move over to general sources when UDP socket create
155 # is implemented in Chromium, as part of the NetworkRunner work.
Ryan Keane493029d2019-08-19 14:01:04 -0700156 "api/socket_integration_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700157 "impl/network_reader_unittest.cc",
Jordan Bayles063c3b52019-08-13 18:14:55 -0700158 "impl/ssl_context_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700159 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700160 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700161 ]
Jordan Bayles063c3b52019-08-13 18:14:55 -0700162
Ryan Keane32c88d02019-07-02 18:46:14 -0700163 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700164 sources += [
165 "impl/network_waiter_posix_unittest.cc",
166 "impl/scoped_pipe_unittest.cc",
Jordan Bayles62b7c6a2019-08-15 10:32:33 -0700167 "impl/socket_address_posix_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700168 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700169 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700170 }
171
172 deps = [
173 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700174 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700175 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700176 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700177
178 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700179}