blob: b037c8a726574967c0640652a4ea9cf7810c7a09 [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",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070017 "api/scoped_wake_lock.cc",
18 "api/scoped_wake_lock.h",
btolsch4051e722019-06-07 16:15:17 -070019 "api/socket.h",
Jordan Baylesb0c191e2019-03-26 15:49:57 -070020 "api/task_runner.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080021 "api/time.h",
Jordan Baylesa5ac5c82019-05-22 14:49:40 -070022 "api/tls_socket.h",
23 "api/tls_socket_creds.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070024 "api/udp_socket.cc",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070025 "api/udp_socket.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070026 "api/upd_read_callback.h",
Jordan Baylesb9262f42019-05-30 14:10:02 -070027 "base/ssl_context.cc",
28 "base/ssl_context.h",
btolsch2f2e7fa2019-03-29 16:48:49 -070029 "base/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080030 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080031
32 public_deps = [
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070033 "../osp_base",
btolsch2f2e7fa2019-03-29 16:48:49 -070034 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070035 "../third_party/boringssl",
Jordan Bayles9eb09742019-01-15 14:04:52 -080036 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070037
Jordan Baylesf1e4bb72019-05-01 12:38:39 -070038 allow_circular_includes_from = [ "../osp_base" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070039
Jordan Baylesa80724b2019-05-02 17:17:26 -070040 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080041
Jordan Baylesa80724b2019-05-02 17:17:26 -070042 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070043 sources += [
btolsch4666ed22019-04-25 15:58:07 -070044 "base/event_loop.cc",
45 "base/event_loop.h",
Ryan Keane32c88d02019-07-02 18:46:14 -070046 "base/network_reader.cc",
47 "base/network_reader.h",
48 "base/network_runner_impl.cc",
49 "base/network_runner_impl.h",
btolschc92ba2f2019-04-10 11:46:01 -070050 "base/task_runner_impl.cc",
51 "base/task_runner_impl.h",
52 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080053
54 if (is_linux) {
55 sources += [ "linux/network_interface.cc" ]
56 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070057 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080058 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
59 "__APPLE_USE_RFC_3542",
60 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070061
Yuri Wiitalab2d13232019-02-04 18:07:28 -080062 sources += [ "mac/network_interface.cc" ]
63 }
64
65 if (is_posix) {
66 sources += [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080067 "posix/event_waiter.cc",
Ryan Keane32c88d02019-07-02 18:46:14 -070068 "posix/network_waiter.cc",
69 "posix/network_waiter.h",
Jordan Baylesf3cf17d2019-06-11 15:29:43 -070070 "posix/scoped_wake_lock.cc",
71 "posix/scoped_wake_lock.h",
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070072 "posix/udp_socket.cc",
73 "posix/udp_socket.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080074 ]
75 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070076
77 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070078 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070079 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080080 }
btolsch9d6900c2018-05-30 18:22:53 -070081}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070082
Jordan Baylesaa021ce2019-05-29 13:57:44 -070083source_set("test") {
84 testonly = true
85 sources = [
86 "test/fake_clock.cc",
87 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -070088 "test/fake_task_runner.cc",
89 "test/fake_task_runner.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070090 "test/mock_udp_socket.cc",
91 "test/mock_udp_socket.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070092 ]
93
Jordan Bayles7bc7f102019-05-30 12:38:43 -070094 configs += [ "../build:allow_build_from_embedder" ]
95
Jordan Baylesaa021ce2019-05-29 13:57:44 -070096 deps = [
97 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -070098 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070099 ]
100}
101
Jordan Bayles9ade4152019-05-08 17:03:24 -0700102source_set("default_logger") {
103 sources = [
104 "base/logging.cc",
105 ]
106
107 if (is_posix) {
Jordan Baylesad2d2cd2019-05-22 14:49:40 -0700108 sources += [ "posix/log_initializer.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700109 }
110
111 configs += [ "../build:allow_build_from_embedder" ]
112
113 deps = [
114 "../osp_base",
115 "../third_party/abseil",
116 ]
117}
118
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700119source_set("platform_unittests") {
120 testonly = true
121
122 sources = [
123 "api/time_unittest.cc",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700124 "api/udp_socket_unittest.cc",
Jordan Baylesb9262f42019-05-30 14:10:02 -0700125 "base/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700126 ]
127
128 # The unit tests in base/ assume the standalone implementation is being used.
129 # Exclude them if an embedder is providing the implementation.
130 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700131 sources += [
Ryan Keane32c88d02019-07-02 18:46:14 -0700132 "base/network_reader_unittest.cc",
btolsch4051e722019-06-07 16:15:17 -0700133 "base/task_runner_impl_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700134 "base/time_unittest.cc",
135 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700136 if (is_posix) {
137 sources += [ "posix/network_waiter_unittest.cc" ]
138 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700139 }
140
141 deps = [
142 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700143 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700144 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700145 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700146
147 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700148}