blob: bdaddf2e3011ec8a2cd3e6c65a1efde96f0ca99e [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 Baylescc471802019-07-09 14:25:02 -070027 "impl/ssl_context.cc",
28 "impl/ssl_context.h",
29 "impl/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 += [
Jordan Baylescc471802019-07-09 14:25:02 -070044 "impl/event_loop.cc",
45 "impl/event_loop.h",
46 "impl/network_reader.cc",
47 "impl/network_reader.h",
48 "impl/network_runner.cc",
49 "impl/network_runner.h",
50 "impl/task_runner_impl.cc",
51 "impl/task_runner_impl.h",
btolschc92ba2f2019-04-10 11:46:01 -070052 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080053
54 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070055 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080056 } 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
Jordan Baylescc471802019-07-09 14:25:02 -070062 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080063 }
64
65 if (is_posix) {
66 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070067 "impl/event_waiter_posix.cc",
68 "impl/network_waiter_posix.cc",
69 "impl/network_waiter_posix.h",
70 "impl/scoped_wake_lock_posix.cc",
71 "impl/scoped_wake_lock_posix.h",
72 "impl/udp_socket_posix.cc",
73 "impl/udp_socket_posix.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 = [
Jordan Baylescc471802019-07-09 14:25:02 -0700104 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700105 ]
106
107 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700108 sources += [ "impl/log_initializer_posix.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 Baylescc471802019-07-09 14:25:02 -0700125 "impl/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700126 ]
127
Jordan Baylescc471802019-07-09 14:25:02 -0700128 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700129 # Exclude them if an embedder is providing the implementation.
130 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700131 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -0700132 "impl/network_reader_unittest.cc",
133 "impl/task_runner_impl_unittest.cc",
134 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700135 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700136 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700137 sources += [ "impl/network_waiter_posix_unittest.cc" ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700138 }
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}