Clarify and update GN build flags docs.
[chromium-blink-merge.git] / components / html_viewer / BUILD.gn
blob7d853596039c8adb3f7485e0acccab662a4b3622
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/module_args/v8.gni")
6 import("//mojo/mojo_application_package.gni")
7 import("//testing/test.gni")
8 import("//third_party/mojo/src/mojo/public/mojo.gni")
9 import("//third_party/mojo/src/mojo/public/mojo_application.gni")
10 import("//tools/grit/grit_rule.gni")
11 import("//tools/grit/repack.gni")
13 # Repack this here.
14 repack("unified_blink_resources") {
15   sources = [
16     "$root_gen_dir/blink/public/resources/blink_image_resources_100_percent.pak",
17     "$root_gen_dir/blink/public/resources/blink_resources.pak",
18   ]
19   output = "$target_gen_dir/unified_blink_resources.pak"
20   deps = [
21     "//third_party/WebKit/public:image_resources",
22     "//third_party/WebKit/public:resources",
23   ]
26 action("generate_blink_resource_map") {
27   script = "//components/html_viewer/generate_blink_resource_map.py"
28   args = [
29     "--pak-file",
30     rebase_path("$target_gen_dir/unified_blink_resources.pak"),
31     "--header",
32     rebase_path("$target_gen_dir/blink_resource_map.h"),
33     "--cpp",
34     rebase_path("$target_gen_dir/blink_resource_map.cc"),
35   ]
36   outputs = [
37     "$target_gen_dir/blink_resource_map.cc",
38     "$target_gen_dir/blink_resource_map.h",
39   ]
40   deps = [
41     ":unified_blink_resources",
42   ]
43   public_deps = [
44     "//third_party/WebKit/public:image_resources",
45     "//third_party/WebKit/public:resources",
46   ]
49 grit("html_viewer_resources_grit") {
50   source = "html_viewer_resources.grd"
51   outputs = [
52     "grit/html_viewer_resources.h",
53     "html_viewer_resources.pak",
54     "html_viewer_resources.rc",
55   ]
57 source_set("lib") {
58   sources = [
59     "$target_gen_dir/blink_resource_map.cc",
60     "$target_gen_dir/blink_resource_map.h",
61     "ax_provider_impl.cc",
62     "ax_provider_impl.h",
63     "blink_basic_type_converters.cc",
64     "blink_basic_type_converters.h",
65     "blink_input_events_type_converters.cc",
66     "blink_input_events_type_converters.h",
67     "blink_platform_impl.cc",
68     "blink_platform_impl.h",
69     "blink_resource_constants.h",
70     "blink_url_request_type_converters.cc",
71     "blink_url_request_type_converters.h",
72     "discardable_memory_allocator.cc",
73     "discardable_memory_allocator.h",
74     "html_document.cc",
75     "html_document.h",
76     "mock_web_blob_registry_impl.cc",
77     "mock_web_blob_registry_impl.h",
78     "setup.cc",
79     "setup.h",
80     "touch_handler.cc",
81     "touch_handler.h",
82     "web_clipboard_impl.cc",
83     "web_clipboard_impl.h",
84     "web_cookie_jar_impl.cc",
85     "web_cookie_jar_impl.h",
86     "web_layer_tree_view_impl.cc",
87     "web_layer_tree_view_impl.h",
88     "web_media_player_factory.cc",
89     "web_media_player_factory.h",
90     "web_media_player_factory.h",
91     "web_message_port_channel_impl.cc",
92     "web_message_port_channel_impl.h",
93     "web_mime_registry_impl.cc",
94     "web_mime_registry_impl.h",
95     "web_notification_manager_impl.cc",
96     "web_notification_manager_impl.h",
97     "web_socket_handle_impl.cc",
98     "web_socket_handle_impl.h",
99     "web_storage_namespace_impl.cc",
100     "web_storage_namespace_impl.h",
101     "web_theme_engine_impl.cc",
102     "web_theme_engine_impl.h",
103     "web_url_loader_impl.cc",
104     "web_url_loader_impl.h",
105   ]
107   include_dirs = [ "third_party/WebKit" ]
109   deps = [
110     "//base",
111     "//base/third_party/dynamic_annotations",
112     "//cc",
113     "//cc/blink",
114     "//cc/surfaces",
115     "//components/clipboard/public/interfaces",
116     "//components/gpu/public/interfaces",
117     "//components/mime_util",
118     "//components/resource_provider/public/cpp",
119     "//components/resource_provider/public/interfaces",
120     "//components/scheduler:scheduler",
121     "//components/surfaces/public/interfaces",
122     "//components/webcrypto",
123     "//gin",
124     "//mandoline/services/navigation/public/interfaces",
125     "//media",
126     "//media/blink",
127     "//media/mojo",
128     "//mojo/application/public/cpp",
129     "//mojo/cc",
130     "//mojo/converters/surfaces",
131     "//mojo/services/network/public/cpp",
132     "//mojo/services/network/public/interfaces",
133     "//net",
134     "//skia",
135     "//third_party/mojo/src/mojo/public/c/system:for_shared_library",
136     "//third_party/mojo_services/src/accessibility/public/interfaces",
137     "//ui/mojo/events:interfaces",
138     "//ui/events",
139     "//ui/events:gesture_detection",
140     "//ui/events/blink",
141     "//ui/events/gestures/blink",
142     "//ui/gfx",
143     "//ui/gfx/geometry",
144     "//ui/native_theme",
146     # TODO(sky): we shouldn't be using ui_test_pak.
147     "//ui/resources:ui_test_pak",
148     "//url",
149   ]
151   public_deps = [
152     "//components/view_manager/public/cpp",
153     "//third_party/WebKit/public:blink",
154     "//third_party/mojo/src/mojo/public/cpp/bindings",
155     ":generate_blink_resource_map",
156   ]
158   if (is_win) {
159     sources += [ "html_viewer_version.rc" ]
160   }
162   data_deps = [
163     "//components/clipboard",
164     "//components/surfaces",
165     "//components/view_manager",
166   ]
169 mojo_application_package("html_viewer") {
170   sources = [
171     "html_viewer.cc",
172     "ui_setup.h",
173     "ui_setup_android.cc",
174     "ui_setup_android.h",
175   ]
176   deps = [
177     ":html_viewer_resources_grit",
178     ":lib",
179     "//mojo/common",
180     "//mojo/platform_handle",
181     "//third_party/icu:icudata",
182     "//ui/resources:ui_test_pak",
183   ]
184   data_deps = [ "//mojo/services/network:network" ]
185   resources = [
186     "$root_out_dir/icudtl.dat",
187     "$root_out_dir/ui_test.pak",
188     "$target_gen_dir/html_viewer_resources.pak",
189   ]
191   if (v8_use_external_startup_data) {
192     resources += [
193       "$root_build_dir/natives_blob.bin",
194       "$root_build_dir/snapshot_blob.bin",
195     ]
196   }
199 test("tests") {
200   output_name = "html_viewer_unittests"
201   sources = [
202     "ax_provider_impl_unittest.cc",
203     "discardable_memory_allocator_unittest.cc",
204   ]
205   deps = [
206     ":lib",
207     "//base/test:run_all_unittests",
208   ]
211 mojo_native_application("apptests") {
212   output_name = "html_viewer_apptests"
213   testonly = true
215   sources = [
216     "ax_provider_apptest.cc",
217   ]
219   deps = [
220     "//base",
221     "//mojo/application/public/cpp:test_support",
222     "//net:test_support",
223     "//testing/gtest",
224     "//third_party/mojo_services/src/accessibility/public/interfaces",
225   ]
227   data_deps = [ ":html_viewer" ]