blob: 1ee805b0ffee476ed743bcb15c0df6ce1bdf8148 [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 Baylesa26582d2019-07-10 14:44:58 -070027 "base/error.cc",
28 "base/error.h",
29 "base/ip_address.cc",
30 "base/ip_address.h",
31 "base/location.cc",
32 "base/location.h",
Jordan Baylescc471802019-07-09 14:25:02 -070033 "impl/ssl_context.cc",
34 "impl/ssl_context.h",
35 "impl/time.cc",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080036 ]
Jordan Bayles9eb09742019-01-15 14:04:52 -080037
38 public_deps = [
btolsch2f2e7fa2019-03-29 16:48:49 -070039 "../third_party/abseil",
Jordan Baylesb9262f42019-05-30 14:10:02 -070040 "../third_party/boringssl",
Jordan Baylesa26582d2019-07-10 14:44:58 -070041 "../util",
Jordan Bayles9eb09742019-01-15 14:04:52 -080042 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070043
Jordan Baylesa26582d2019-07-10 14:44:58 -070044 allow_circular_includes_from = [ "../util" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070045
Jordan Baylesa80724b2019-05-02 17:17:26 -070046 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080047
Jordan Baylesa80724b2019-05-02 17:17:26 -070048 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -070049 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070050 "impl/event_loop.cc",
51 "impl/event_loop.h",
52 "impl/network_reader.cc",
53 "impl/network_reader.h",
54 "impl/network_runner.cc",
55 "impl/network_runner.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070056 "impl/task_runner.cc",
57 "impl/task_runner.h",
btolschc92ba2f2019-04-10 11:46:01 -070058 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080059
60 if (is_linux) {
Jordan Baylescc471802019-07-09 14:25:02 -070061 sources += [ "impl/network_interface_linux.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080062 } else if (is_mac) {
Jordan Baylesa80724b2019-05-02 17:17:26 -070063 defines = [
Yuri Wiitalab2d13232019-02-04 18:07:28 -080064 # Required, to use the new IPv6 Sockets options introduced by RFC 3542.
65 "__APPLE_USE_RFC_3542",
66 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -070067
Jordan Baylescc471802019-07-09 14:25:02 -070068 sources += [ "impl/network_interface_mac.cc" ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080069 }
70
71 if (is_posix) {
72 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -070073 "impl/event_waiter_posix.cc",
74 "impl/network_waiter_posix.cc",
75 "impl/network_waiter_posix.h",
Jordan Baylesa26582d2019-07-10 14:44:58 -070076 "impl/scoped_pipe.h",
Jordan Baylescc471802019-07-09 14:25:02 -070077 "impl/scoped_wake_lock_posix.cc",
78 "impl/scoped_wake_lock_posix.h",
79 "impl/udp_socket_posix.cc",
80 "impl/udp_socket_posix.h",
Yuri Wiitalab2d13232019-02-04 18:07:28 -080081 ]
82 }
Jordan Bayles9ade4152019-05-08 17:03:24 -070083
84 deps = [
Jordan Baylesad2d2cd2019-05-22 14:49:40 -070085 ":default_logger",
Jordan Bayles9ade4152019-05-08 17:03:24 -070086 ]
Yuri Wiitalab2d13232019-02-04 18:07:28 -080087 }
btolsch9d6900c2018-05-30 18:22:53 -070088}
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -070089
Jordan Baylesaa021ce2019-05-29 13:57:44 -070090source_set("test") {
91 testonly = true
92 sources = [
93 "test/fake_clock.cc",
94 "test/fake_clock.h",
Yuri Wiitalaec353612019-06-18 17:32:39 -070095 "test/fake_task_runner.cc",
96 "test/fake_task_runner.h",
Ryan Keanedeb48b32019-06-28 16:24:40 -070097 "test/mock_udp_socket.cc",
98 "test/mock_udp_socket.h",
Jordan Baylesaa021ce2019-05-29 13:57:44 -070099 ]
100
Jordan Bayles7bc7f102019-05-30 12:38:43 -0700101 configs += [ "../build:allow_build_from_embedder" ]
102
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700103 deps = [
104 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700105 "../third_party/googletest:gmock",
Jordan Baylesaa021ce2019-05-29 13:57:44 -0700106 ]
107}
108
Jordan Bayles9ade4152019-05-08 17:03:24 -0700109source_set("default_logger") {
110 sources = [
Jordan Baylescc471802019-07-09 14:25:02 -0700111 "impl/logging.cc",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700112 ]
113
114 if (is_posix) {
Jordan Baylescc471802019-07-09 14:25:02 -0700115 sources += [ "impl/log_initializer_posix.cc" ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700116 }
117
118 configs += [ "../build:allow_build_from_embedder" ]
119
120 deps = [
Jordan Bayles9ade4152019-05-08 17:03:24 -0700121 "../third_party/abseil",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700122 "../util",
Jordan Bayles9ade4152019-05-08 17:03:24 -0700123 ]
124}
125
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700126source_set("platform_unittests") {
127 testonly = true
128
129 sources = [
130 "api/time_unittest.cc",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700131 "api/udp_socket_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700132 "base/error_unittest.cc",
133 "base/ip_address_unittest.cc",
134 "base/location_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700135 "impl/ssl_context_unittest.cc",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700136 ]
137
Jordan Baylescc471802019-07-09 14:25:02 -0700138 # The unit tests in impl/ assume the standalone implementation is being used.
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700139 # Exclude them if an embedder is providing the implementation.
140 if (!build_with_chromium) {
btolschc92ba2f2019-04-10 11:46:01 -0700141 sources += [
Jordan Baylescc471802019-07-09 14:25:02 -0700142 "impl/network_reader_unittest.cc",
Jordan Baylesa26582d2019-07-10 14:44:58 -0700143 "impl/task_runner_unittest.cc",
Jordan Baylescc471802019-07-09 14:25:02 -0700144 "impl/time_unittest.cc",
btolschc92ba2f2019-04-10 11:46:01 -0700145 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700146 if (is_posix) {
Jordan Baylesa26582d2019-07-10 14:44:58 -0700147 sources += [
148 "impl/network_waiter_posix_unittest.cc",
149 "impl/scoped_pipe_unittest.cc",
150 ]
Ryan Keane32c88d02019-07-02 18:46:14 -0700151 }
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700152 }
153
154 deps = [
155 ":platform",
Ryan Keanedeb48b32019-06-28 16:24:40 -0700156 "../third_party/googletest:gmock",
btolsch4666ed22019-04-25 15:58:07 -0700157 "../third_party/googletest:gtest",
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700158 ]
Jordan Bayles9ade4152019-05-08 17:03:24 -0700159
160 configs += [ "../build:allow_build_from_embedder" ]
Yuri Wiitalaeb8eee72019-03-26 15:52:43 -0700161}