[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 1 | # 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 | |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 5 | import("//build/buildflag_header.gni") |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 6 | import("//build/config/nacl/config.gni") |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 7 | import("//mojo/public/tools/bindings/mojom.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 8 | import("//testing/test.gni") |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 9 | import("//tools/ipc_fuzzer/ipc_fuzzer.gni") |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 10 | import("//third_party/protobuf/proto_library.gni") |
qsr | fb5251d1 | 2015-01-21 15:57:22 | [diff] [blame] | 11 | |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 12 | declare_args() { |
| 13 | # Enabling debug builds automatically sets enable_ipc_logging to true. |
| 14 | enable_ipc_logging = is_debug |
| 15 | } |
| 16 | |
| 17 | buildflag_header("ipc_features") { |
| 18 | header = "ipc_features.h" |
| 19 | |
| 20 | flags = [ "IPC_MESSAGE_LOG_ENABLED=$enable_ipc_logging" ] |
| 21 | } |
| 22 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 23 | component("ipc") { |
| 24 | sources = [ |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 25 | "export_template.h", |
erikchen | eece6c3 | 2015-07-07 22:13:11 | [diff] [blame] | 26 | "handle_attachment_win.cc", |
erikchen | 151b2f9 | 2015-06-16 20:20:51 | [diff] [blame] | 27 | "handle_attachment_win.h", |
erikchen | 959039d | 2015-08-11 21:17:47 | [diff] [blame] | 28 | "handle_win.cc", |
| 29 | "handle_win.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 30 | "ipc_channel.cc", |
| 31 | "ipc_channel.h", |
scottmg | 7c7296f4 | 2015-02-28 02:23:09 | [diff] [blame] | 32 | "ipc_channel_common.cc", |
[email protected] | 6486088 | 2014-08-04 23:44:17 | [diff] [blame] | 33 | "ipc_channel_factory.cc", |
| 34 | "ipc_channel_factory.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 35 | "ipc_channel_handle.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 36 | "ipc_channel_mojo.cc", |
| 37 | "ipc_channel_mojo.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 38 | "ipc_channel_nacl.cc", |
| 39 | "ipc_channel_nacl.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 40 | "ipc_channel_proxy.cc", |
| 41 | "ipc_channel_proxy.h", |
| 42 | "ipc_channel_reader.cc", |
| 43 | "ipc_channel_reader.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 44 | "ipc_export.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 45 | "ipc_listener.h", |
| 46 | "ipc_logging.cc", |
| 47 | "ipc_logging.h", |
| 48 | "ipc_message.cc", |
| 49 | "ipc_message.h", |
morrita | 98b7aaa | 2015-01-26 22:42:54 | [diff] [blame] | 50 | "ipc_message_attachment.cc", |
| 51 | "ipc_message_attachment.h", |
morrita | 4b5c28e2 | 2015-01-14 21:17:06 | [diff] [blame] | 52 | "ipc_message_attachment_set.cc", |
| 53 | "ipc_message_attachment_set.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 54 | "ipc_message_macros.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 55 | "ipc_message_pipe_reader.cc", |
| 56 | "ipc_message_pipe_reader.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 57 | "ipc_message_start.h", |
mdempsky | 8a51904 | 2016-02-09 05:41:47 | [diff] [blame] | 58 | "ipc_message_templates.h", |
| 59 | "ipc_message_templates_impl.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 60 | "ipc_message_utils.cc", |
| 61 | "ipc_message_utils.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 62 | "ipc_mojo_bootstrap.cc", |
| 63 | "ipc_mojo_bootstrap.h", |
| 64 | "ipc_mojo_handle_attachment.cc", |
| 65 | "ipc_mojo_handle_attachment.h", |
| 66 | "ipc_mojo_message_helper.cc", |
| 67 | "ipc_mojo_message_helper.h", |
| 68 | "ipc_mojo_param_traits.cc", |
| 69 | "ipc_mojo_param_traits.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 70 | "ipc_platform_file.cc", |
| 71 | "ipc_platform_file.h", |
morrita | 1aa788c | 2015-01-31 05:45:42 | [diff] [blame] | 72 | "ipc_platform_file_attachment_posix.cc", |
| 73 | "ipc_platform_file_attachment_posix.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 74 | "ipc_sender.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 75 | "ipc_sync_channel.cc", |
| 76 | "ipc_sync_channel.h", |
| 77 | "ipc_sync_message.cc", |
| 78 | "ipc_sync_message.h", |
| 79 | "ipc_sync_message_filter.cc", |
| 80 | "ipc_sync_message_filter.h", |
erikchen | 1c1e665 | 2015-10-01 18:51:32 | [diff] [blame] | 81 | "mach_port_attachment_mac.cc", |
| 82 | "mach_port_attachment_mac.h", |
| 83 | "mach_port_mac.cc", |
| 84 | "mach_port_mac.h", |
[email protected] | 7412204 | 2014-04-25 00:07:30 | [diff] [blame] | 85 | "message_filter.cc", |
| 86 | "message_filter.h", |
| 87 | "message_filter_router.cc", |
| 88 | "message_filter_router.h", |
markdittmer | 638a149 | 2016-02-19 01:11:50 | [diff] [blame] | 89 | "message_router.cc", |
| 90 | "message_router.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 91 | "param_traits_log_macros.h", |
| 92 | "param_traits_macros.h", |
| 93 | "param_traits_read_macros.h", |
| 94 | "param_traits_write_macros.h", |
| 95 | "struct_constructor_macros.h", |
| 96 | "struct_destructor_macros.h", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 97 | ] |
| 98 | |
phosek | 636bceb3 | 2015-10-27 03:36:48 | [diff] [blame] | 99 | if (is_nacl && !is_nacl_nonsfi) { |
sammc | cde36206 | 2016-11-23 02:33:57 | [diff] [blame] | 100 | sources -= [ "ipc_channel.cc" ] |
dpranke | 6065cf7 | 2015-02-26 03:30:58 | [diff] [blame] | 101 | } else { |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 102 | sources -= [ |
| 103 | "ipc_channel_nacl.cc", |
| 104 | "ipc_channel_nacl.h", |
| 105 | ] |
[email protected] | 517d528 | 2014-04-02 17:03:30 | [diff] [blame] | 106 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 107 | |
Scott Graham | 3eebff0 | 2017-06-30 01:07:10 | [diff] [blame] | 108 | if (is_fuchsia) { |
| 109 | sources += [ |
| 110 | "handle_attachment_fuchsia.cc", |
| 111 | "handle_attachment_fuchsia.h", |
| 112 | "handle_fuchsia.cc", |
| 113 | "handle_fuchsia.h", |
| 114 | ] |
| 115 | } |
| 116 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 117 | defines = [ "IPC_IMPLEMENTATION" ] |
| 118 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 119 | public_deps = [ |
davidsz | 041528a | 2017-05-12 09:19:23 | [diff] [blame] | 120 | ":ipc_features", |
rockot | a628d0b | 2017-02-09 08:40:15 | [diff] [blame] | 121 | ":mojom", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 122 | ":param_traits", |
leon.han | f870ab5 | 2016-07-14 15:03:48 | [diff] [blame] | 123 | "//mojo/public/cpp/bindings", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 124 | "//mojo/public/cpp/system", |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 125 | ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 126 | |
| 127 | if (!is_nacl_nonsfi) { |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 128 | sources += [ "ipc_message_protobuf_utils.h" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 129 | |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 130 | public_deps += [ "//third_party/protobuf:protobuf_lite" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 131 | } |
| 132 | |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 133 | deps = [ |
| 134 | "//base", |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 135 | ] |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 136 | |
erikchen | 3ee5d55e3 | 2015-10-09 23:20:49 | [diff] [blame] | 137 | if (is_win || is_mac) { |
| 138 | # On Windows HandleAttachmentWin needs to generate random IDs. |
| 139 | # On Mac MachPortAttachmentMac needs to generate random IDs. |
Sergey Ulanov | 384a29c9 | 2015-09-14 17:11:35 | [diff] [blame] | 140 | deps += [ "//crypto" ] |
| 141 | } |
ochang | cc11d0e | 2016-04-26 19:58:26 | [diff] [blame] | 142 | |
| 143 | if (enable_ipc_fuzzer) { |
| 144 | public_configs = [ "//tools/ipc_fuzzer:ipc_fuzzer_config" ] |
| 145 | } |
[email protected] | 7603bbd1 | 2013-08-13 17:33:37 | [diff] [blame] | 146 | } |
| 147 | |
Ken Rockot | fe0424e7 | 2017-05-13 02:29:08 | [diff] [blame] | 148 | mojom_component("mojom") { |
| 149 | output_prefix = "ipc_mojom" |
| 150 | macro_prefix = "IPC_MOJOM" |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 151 | sources = [ |
| 152 | "ipc.mojom", |
| 153 | ] |
Yuzhu Shen | a0a2b36 | 2017-08-25 22:31:39 | [diff] [blame] | 154 | public_deps = [ |
| 155 | "//mojo/common:read_only_buffer", |
| 156 | ] |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 157 | } |
| 158 | |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 159 | mojom("test_interfaces") { |
| 160 | testonly = true |
| 161 | sources = [ |
| 162 | "ipc_test.mojom", |
| 163 | ] |
Ken Rockot | 474df014 | 2017-07-12 13:28:56 | [diff] [blame] | 164 | support_lazy_serialization = true |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 165 | } |
| 166 | |
brettw | b7f2c30 | 2015-12-08 01:29:21 | [diff] [blame] | 167 | # This is provided as a separate target so other targets can provide param |
| 168 | # traits implementations without necessarily linking to all of IPC. |
| 169 | source_set("param_traits") { |
| 170 | public = [ |
| 171 | "ipc_param_traits.h", |
| 172 | ] |
| 173 | } |
| 174 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 175 | if (!is_ios) { |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 176 | source_set("run_all_unittests") { |
| 177 | testonly = true |
| 178 | |
| 179 | sources = [ |
| 180 | "run_all_unittests.cc", |
| 181 | ] |
| 182 | |
| 183 | deps = [ |
| 184 | "//base", |
| 185 | "//base/test:test_support", |
| 186 | "//mojo/edk/system", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 187 | "//mojo/edk/test:test_support", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 188 | ] |
| 189 | } |
| 190 | |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 191 | proto_library("test_proto") { |
| 192 | sources = [ |
| 193 | "test_proto.proto", |
| 194 | ] |
| 195 | } |
| 196 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 197 | test("ipc_tests") { |
| 198 | sources = [ |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 199 | "ipc_channel_mojo_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 200 | "ipc_channel_proxy_unittest.cc", |
| 201 | "ipc_channel_reader_unittest.cc", |
| 202 | "ipc_fuzzing_tests.cc", |
| 203 | "ipc_message_attachment_set_posix_unittest.cc", |
| 204 | "ipc_message_unittest.cc", |
| 205 | "ipc_message_utils_unittest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 206 | "ipc_mojo_bootstrap_unittest.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 207 | "ipc_sync_channel_unittest.cc", |
| 208 | "ipc_sync_message_unittest.cc", |
| 209 | "ipc_sync_message_unittest.h", |
| 210 | "ipc_test_message_generator.cc", |
| 211 | "ipc_test_message_generator.h", |
| 212 | "ipc_test_messages.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 213 | "sync_socket_unittest.cc", |
| 214 | ] |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 215 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 216 | if (!is_ios) { |
| 217 | sources += [ "ipc_send_fds_test.cc" ] |
| 218 | } |
| 219 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 220 | deps = [ |
| 221 | ":ipc", |
rockot | 6d7be62 | 2016-06-15 18:25:19 | [diff] [blame] | 222 | ":run_all_unittests", |
rockot | 7c6bf95 | 2016-07-14 00:34:11 | [diff] [blame] | 223 | ":test_interfaces", |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 224 | ":test_proto", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 225 | ":test_support", |
| 226 | "//base", |
| 227 | "//base:i18n", |
| 228 | "//base/test:test_support", |
| 229 | "//crypto", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 230 | "//mojo/edk/system", |
| 231 | "//mojo/edk/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 232 | "//testing/gtest", |
| 233 | ] |
| 234 | |
| 235 | if (is_mac) { |
| 236 | deps += [ "//sandbox/mac:seatbelt" ] |
| 237 | } |
Scott Graham | f4b38b4 | 2017-06-19 23:09:33 | [diff] [blame] | 238 | |
| 239 | if (is_fuchsia) { |
| 240 | sources -= [ |
| 241 | # No AF_UNIX domain sockets on Fuchsia. |
| 242 | "sync_socket_unittest.cc", |
| 243 | ] |
| 244 | } |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 245 | |
| 246 | if (!is_nacl_nonsfi) { |
Mike Bjorge | b7bf5b9 | 2017-07-28 00:43:49 | [diff] [blame] | 247 | sources += [ "ipc_message_protobuf_utils_unittest.cc" ] |
zijiehe | 84eef4fa | 2017-07-18 20:39:50 | [diff] [blame] | 248 | } |
dpranke | 177c1e2 | 2015-07-22 23:07:43 | [diff] [blame] | 249 | } |
| 250 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 251 | test("ipc_perftests") { |
| 252 | sources = [ |
Yuzhu Shen | 4d50dc4 | 2017-09-06 20:39:09 | [diff] [blame^] | 253 | "ipc_cpu_perftest.cc", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 254 | "ipc_mojo_perftest.cc", |
Yuzhu Shen | 4d50dc4 | 2017-09-06 20:39:09 | [diff] [blame^] | 255 | "ipc_perftest_messages.cc", |
| 256 | "ipc_perftest_messages.h", |
| 257 | "ipc_perftest_util.cc", |
| 258 | "ipc_perftest_util.h", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 259 | "run_all_perftests.cc", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 260 | ] |
| 261 | |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 262 | deps = [ |
| 263 | ":ipc", |
jam | ca86c9e | 2017-01-06 19:55:57 | [diff] [blame] | 264 | ":test_interfaces", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 265 | ":test_support", |
| 266 | "//base", |
| 267 | "//base:i18n", |
| 268 | "//base/test:test_support", |
amistry | d4aa70d | 2016-06-23 07:52:37 | [diff] [blame] | 269 | "//mojo/edk/system", |
| 270 | "//mojo/edk/test:test_support", |
jam | ca86c9e | 2017-01-06 19:55:57 | [diff] [blame] | 271 | "//mojo/edk/test:test_support_impl", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 272 | "//testing/gtest", |
| 273 | ] |
brettw | a59908d2 | 2016-01-21 19:16:48 | [diff] [blame] | 274 | } |
| 275 | |
brettw | 3871f52 | 2016-07-14 22:08:34 | [diff] [blame] | 276 | static_library("test_support") { |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 277 | testonly = true |
| 278 | sources = [ |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 279 | "ipc_security_test_util.cc", |
| 280 | "ipc_security_test_util.h", |
| 281 | "ipc_test_base.cc", |
| 282 | "ipc_test_base.h", |
| 283 | "ipc_test_channel_listener.cc", |
| 284 | "ipc_test_channel_listener.h", |
| 285 | "ipc_test_sink.cc", |
| 286 | "ipc_test_sink.h", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 287 | ] |
| 288 | public_deps = [ |
| 289 | ":ipc", |
| 290 | ] |
| 291 | deps = [ |
| 292 | "//base", |
| 293 | "//base/test:test_support", |
sammc | 4bcc4ed6 | 2016-10-27 10:13:59 | [diff] [blame] | 294 | "//mojo/edk/test:test_support", |
sdefresne | 6fd373e | 2016-05-24 21:24:06 | [diff] [blame] | 295 | "//testing/gtest", |
| 296 | ] |
kerrnel | dc059fe | 2016-04-12 16:39:06 | [diff] [blame] | 297 | } |
pkotwicz | a553a3b | 2015-10-16 22:29:46 | [diff] [blame] | 298 | } |