blob: da43d538569e44a522a1c72f74e3ff3fe97dec19 [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",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080011 "api/logging.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070012 "api/logging_util.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080013 "api/network_interface.cc",
14 "api/network_interface.h",
btolsch4051e722019-06-07 16:15:17 -070015 "api/network_runner.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070016 "api/network_waiter.h",
btolsch4051e722019-06-07 16:15:17 -070017 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070018 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080019 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070020 "api/tls_socket.h",
21 "api/tls_socket_creds.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070022 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070023 "api/udp_socket.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070024 "api/upd_read_callback.h",
Jordan Baylesb9262f42019-05-30 14:10:02 -070025 "base/ssl_context.cc",
26 "base/ssl_context.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070027 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080028 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080029
30 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070031 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070032 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070033 "../third_party/boringssl",
Jordan Bayles9eb09742019-01-15 14:04:52 -080034 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070035
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070036 allow_circular_includes_from = [ "../osp_base" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070037
Jordan Baylesa80724b2019-05-02 17:17:26 -070038 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080039
Jordan Baylesa80724b2019-05-02 17:17:26 -070040 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070041 sources += [
btolsch4666ed22019-04-25 15:58:07 -070042 "base/event_loop.cc",
43 "base/event_loop.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070044 "base/network_reader.cc",
45 "base/network_reader.h",
46 "base/network_runner_impl.cc",
47 "base/network_runner_impl.h",
btolschc92ba2f2019-04-10 11:46:01 -070048 "base/task_runner_impl.cc",
49 "base/task_runner_impl.h",
50 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080051
52 if (is_linux) {
53 sources += [ "linux/network_interface.cc" ]
54 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070055 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080056 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
57 "__APPLE_USE_RFC_3542",
58 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070059
Yuri Wiitalab2d13232019-02-04 18:07:28 -080060 sources += [ "mac/network_interface.cc" ]
61 }
62
63 if (is_posix) {
64 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080065 "posix/event_waiter.cc",
Ryan Keane32c88d02019-07-02 18:46:14 -070066 "posix/network_waiter.cc",
67 "posix/network_waiter.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070068 "posix/udp_socket.cc",
69 "posix/udp_socket.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080070 ]
71 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070072
73 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070074 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070075 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080076 }
btolsch9d6900c2018-05-30 18:22:53 -070077}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070078
Jordan Baylesaa021ce2019-05-29 13:57:44 -070079source_set("test") {
80 testonly = true
81 sources = [
82 "test/fake_clock.cc",
83 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -070084 "test/fake_task_runner.cc",
85 "test/fake_task_runner.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070086 "test/mock_udp_socket.cc",
87 "test/mock_udp_socket.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070088 ]
89
Jordan Bayles7bc7f102019-05-30 12:38:43 -070090 configs += [ "../build:allow_build_from_embedder" ]
91
Jordan Baylesaa021ce2019-05-29 13:57:44 -070092 deps = [
93 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -070094 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070095 ]
96}
97
Jordan Bayles9ade4152019-05-08 17:03:24 -070098source_set("default_logger") {
99 sources = [
100 "base/logging.cc",
101 ]
102
103 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -0700104 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700105 }
106
107 configs += [ "../build:allow_build_from_embedder" ]
108
109 deps = [
110 "../osp_base",
111 "../third_party/abseil",
112 ]
113}
114
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700115source_set("platform_unittests") {
116 testonly = true
117
118 sources = [
119 "api/time_unittest.cc",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700120 "api/udp_socket_unittest.cc",
Jordan Baylesb9262f42019-05-30 14:10:02 -0700121 "base/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700122 ]
123
124 # The unit tests in base/ assume the standalone implementation is being used.
125 # Exclude them if an embedder is providing the implementation.
126 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700127 sources += [
Ryan Keane32c88d02019-07-02 18:46:14 -0700128 "base/network_reader_unittest.cc",
btolsch4051e722019-06-07 16:15:17 -0700129 "base/task_runner_impl_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700130 "base/time_unittest.cc",
131 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700132 if (is_posix) {
133 sources += [ "posix/network_waiter_unittest.cc" ]
134 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700135 }
136
137 deps = [
138 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700139 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700140 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700141 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700142
143 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700144}