[Cronet] Delay StartNetLog and StopNetLog until native request context is initialized
[chromium-blink-merge.git] / remoting / host / BUILD.gn
blobb5dcf5c7dc7a190dd6adbe99b50a8fd7be012fc3
1 # Copyright 2014 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.
5 import("//build/config/features.gni")
6 import("//build/config/ui.gni")
7 import("//remoting/remoting_locales.gni")
8 import("//remoting/remoting_srcs.gni")
9 import("//remoting/remoting_version.gni")
10 import("//remoting/tools/build/remoting_localize.gni")
12 if (is_mac) {  # TODO(GYP) Mac build of remoting host.
13   group("host") {
14   }
15   group("test_support") {
16   }
17   group("unit_tests") {
18   }
19 } else {
20   # This must be a static library instead of a source set because
21   # remoting_unittests requires that remoting_me2me_host.cc not be pulled in,
22   # which in turn depends on remoting_me2me_host_static which isn't part of that
23   # build.
24   #
25   # TODO fix this, successful builds should not depend on static libraries
26   # stripping code.
27   static_library("host") {
28     sources = rebase_path(remoting_host_srcs_gypi_values.remoting_host_sources,
29                           ".",
30                           "//remoting")
32     libs = []
34     configs += [ "//build/config/compiler:wexit_time_destructors" ]
36     defines = [ "WEBRTC_CHROMIUM_BUILD" ]
38     deps = [
39       "//base:i18n",
40       "//components/policy:policy",
41       "//components/policy:policy_component_common",
42       "//crypto",
43       "//google_apis",
44       "//ipc",
45       "//remoting/base",
46       "//remoting/protocol",
47       "//remoting/resources",
48       "//ui/events/platform",
49       "//ui/events:dom4_keycode_converter",
50     ]
52     if (is_linux && !is_chromeos) {
53       libs += [ "pam" ]
54     }
56     if (use_x11) {
57       configs += [
58         "//build/config/linux:x11",
59         "//build/config/linux:xrandr",
60       ]
61       if (!is_chromeos) {
62         deps += [ "//build/config/linux/gtk" ]
63       }
64     } else {
65       sources -= [
66         "clipboard_x11.cc",
67         "input_injector_x11.cc",
68         "local_input_monitor_x11.cc",
69       ]
70       if (is_linux) {
71         # These will already be filtered out on non-Linux.
72         sources -= [
73           "linux/x_server_clipboard.cc",
74           "linux/x_server_clipboard.h",
75         ]
76       }
77     }
79     if (is_chromeos) {
80       deps += [
81         "//cc",
82         "//ppapi/host",
83         "//skia",
84         "//ui/aura",
85         "//ui/compositor",
86         "//ui/events",
87         "//ui/views",
88       ]
90       if (use_ash) {
91         deps += [ "//ash" ]
92       }
94       if (use_ozone) {
95         deps += [ "//ui/ozone" ]
96       } else {
97         sources -= [
98           "clipboard_x11.cc",
99           "input_injector_chromeos.cc",
100           "input_injector_chromeos.h",
101           "linux/x_server_clipboard.cc",
102           "linux/x_server_clipboard.h",
103           "local_input_monitor_x11.cc",
104         ]
105       }
107       sources -= [
108         "continue_window_linux.cc",
109         "disconnect_window_linux.cc",
110       ]
111     }
113     if (is_mac) {
114       # TODO(GYP) Mac host_bundle_name and prefpane_bundle_name.
115       # Note if you are looking at this: It really sucks to have to synchronously
116       # call into python twice to get these values. They should instead be
117       # written into a generated header via the process_version template, and we
118       # change the source files to include that header rather than rely on these
119       # defines being set in the build.
120       #defines += [
121       #  "HOST_BUNDLE_NAME=\"$host_bundle_name\"",
122       #  "PREFPANE_BUNDLE_NAME=\"$prefpane_bundle_name\"",
123       #]
125       libs += [
126         "Accelerate.framework",
127         "libpam.a",
128       ]
130       deps += [ "//third_party/google_toolbox_for_mac" ]
131     }
133     if (is_win) {
134       deps += [
135         ":messages",
136         ":remoting_lib_idl",
137       ]
138     }
140     if (enable_webrtc) {
141       deps += [
142         "//third_party/libjingle:libpeerconnection",
143         "//third_party/webrtc/modules/desktop_capture",
144       ]
146       sources +=
147           rebase_path(remoting_host_srcs_gypi_values.remoting_cast_sources,
148                       ".",
149                       "//remoting")
150     }
151   }
153   source_set("test_support") {
154     testonly = true
156     sources = [
157       "fake_desktop_capturer.cc",
158       "fake_desktop_capturer.h",
159       "fake_desktop_environment.cc",
160       "fake_desktop_environment.h",
161       "fake_host_extension.cc",
162       "fake_host_extension.h",
163       "fake_host_status_monitor.h",
164       "fake_host_status_monitor.h",
165       "fake_mouse_cursor_monitor.cc",
166       "fake_mouse_cursor_monitor.h",
167     ]
169     deps = [
170       "//remoting/proto",
171       "//testing/gtest",
172     ]
173     public_deps = [
174       ":host",
175     ]
177     if (enable_webrtc) {
178       public_deps += [
179         "//third_party/libjingle:libpeerconnection",
180         "//third_party/webrtc/modules/desktop_capture",
181       ]
182     }
183   }
185   # The host portions of the remoting unit tests.
186   source_set("unit_tests") {
187     testonly = true
189     sources = [
190       "audio_pump_unittest.cc",
191       "audio_silence_detector_unittest.cc",
192       "capture_scheduler_unittest.cc",
193       "chromeos/aura_desktop_capturer_unittest.cc",
194       "chromeos/clipboard_aura_unittest.cc",
195       "chromoting_host_context_unittest.cc",
196       "chromoting_host_unittest.cc",
197       "client_session_unittest.cc",
198       "config_file_watcher_unittest.cc",
199       "daemon_process_unittest.cc",
200       "desktop_process_unittest.cc",
201       "desktop_shape_tracker_unittest.cc",
202       "gnubby_auth_handler_posix_unittest.cc",
203       "heartbeat_sender_unittest.cc",
204       "host_change_notification_listener_unittest.cc",
205       "host_config_unittest.cc",
206       "host_extension_session_manager_unittest.cc",
207       "host_mock_objects.cc",
208       "host_status_logger_unittest.cc",
209       "ipc_desktop_environment_unittest.cc",
210       "it2me/it2me_confirmation_dialog_proxy_unittest.cc",
211       "it2me/it2me_native_messaging_host_unittest.cc",
212       "linux/audio_pipe_reader_unittest.cc",
213       "linux/unicode_to_keysym_unittest.cc",
214       "linux/x_server_clipboard_unittest.cc",
215       "local_input_monitor_unittest.cc",
216       "mouse_shape_pump_unittest.cc",
217       "native_messaging/native_messaging_reader_unittest.cc",
218       "native_messaging/native_messaging_writer_unittest.cc",
219       "pairing_registry_delegate_linux_unittest.cc",
220       "pairing_registry_delegate_win_unittest.cc",
221       "pin_hash_unittest.cc",
222       "policy_watcher_unittest.cc",
223       "register_support_host_request_unittest.cc",
224       "remote_input_filter_unittest.cc",
225       "resizing_host_observer_unittest.cc",
226       "screen_resolution_unittest.cc",
227       "server_log_entry_host_unittest.cc",
228       "setup/me2me_native_messaging_host_unittest.cc",
229       "setup/oauth_helper_unittest.cc",
230       "setup/pin_validator_unittest.cc",
231       "shaped_desktop_capturer_unittest.cc",
232       "token_validator_factory_impl_unittest.cc",
233       "video_frame_pump_unittest.cc",
234       "video_frame_recorder_unittest.cc",
235       "win/rdp_client_unittest.cc",
236       "win/worker_process_launcher.cc",
237       "win/worker_process_launcher.h",
238       "win/worker_process_launcher_unittest.cc",
239     ]
241     if (use_ozone || is_chromeos) {
242       sources -= [ "local_input_monitor_unittest.cc" ]
243     }
244     if (is_chromeos) {
245       sources -= [ "linux/x_server_clipboard_unittest.cc" ]
246     }
248     deps = [
249       ":host",
250       ":test_support",
251       "//components/policy:policy_component_test_support",
252       "//remoting/host/setup",
253       "//remoting/host/it2me:common",
254       "//remoting/host/native_messaging",
255       "//remoting/proto",
256       "//skia",
257       "//testing/gmock",
258       "//testing/gtest",
259     ]
260   }
262   if (is_win) {
263     import("//build/toolchain/win/midl.gni")
264     import("//remoting/tools/build/message_compiler.gni")
266     # TODO(brettw) these should not be generated via exec_script. This should be
267     # part of the build process rather than the metabuild. Instead, a script
268     # should generate a header containing the #defines for this as well as the
269     # IDL file with the values.
270     clsids = exec_script("win/get_clsids.py",
271                          [
272                            remoting_srcs_gypi_values.daemon_controller_guid,
273                            remoting_srcs_gypi_values.rdp_desktop_session_guid,
274                            version_full,
275                          ],
276                          "value")
277     daemon_controller_clsid = clsids[0]
278     rdp_desktop_session_clsid = clsids[1]
280     action("generate_idl") {
281       script = "//build/util/version.py"
283       inputs = [
284         "win/chromoting_lib_idl.templ",
285       ]
286       outputs = [
287         "$target_gen_dir/chromoting_lib.idl",
288       ]
290       args = [
291         "-e",
292         "DAEMON_CONTROLLER_CLSID='$daemon_controller_clsid'",
293         "-e",
294         "RDP_DESKTOP_SESSION_CLSID='$rdp_desktop_session_clsid'",
295         rebase_path(inputs[0], root_build_dir),
296         rebase_path(outputs[0], root_build_dir),
297       ]
298     }
300     midl("remoting_lib_idl") {
301       sources = get_target_outputs(":generate_idl")
302       deps = [
303         ":generate_idl",
304       ]
305     }
307     # Makes the .mc file from the .mc.jinja file.
308     remoting_localize("messages_localizing") {
309       sources = [
310         "win/host_messages.mc.jinja2",
311       ]
312       locales = remoting_locales
313       locale_dir = webapp_locale_dir
314       encoding = "utf-16"
316       # This target is funny. It only produces one file and the output doesn't
317       # match the input. We want to generate remoting_host_messages.mc from
318       # host_messages.mg.jinja2. GN complains if it doesn't see a pattern in the
319       # output, so the following pattern produces the name we want with a template
320       # based on the input.
321       #
322       # TODO: This is for GYP compat. We should just make the names match instead.
323       output = "$target_gen_dir/remoting_{{source_name_part}}"
324     }
326     # Makes the .h/.rc files from the .mc file.
327     message_compiler("messages") {
328       sources = get_target_outputs(":messages_localizing")
329       deps = [
330         ":messages_localizing",
331       ]
332     }
334     # TODO(GYP) More Windows remoting targets from remoting_host_win.gypi
335   }