blob: 5046a631f496fc524e548055bb5938afbef81890 [file] [log] [blame]
[email protected]7603bbd12013-08-13 17:33:371# Copyright (c) 2012 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
davidsz041528a2017-05-12 09:19:235import("//build/buildflag_header.gni")
phosek636bceb32015-10-27 03:36:486import("//build/config/nacl/config.gni")
amistryd4aa70d2016-06-23 07:52:377import("//mojo/public/tools/bindings/mojom.gni")
qsrfb5251d12015-01-21 15:57:228import("//testing/test.gni")
ochangcc11d0e2016-04-26 19:58:269import("//tools/ipc_fuzzer/ipc_fuzzer.gni")
qsrfb5251d12015-01-21 15:57:2210
davidsz041528a2017-05-12 09:19:2311declare_args() {
12 # Enabling debug builds automatically sets enable_ipc_logging to true.
13 enable_ipc_logging = is_debug
14}
15
16buildflag_header("ipc_features") {
17 header = "ipc_features.h"
18
19 flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ]
20}
21
[email protected]7603bbd12013-08-13 17:33:3722component("ipc") {
23 sources = [
mdempsky8a519042016-02-09 05:41:4724 "export_template.h",
erikcheneece6c32015-07-07 22:13:1125 "handle_attachment_win.cc",
erikchen151b2f92015-06-16 20:20:5126 "handle_attachment_win.h",
erikchen959039d2015-08-11 21:17:4727 "handle_win.cc",
28 "handle_win.h",
[email protected]7603bbd12013-08-13 17:33:3729 "ipc_channel.cc",
30 "ipc_channel.h",
scottmg7c7296f42015-02-28 02:23:0931 "ipc_channel_common.cc",
[email protected]64860882014-08-04 23:44:1732 "ipc_channel_factory.cc",
33 "ipc_channel_factory.h",
[email protected]7603bbd12013-08-13 17:33:3734 "ipc_channel_handle.h",
amistryd4aa70d2016-06-23 07:52:3735 "ipc_channel_mojo.cc",
36 "ipc_channel_mojo.h",
[email protected]7603bbd12013-08-13 17:33:3737 "ipc_channel_nacl.cc",
38 "ipc_channel_nacl.h",
[email protected]7603bbd12013-08-13 17:33:3739 "ipc_channel_proxy.cc",
40 "ipc_channel_proxy.h",
41 "ipc_channel_reader.cc",
42 "ipc_channel_reader.h",
[email protected]7603bbd12013-08-13 17:33:3743 "ipc_export.h",
[email protected]7603bbd12013-08-13 17:33:3744 "ipc_listener.h",
45 "ipc_logging.cc",
46 "ipc_logging.h",
47 "ipc_message.cc",
48 "ipc_message.h",
morrita98b7aaa2015-01-26 22:42:5449 "ipc_message_attachment.cc",
50 "ipc_message_attachment.h",
morrita4b5c28e22015-01-14 21:17:0651 "ipc_message_attachment_set.cc",
52 "ipc_message_attachment_set.h",
[email protected]7603bbd12013-08-13 17:33:3753 "ipc_message_macros.h",
amistryd4aa70d2016-06-23 07:52:3754 "ipc_message_pipe_reader.cc",
55 "ipc_message_pipe_reader.h",
[email protected]7603bbd12013-08-13 17:33:3756 "ipc_message_start.h",
mdempsky8a519042016-02-09 05:41:4757 "ipc_message_templates.h",
58 "ipc_message_templates_impl.h",
[email protected]7603bbd12013-08-13 17:33:3759 "ipc_message_utils.cc",
60 "ipc_message_utils.h",
amistryd4aa70d2016-06-23 07:52:3761 "ipc_mojo_bootstrap.cc",
62 "ipc_mojo_bootstrap.h",
63 "ipc_mojo_handle_attachment.cc",
64 "ipc_mojo_handle_attachment.h",
65 "ipc_mojo_message_helper.cc",
66 "ipc_mojo_message_helper.h",
67 "ipc_mojo_param_traits.cc",
68 "ipc_mojo_param_traits.h",
[email protected]7603bbd12013-08-13 17:33:3769 "ipc_platform_file.cc",
70 "ipc_platform_file.h",
morrita1aa788c2015-01-31 05:45:4271 "ipc_platform_file_attachment_posix.cc",
72 "ipc_platform_file_attachment_posix.h",
[email protected]7603bbd12013-08-13 17:33:3773 "ipc_sender.h",
[email protected]7603bbd12013-08-13 17:33:3774 "ipc_sync_channel.cc",
75 "ipc_sync_channel.h",
76 "ipc_sync_message.cc",
77 "ipc_sync_message.h",
78 "ipc_sync_message_filter.cc",
79 "ipc_sync_message_filter.h",
erikchen1c1e6652015-10-01 18:51:3280 "mach_port_attachment_mac.cc",
81 "mach_port_attachment_mac.h",
82 "mach_port_mac.cc",
83 "mach_port_mac.h",
[email protected]74122042014-04-25 00:07:3084 "message_filter.cc",
85 "message_filter.h",
86 "message_filter_router.cc",
87 "message_filter_router.h",
markdittmer638a1492016-02-19 01:11:5088 "message_router.cc",
89 "message_router.h",
[email protected]7603bbd12013-08-13 17:33:3790 "param_traits_log_macros.h",
91 "param_traits_macros.h",
92 "param_traits_read_macros.h",
93 "param_traits_write_macros.h",
94 "struct_constructor_macros.h",
95 "struct_destructor_macros.h",
[email protected]7603bbd12013-08-13 17:33:3796 ]
97
phosek636bceb32015-10-27 03:36:4898 if (is_nacl && !is_nacl_nonsfi) {
sammccde362062016-11-23 02:33:5799 sources -= [ "ipc_channel.cc" ]
dpranke6065cf72015-02-26 03:30:58100 } else {
[email protected]7603bbd12013-08-13 17:33:37101 sources -= [
102 "ipc_channel_nacl.cc",
103 "ipc_channel_nacl.h",
104 ]
[email protected]517d5282014-04-02 17:03:30105 }
[email protected]7603bbd12013-08-13 17:33:37106
Scott Graham3eebff02017-06-30 01:07:10107 if (is_fuchsia) {
108 sources += [
109 "handle_attachment_fuchsia.cc",
110 "handle_attachment_fuchsia.h",
111 "handle_fuchsia.cc",
112 "handle_fuchsia.h",
113 ]
114 }
115
[email protected]7603bbd12013-08-13 17:33:37116 defines = [ "IPC_IMPLEMENTATION" ]
117
brettwb7f2c302015-12-08 01:29:21118 public_deps = [
davidsz041528a2017-05-12 09:19:23119 ":ipc_features",
rockota628d0b2017-02-09 08:40:15120 ":mojom",
brettwb7f2c302015-12-08 01:29:21121 ":param_traits",
leon.hanf870ab52016-07-14 15:03:48122 "//mojo/public/cpp/bindings",
rockot6d7be622016-06-15 18:25:19123 "//mojo/public/cpp/system",
brettwb7f2c302015-12-08 01:29:21124 ]
[email protected]7603bbd12013-08-13 17:33:37125 deps = [
126 "//base",
[email protected]7603bbd12013-08-13 17:33:37127 ]
Sergey Ulanov384a29c92015-09-14 17:11:35128
erikchen3ee5d55e32015-10-09 23:20:49129 if (is_win || is_mac) {
130 # On Windows HandleAttachmentWin needs to generate random IDs.
131 # On Mac MachPortAttachmentMac needs to generate random IDs.
Sergey Ulanov384a29c92015-09-14 17:11:35132 deps += [ "//crypto" ]
133 }
ochangcc11d0e2016-04-26 19:58:26134
135 if (enable_ipc_fuzzer) {
136 public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ]
137 }
[email protected]7603bbd12013-08-13 17:33:37138}
139
Ken Rockotfe0424e72017-05-13 02:29:08140mojom_component("mojom") {
141 output_prefix = "ipc_mojom"
142 macro_prefix = "IPC_MOJOM"
amistryd4aa70d2016-06-23 07:52:37143 sources = [
144 "ipc.mojom",
145 ]
146}
147
rockot7c6bf952016-07-14 00:34:11148mojom("test_interfaces") {
149 testonly = true
150 sources = [
151 "ipc_test.mojom",
152 ]
Ken Rockot474df0142017-07-12 13:28:56153 support_lazy_serialization = true
rockot7c6bf952016-07-14 00:34:11154}
155
brettwb7f2c302015-12-08 01:29:21156# This is provided as a separate target so other targets can provide param
157# traits implementations without necessarily linking to all of IPC.
158source_set("param_traits") {
159 public = [
160 "ipc_param_traits.h",
161 ]
162}
163
sdefresne6fd373e2016-05-24 21:24:06164if (!is_ios) {
rockot6d7be622016-06-15 18:25:19165 source_set("run_all_unittests") {
166 testonly = true
167
168 sources = [
169 "run_all_unittests.cc",
170 ]
171
172 deps = [
173 "//base",
174 "//base/test:test_support",
175 "//mojo/edk/system",
amistryd4aa70d2016-06-23 07:52:37176 "//mojo/edk/test:test_support",
rockot6d7be622016-06-15 18:25:19177 ]
178 }
179
sdefresne6fd373e2016-05-24 21:24:06180 test("ipc_tests") {
181 sources = [
amistryd4aa70d2016-06-23 07:52:37182 "ipc_channel_mojo_unittest.cc",
sdefresne6fd373e2016-05-24 21:24:06183 "ipc_channel_proxy_unittest.cc",
184 "ipc_channel_reader_unittest.cc",
185 "ipc_fuzzing_tests.cc",
186 "ipc_message_attachment_set_posix_unittest.cc",
187 "ipc_message_unittest.cc",
188 "ipc_message_utils_unittest.cc",
amistryd4aa70d2016-06-23 07:52:37189 "ipc_mojo_bootstrap_unittest.cc",
sdefresne6fd373e2016-05-24 21:24:06190 "ipc_sync_channel_unittest.cc",
191 "ipc_sync_message_unittest.cc",
192 "ipc_sync_message_unittest.h",
193 "ipc_test_message_generator.cc",
194 "ipc_test_message_generator.h",
195 "ipc_test_messages.h",
sdefresne6fd373e2016-05-24 21:24:06196 "sync_socket_unittest.cc",
197 ]
pkotwicza553a3b2015-10-16 22:29:46198
sdefresne6fd373e2016-05-24 21:24:06199 if (!is_ios) {
200 sources += [ "ipc_send_fds_test.cc" ]
201 }
202
sdefresne6fd373e2016-05-24 21:24:06203 deps = [
204 ":ipc",
rockot6d7be622016-06-15 18:25:19205 ":run_all_unittests",
rockot7c6bf952016-07-14 00:34:11206 ":test_interfaces",
sdefresne6fd373e2016-05-24 21:24:06207 ":test_support",
208 "//base",
209 "//base:i18n",
210 "//base/test:test_support",
211 "//crypto",
amistryd4aa70d2016-06-23 07:52:37212 "//mojo/edk/system",
213 "//mojo/edk/test:test_support",
sdefresne6fd373e2016-05-24 21:24:06214 "//testing/gtest",
215 ]
216
217 if (is_mac) {
218 deps += [ "//sandbox/mac:seatbelt" ]
219 }
Scott Grahamf4b38b42017-06-19 23:09:33220
221 if (is_fuchsia) {
222 sources -= [
223 # No AF_UNIX domain sockets on Fuchsia.
224 "sync_socket_unittest.cc",
225 ]
226 }
dpranke177c1e22015-07-22 23:07:43227 }
228
sdefresne6fd373e2016-05-24 21:24:06229 test("ipc_perftests") {
230 sources = [
amistryd4aa70d2016-06-23 07:52:37231 "ipc_mojo_perftest.cc",
amistryd4aa70d2016-06-23 07:52:37232 "run_all_perftests.cc",
sdefresne6fd373e2016-05-24 21:24:06233 ]
234
sdefresne6fd373e2016-05-24 21:24:06235 deps = [
236 ":ipc",
jamca86c9e2017-01-06 19:55:57237 ":test_interfaces",
sdefresne6fd373e2016-05-24 21:24:06238 ":test_support",
239 "//base",
240 "//base:i18n",
241 "//base/test:test_support",
amistryd4aa70d2016-06-23 07:52:37242 "//mojo/edk/system",
243 "//mojo/edk/test:test_support",
jamca86c9e2017-01-06 19:55:57244 "//mojo/edk/test:test_support_impl",
sdefresne6fd373e2016-05-24 21:24:06245 "//testing/gtest",
246 ]
brettwa59908d22016-01-21 19:16:48247 }
248
brettw3871f522016-07-14 22:08:34249 static_library("test_support") {
sdefresne6fd373e2016-05-24 21:24:06250 testonly = true
251 sources = [
sdefresne6fd373e2016-05-24 21:24:06252 "ipc_security_test_util.cc",
253 "ipc_security_test_util.h",
254 "ipc_test_base.cc",
255 "ipc_test_base.h",
256 "ipc_test_channel_listener.cc",
257 "ipc_test_channel_listener.h",
258 "ipc_test_sink.cc",
259 "ipc_test_sink.h",
sdefresne6fd373e2016-05-24 21:24:06260 ]
261 public_deps = [
262 ":ipc",
263 ]
264 deps = [
265 "//base",
266 "//base/test:test_support",
sammc4bcc4ed62016-10-27 10:13:59267 "//mojo/edk/test:test_support",
sdefresne6fd373e2016-05-24 21:24:06268 "//testing/gtest",
269 ]
kerrneldc059fe2016-04-12 16:39:06270 }
pkotwicza553a3b2015-10-16 22:29:46271}