blob: e891b1b236dd0bae7df35200a05ac96f1568a18c [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") {
Yuri Wiitalab2d13232019-02-04 18:07:28 -08008 sources = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -08009 "api/event_waiter.cc",
10 "api/event_waiter.h",
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",
btolsch4051e722019-06-07 16:15:17 -070018 "api/network_runner.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070019 "api/network_waiter.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",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070025 "api/tls_socket.h",
26 "api/tls_socket_creds.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 Baylescc471802019-07-09 14:25:02 -070041 "impl/ssl_context.cc",
42 "impl/ssl_context.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080043 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080044
45 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070046 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070047 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070048 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080049 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070050
Jordan Baylesa80724b2019-05-02 17:17:26 -070051 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080052
Jordan Baylesa80724b2019-05-02 17:17:26 -070053 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070054 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070055 "impl/event_loop.cc",
56 "impl/event_loop.h",
57 "impl/network_reader.cc",
58 "impl/network_reader.h",
59 "impl/network_runner.cc",
60 "impl/network_runner.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070061 "impl/task_runner.cc",
62 "impl/task_runner.h",
Ryan Keaneefab2ed2019-07-22 12:36:53 -070063 "impl/text_trace_logging_platform.cc",
64 "impl/text_trace_logging_platform.h",
btolsch4397c292019-07-22 12:42:10 -070065 "impl/time.cc",
btolschc92ba2f2019-04-10 11:46:01 -070066 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080067
68 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070069 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080070 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070071 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080072 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
73 "__APPLE_USE_RFC_3542",
74 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070075
Jordan Baylescc471802019-07-09 14:25:02 -070076 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080077 }
78
79 if (is_posix) {
80 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070081 "impl/event_waiter_posix.cc",
82 "impl/network_waiter_posix.cc",
83 "impl/network_waiter_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070084 "impl/scoped_pipe.h",
Jordan Baylescc471802019-07-09 14:25:02 -070085 "impl/scoped_wake_lock_posix.cc",
86 "impl/scoped_wake_lock_posix.h",
87 "impl/udp_socket_posix.cc",
88 "impl/udp_socket_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080089 ]
90 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070091
92 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070093 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070094 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080095 }
btolsch9d6900c2018-05-30 18:22:53 -070096}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070097
Jordan Baylesaa021ce2019-05-29 13:57:44 -070098source_set("test") {
99 testonly = true
100 sources = [
101 "test/fake_clock.cc",
102 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -0700103 "test/fake_task_runner.cc",
104 "test/fake_task_runner.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700105 "test/mock_udp_socket.cc",
106 "test/mock_udp_socket.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700107 ]
108
Jordan Bayles7bc7f102019-05-30 12:38:43 -0700109 configs += [ "../build:allow_build_from_embedder" ]
110
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700111 deps = [
112 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700113 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700114 ]
115}
116
Jordan Bayles9ade4152019-05-08 17:03:24 -0700117source_set("default_logger") {
118 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700119 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700120 ]
121
122 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700123 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700124 }
125
126 configs += [ "../build:allow_build_from_embedder" ]
127
128 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700129 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700130 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700131 ]
132}
133
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700134source_set("platform_unittests") {
135 testonly = true
136
137 sources = [
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700138 "api/internal/trace_logging_internal_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700139 "api/time_unittest.cc",
Ryan Keaneefab2ed2019-07-22 12:36:53 -0700140 "api/trace_logging_unittest.cc",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700141 "api/udp_socket_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700142 "base/error_unittest.cc",
143 "base/ip_address_unittest.cc",
144 "base/location_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700145 "impl/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700146 ]
147
Jordan Baylescc471802019-07-09 14:25:02 -0700148 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700149 # Exclude them if an embedder is providing the implementation.
150 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700151 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -0700152 "impl/network_reader_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700153 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700154 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700155 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700156 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700157 sources += [
158 "impl/network_waiter_posix_unittest.cc",
159 "impl/scoped_pipe_unittest.cc",
160 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700161 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700162 }
163
164 deps = [
165 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700166 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700167 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700168 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700169
170 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700171}