Permission message rules: Each rule must have >= 1 required permissions
[chromium-blink-merge.git] / ash / BUILD.gn
blob50f56aee9b8a737c30bf59f62020a91c137a3f35
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("//testing/test.gni")
9 gypi_values = exec_script("//build/gypi_to_gn.py",
10                           [ rebase_path("ash.gyp") ],
11                           "scope",
12                           [ "ash.gyp" ])
14 component("ash") {
15   sources = gypi_values.ash_sources
17   configs += [ "//build/config:precompiled_headers" ]
18   defines = [ "ASH_IMPLEMENTATION" ]
20   public_deps = [
21     "//ash/resources",
22     "//ash/strings",
23   ]
24   deps = [
25     "//base",
26     "//base:i18n",
27     "//base/third_party/dynamic_annotations",
28     "//cc",
29     "//components/device_event_log",
30     "//components/user_manager",
31     "//components/wallpaper",
32     "//content/public/browser",
33     "//media",
34     "//net",
35     "//skia",
36     "//third_party/icu",
37     "//ui/accessibility",
38     "//ui/app_list",
39     "//ui/aura",
40     "//ui/base",
41     "//ui/base/ime",
42     "//ui/compositor",
43     "//ui/events",
44     "//ui/events:events_base",
45     "//ui/events:gesture_detection",
46     "//ui/events/devices",
47     "//ui/gfx",
48     "//ui/gfx/geometry",
49     "//ui/keyboard",
50     "//ui/message_center",
51     "//ui/resources",
52     "//ui/strings",
53     "//ui/views",
54     "//ui/views/controls/webview",
55     "//ui/web_dialogs",
56     "//ui/wm",
57     "//url",
58   ]
60   if (is_win) {
61     sources -= [
62       "sticky_keys/sticky_keys_controller.cc",
63       "sticky_keys/sticky_keys_controller.h",
64     ]
66     # TODO(jschuh): crbug.com/167187 fix size_t to int truncations.
67     configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
68   }
70   if (use_x11) {
71     configs += [
72       "//build/config/linux:x11",
73       "//build/config/linux:xfixes",
74     ]
75     deps += [
76       "//ui/events/platform",
77       "//ui/gfx/x",
78     ]
79   } else {
80     sources -= [
81       "host/ash_window_tree_host_x11.cc",
82       "host/ash_window_tree_host_x11.h",
83       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.cc",
84       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_x11.h",
85     ]
86   }
88   if (use_ozone) {
89     deps += [
90       "//ui/events/ozone:events_ozone",
91       "//ui/ozone",
92     ]
93   }
95   if (is_chromeos) {
96     deps += [
97       "//device/bluetooth",
98       "//ui/display",
99       "//ui/display/util",
100       "//chromeos",
101       "//chromeos:power_manager_proto",
102       "//third_party/qcms",
103       "//ui/chromeos/resources",
104       "//ui/chromeos/strings",
105       "//ui/chromeos:ui_chromeos",
106     ]
107   } else {
108     sources -= [
109       "accelerators/key_hold_detector.cc",
110       "accelerators/key_hold_detector.h",
111       "accelerators/magnifier_key_scroller.cc",
112       "accelerators/magnifier_key_scroller.h",
113       "accelerators/spoken_feedback_toggler.cc",
114       "accelerators/spoken_feedback_toggler.h",
115       "display/display_configurator_animation.cc",
116       "display/display_configurator_animation.h",
117       "display/resolution_notification_controller.cc",
118       "display/resolution_notification_controller.h",
119       "system/tray/media_security/media_capture_observer.h",
120       "system/tray/media_security/multi_profile_media_tray_item.cc",
121       "system/tray/media_security/multi_profile_media_tray_item.h",
122       "touch/touch_transformer_controller.cc",
123       "touch/touch_transformer_controller.h",
124       "touch/touchscreen_util.cc",
125       "touch/touchscreen_util.h",
126       "virtual_keyboard_controller.cc",
127       "virtual_keyboard_controller.h",
128     ]
129   }
131   if (!use_ozone) {
132     sources -= [
133       "host/ash_window_tree_host_ozone.cc",
134       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.cc",
135       "wm/maximize_mode/scoped_disable_internal_mouse_and_keyboard_ozone.h",
136     ]
137   }
140 component("ash_with_content") {
141   sources = [
142     "content_support/ash_with_content_export.h",
143     "content_support/gpu_support_impl.cc",
144     "content_support/gpu_support_impl.h",
145     "keyboard_overlay/keyboard_overlay_delegate.cc",
146     "keyboard_overlay/keyboard_overlay_delegate.h",
147     "keyboard_overlay/keyboard_overlay_view.cc",
148     "keyboard_overlay/keyboard_overlay_view.h",
149   ]
151   defines = [ "ASH_WITH_CONTENT_IMPLEMENTATION" ]
153   public_deps = [
154     ":ash",
155   ]
156   deps = [
157     "//base",
158     "//base/third_party/dynamic_annotations",
159     "//content/public/browser",
160     "//ipc",
161     "//skia",
162     "//ui/aura",
163     "//ui/base",
164     "//ui/compositor",
165     "//ui/events",
166     "//ui/gfx",
167     "//ui/gfx/geometry",
168     "//ui/resources",
169     "//ui/strings",
170     "//ui/views",
171     "//ui/views/controls/webview",
172     "//ui/web_dialogs",
173     "//url",
174   ]
177 source_set("test_support") {
178   testonly = true
179   sources = gypi_values.ash_test_support_sources
180   configs += [ "//build/config:precompiled_headers" ]
182   public_deps = [
183     ":ash",
184   ]
185   deps = [
186     "//ash/resources",
187     "//content/test:test_support",
188     "//skia",
189     "//testing/gtest",
190     "//ui/accessibility",
191     "//ui/app_list",
192     "//ui/app_list:test_support",
193     "//ui/events:events_base",
194     "//ui/events/devices",
195     "//ui/gl",
196     "//ui/views",
197     "//ui/views:test_support",
198   ]
200   if (is_win) {
201     sources += [
202       "test/test_metro_viewer_process_host.cc",
203       "test/test_metro_viewer_process_host.h",
204     ]
205     deps += [
206       "//ipc",
207       "//ui/metro_viewer",
208       "//ui/platform_window/win",
209       "//win8:metro_viewer",
210       "//win8:test_support_win8",
211       "//win8:test_registrar",
212     ]
213   }
216 source_set("interactive_ui_test_support") {
217   testonly = true
218   configs += [ "//build/config:precompiled_headers" ]
219   public_deps = [
220     ":ash",
221     ":test_support",
222   ]
223   sources = [
224     "test/ash_interactive_ui_test_base.cc",
225     "test/ash_interactive_ui_test_base.h",
226   ]
227   deps = [
228     ":ash",
229     ":test_support",
230     "//skia",
231     "//testing/gtest",
232   ]
235 static_library("ash_shell_lib") {
236   testonly = true
237   sources = gypi_values.ash_shell_lib_sources
239   deps = [
240     ":ash",
241     ":ash_with_content",
242     ":test_support",
243     "//ash/resources",
244     "//ash/strings",
245     "//base",
246     "//base:i18n",
248     #"//chrome:packed_resources",  TODO(GYP)
249     "//content",
250     "//content/shell:content_shell_lib",
251     "//net",
252     "//skia",
253     "//third_party/icu",
254     "//ui/app_list",
255     "//ui/aura",
256     "//ui/base",
257     "//ui/base/ime",
258     "//ui/compositor",
259     "//ui/events",
260     "//ui/events:events_base",
261     "//ui/gfx",
262     "//ui/gfx/geometry",
263     "//ui/keyboard",
264     "//ui/message_center",
265     "//ui/resources",
266     "//ui/views",
267     "//ui/views:test_support",
268     "//ui/views/examples:views_examples_lib",
269     "//ui/views/examples:views_examples_with_content_lib",
270   ]
273 test("ash_unittests") {
274   sources = gypi_values.ash_unittests_sources
275   configs += [ "//build/config:precompiled_headers" ]
277   deps = [
278     ":ash",
279     ":ash_with_content",
280     ":test_support",
281     "//ash/resources",
282     "//ash/strings",
283     "//base",
284     "//base/allocator",
285     "//base/test:test_support",
286     "//components/user_manager",
287     "//content/public/browser",
288     "//content/test:test_support",
289     "//skia",
290     "//testing/gtest",
291     "//third_party/icu",
292     "//ui/accessibility",
293     "//ui/aura",
294     "//ui/aura:test_support",
295     "//ui/base",
296     "//ui/base/ime",
297     "//ui/base:test_support",
298     "//ui/compositor",
299     "//ui/compositor:test_support",
300     "//ui/events",
301     "//ui/events/devices",
302     "//ui/events:test_support",
303     "//ui/events:gesture_detection",
304     "//ui/gfx",
305     "//ui/gfx/geometry",
306     "//ui/keyboard",
307     "//ui/message_center",
308     "//ui/message_center:test_support",
309     "//ui/resources",
310     "//ui/views",
311     "//ui/views:test_support",
312     "//ui/views/controls/webview:test_support",
313     "//ui/web_dialogs:test_support",
314     "//ui/wm",
315     "//url",
316   ]
318   if (!is_chromeos) {
319     sources -= [
320       # TODO(zork): fix this test to build on Windows. See: crosbug.com/26906
321       "focus_cycler_unittest.cc",
323       # All tests for multiple displays: not supported on Windows Ash.
324       "wm/drag_window_resizer_unittest.cc",
326       # Accelerometer is only available on Chrome OS.
327       "wm/maximize_mode/maximize_mode_controller_unittest.cc",
329       # Can't resize on Windows Ash. http://crbug.com/165962
330       "autoclick/autoclick_unittest.cc",
331       "magnifier/magnification_controller_unittest.cc",
332       "sticky_keys/sticky_keys_overlay_unittest.cc",
333       "system/tray/media_security/multi_profile_media_tray_item_unittest.cc",
334       "virtual_keyboard_controller_unittest.cc",
335       "wm/workspace/workspace_window_resizer_unittest.cc",
336     ]
337     sources += [
338       #'<(SHARED_INTERMEDIATE_DIR)/ui/resources/ui_unscaled_resources.rc',  TODO(GYP)
339     ]
340   }
342   configs += [ "//build/config/compiler:no_size_t_to_int_warning" ]
344   if (!use_x11) {
345     sources -= [ "host/ash_window_tree_host_x11_unittest.cc" ]
346   }
347   if (is_chromeos) {
348     sources += [ "first_run/first_run_helper_unittest.cc" ]
349     deps += [
350       "//device/bluetooth",
351       "//ui/display",
352       "//ui/display:test_util",
353       "//ui/display/types",
354       "//chromeos:power_manager_proto",
355       "//chromeos:test_support_without_gmock",
356     ]
357   } else {
358     sources -= [
359       "accelerators/magnifier_key_scroller_unittest.cc",
360       "accelerators/spoken_feedback_toggler_unittest.cc",
361       "display/resolution_notification_controller_unittest.cc",
362       "touch/touchscreen_util_unittest.cc",
363     ]
364   }
366   if (!use_x11 || !is_chromeos) {
367     sources -= [ "touch/touch_transformer_controller_unittest.cc" ]
368   }
370   # TODO(GYP) is this necessary?
371   #['OS=="linux" and component=="shared_library" and use_allocator!="none"', {
372   # ldflags = "-rdynamic"
374   if (!is_chromeos) {
375     sources -= [ "sticky_keys/sticky_keys_unittest.cc" ]
376   }
379 executable("ash_shell") {
380   testonly = true
381   sources = [
382     "shell/shell_main.cc",
383   ]
385   deps = [
386     ":ash_shell_lib",
387     "//build/config/sanitizers:deps",
388     "//components/user_manager",
389   ]
391   if (is_win) {
392     configs -= [ "//build/config/win:console" ]
393     configs += [ "//build/config/win:windowed" ]
394     deps += [ "//sandbox" ]
395   }
397   if (is_chromeos) {
398     deps += [ "//device/bluetooth" ]
399   }
401 # When adding support for isolates, please have a look at run-time dependencies
402 # in the ash_unittests_run target in ash.gyp.