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")
7 gypi_values = exec_script(
8 "//build/gypi_to_gn.py",
9 [ rebase_path("devtools.gypi") ],
13 # Some of the files in the .gypi use GYP variable expansions, go through and
16 gypi_values.devtools_core_base_files +
17 gypi_values.devtools_bindings_js_files +
18 gypi_values.devtools_common_js_files +
19 gypi_values.devtools_components_js_files +
20 gypi_values.devtools_emulation_js_files +
21 gypi_values.devtools_host_js_files +
22 gypi_values.devtools_main_js_files +
23 gypi_values.devtools_platform_js_files +
24 gypi_values.devtools_sdk_js_files +
25 gypi_values.devtools_toolbox_bootstrap_js_files +
26 gypi_values.devtools_ui_js_files +
27 gypi_values.devtools_workspace_js_files +
28 gypi_values.devtools_core_css_files
30 devtools_extensions_js_files = gypi_values.devtools_extensions_js_files -
31 [ "<@(devtools_extension_api_files)" ] +
32 gypi_values.devtools_extension_api_files
34 devtools_modules_js_files =
35 gypi_values.devtools_accessibility_js_files +
36 gypi_values.devtools_audits_js_files +
37 gypi_values.devtools_animation_js_files +
38 gypi_values.devtools_cm_modes_js_files +
39 gypi_values.devtools_components_lazy_js_files +
40 gypi_values.devtools_console_js_files +
41 gypi_values.devtools_devices_js_files +
42 gypi_values.devtools_diff_js_files +
43 gypi_values.devtools_elements_js_files +
44 gypi_values.devtools_emulated_devices_js_files +
45 devtools_extensions_js_files +
46 gypi_values.devtools_heap_snapshot_worker_js_files +
47 gypi_values.devtools_layers_js_files +
48 gypi_values.devtools_network_js_files +
49 gypi_values.devtools_profiler_js_files +
50 gypi_values.devtools_promises_js_files +
51 gypi_values.devtools_resources_js_files +
52 gypi_values.devtools_security_js_files +
53 gypi_values.devtools_screencast_js_files +
54 gypi_values.devtools_script_formatter_worker_js_files +
55 gypi_values.devtools_settings_js_files +
56 gypi_values.devtools_snippets_js_files +
57 gypi_values.devtools_source_frame_js_files +
58 gypi_values.devtools_sources_js_files +
59 gypi_values.devtools_temp_storage_shared_worker_js_files +
60 gypi_values.devtools_timeline_js_files +
61 gypi_values.devtools_ui_lazy_js_files
64 gypi_values.devtools_cm_css_files +
65 gypi_values.devtools_cm_js_files +
67 gypi_values.devtools_module_json_files +
68 devtools_modules_js_files +
69 gypi_values.devtools_acorn_files
71 # FIXME: Fix the generate_devtools_grd.py script to accept trailing slashes.
72 resources_out_dir_no_slash = "$root_out_dir/resources/inspector"
73 resources_out_dir = resources_out_dir_no_slash + "/"
76 resources_out_dir + "InspectorBackendCommands.js",
77 resources_out_dir + "SupportedCSSProperties.js",
80 #-------------------------------------------------------------------------------
82 visibility = [ "//third_party/WebKit/*" ]
84 group("devtools_frontend_resources") {
86 ":copy_compatibility_scripts",
87 ":copy_inspector_images",
88 ":copy_emulated_devices_images",
89 ":devtools_extension_api",
90 ":frontend_protocol_sources",
91 ":supported_css_properties",
92 ":build_applications",
95 if (!debug_devtools) {
96 # This overwrites application-specific core CSS (devtools.css),
97 # and thus should be guarded out in Debug builds.
99 ":concatenated_inspector_css",
100 ":concatenated_toolbox_css",
105 copy("copy_compatibility_scripts") {
106 sources = gypi_values.devtools_compatibility_scripts
107 outputs = [ resources_out_dir + "{{source_file_part}}" ]
110 copy("copy_inspector_images") {
111 sources = gypi_values.devtools_image_files
112 outputs = [ resources_out_dir + "Images/{{source_file_part}}" ]
115 copy("copy_emulated_devices_images") {
116 sources = gypi_values.devtools_emulated_devices_images
117 outputs = [ resources_out_dir + "emulated_devices/{{source_file_part}}" ]
120 action("generate_devtools_grd") {
121 script = "scripts/generate_devtools_grd.py"
123 deps = [ ":devtools_frontend_resources" ]
124 static_files_list = "$target_gen_dir/devtools_static_grd_files.tmp"
125 inputs = gypi_values.devtools_image_files + all_devtools_files
126 inputs += gypi_values.devtools_compatibility_scripts
127 inputs += [ static_files_list ]
131 if (debug_devtools) {
132 # Debug: all files are picked as-is.
133 generated_files = generated_scripts + [
134 resources_out_dir + "inspector.html",
135 resources_out_dir + "toolbox.html",
137 static_files += all_devtools_files + [ "front_end/Runtime.js" ]
139 # Release: pick compiled non-remote files and lazy-loaded CSS.
141 resources_out_dir + "inspector.css",
142 resources_out_dir + "inspector.html",
143 resources_out_dir + "inspector.js",
144 resources_out_dir + "toolbox.css",
145 resources_out_dir + "toolbox.html",
146 resources_out_dir + "toolbox.js",
147 resources_out_dir + "accessibility_module.js",
148 resources_out_dir + "audits_module.js",
149 resources_out_dir + "animation_module.js",
150 resources_out_dir + "components_lazy_module.js",
151 resources_out_dir + "console_module.js",
152 resources_out_dir + "devices_module.js",
153 resources_out_dir + "diff_module.js",
154 resources_out_dir + "elements_module.js",
155 resources_out_dir + "heap_snapshot_worker_module.js",
156 resources_out_dir + "layers_module.js",
157 resources_out_dir + "network_module.js",
158 resources_out_dir + "profiler_module.js",
159 resources_out_dir + "promises_module.js",
160 resources_out_dir + "resources_module.js",
161 resources_out_dir + "security_module.js",
162 resources_out_dir + "script_formatter_worker_module.js",
163 resources_out_dir + "settings_module.js",
164 resources_out_dir + "snippets_module.js",
165 resources_out_dir + "source_frame_module.js",
166 resources_out_dir + "sources_module.js",
167 resources_out_dir + "temp_storage_shared_worker_module.js",
168 resources_out_dir + "timeline_module.js",
169 resources_out_dir + "ui_lazy_module.js",
170 resources_out_dir + "devtools_extension_api.js",
174 write_file(static_files_list, rebase_path(static_files, root_build_dir))
175 images_path = "front_end/Images"
177 inputs += generated_files
179 outfile = "$root_gen_dir/devtools/devtools_resources.grd"
180 outputs = [ outfile ]
182 relative_path_dirs = [
183 resources_out_dir_no_slash,
187 args = rebase_path(generated_files, root_build_dir) +
188 rebase_path(generated_files, root_build_dir) +
189 rebase_path(gypi_values.devtools_compatibility_scripts, root_build_dir) + [
190 "--static_files_list", rebase_path(static_files_list, root_build_dir),
191 "--relative_path_dirs" ] +
192 rebase_path(relative_path_dirs, root_build_dir) + [
193 "--images", rebase_path(images_path, root_build_dir),
194 "--output", rebase_path(outfile, root_build_dir),
198 action("devtools_extension_api") {
199 script = "scripts/generate_devtools_extension_api.py"
201 inputs = gypi_values.devtools_extension_api_files
202 outputs = [ resources_out_dir + "devtools_extension_api.js" ]
204 args = rebase_path(outputs, root_build_dir) +
205 rebase_path(gypi_values.devtools_extension_api_files, root_build_dir)
208 action("supported_css_properties") {
209 script = "scripts/generate_supported_css.py"
211 inputs = [ "../core/css/CSSProperties.in" ]
213 outputs = [ resources_out_dir + "SupportedCSSProperties.js" ]
215 args = rebase_path(inputs, root_build_dir) +
216 rebase_path(outputs, root_build_dir)
219 action("frontend_protocol_sources") {
220 script = "scripts/CodeGeneratorFrontend.py"
222 inputs = [ "protocol.json" ]
223 outputs = [ resources_out_dir + "InspectorBackendCommands.js" ]
225 args = rebase_path(inputs, root_build_dir) + [
227 rebase_path(resources_out_dir, root_build_dir),
231 action("build_applications") {
232 script = "scripts/build_applications.py"
234 "scripts/modular_build.py",
235 "scripts/concatenate_application_code.py",
238 inputs = helper_scripts + all_devtools_files + generated_scripts + [
239 "front_end/inspector.html",
240 "front_end/toolbox.html",
244 resources_out_dir + "inspector.html",
245 resources_out_dir + "toolbox.html",
249 ":supported_css_properties",
250 ":frontend_protocol_sources",
253 if (debug_devtools) {
254 deps += [ ":copy_debug_non_modules" ]
259 resources_out_dir + "inspector.js",
260 resources_out_dir + "toolbox.js",
261 resources_out_dir + "accessibility_module.js",
262 resources_out_dir + "audits_module.js",
263 resources_out_dir + "animation_module.js",
264 resources_out_dir + "cm_modes_module.js",
265 resources_out_dir + "components_lazy_module.js",
266 resources_out_dir + "console_module.js",
267 resources_out_dir + "devices_module.js",
268 resources_out_dir + "diff_module.js",
269 resources_out_dir + "elements_module.js",
270 resources_out_dir + "emulated_devices_module.js",
271 resources_out_dir + "heap_snapshot_worker_module.js",
272 resources_out_dir + "layers_module.js",
273 resources_out_dir + "network_module.js",
274 resources_out_dir + "profiler_module.js",
275 resources_out_dir + "promises_module.js",
276 resources_out_dir + "resources_module.js",
277 resources_out_dir + "security_module.js",
278 resources_out_dir + "screencast_module.js",
279 resources_out_dir + "script_formatter_worker_module.js",
280 resources_out_dir + "settings_module.js",
281 resources_out_dir + "snippets_module.js",
282 resources_out_dir + "source_frame_module.js",
283 resources_out_dir + "sources_module.js",
284 resources_out_dir + "temp_storage_shared_worker_module.js",
285 resources_out_dir + "timeline_module.js",
286 resources_out_dir + "ui_lazy_module.js",
293 "inspector", "toolbox",
294 "--input_path", rebase_path("front_end", root_build_dir),
295 "--output_path", rebase_path(resources_out_dir, root_build_dir),
296 "--debug", debug_mode
300 if (debug_devtools) {
301 # Debug: copy non-module directories and core into resources_out_dir as-is.
302 group("copy_debug_non_modules") {
304 ":copy_runtime_core",
305 ":copy_acorn_js_files",
306 ":copy_codemirror_files",
310 copy("copy_runtime_core") {
311 sources = gypi_values.devtools_core_base_files +
312 gypi_values.devtools_core_css_files
313 outputs = [ resources_out_dir + "/{{source_file_part}}" ]
316 copy("copy_acorn_js_files") {
317 sources = gypi_values.devtools_acorn_files
318 outputs = [ resources_out_dir + "acorn/{{source_file_part}}" ]
321 copy("copy_codemirror_files") {
322 sources = gypi_values.devtools_cm_js_files +
323 gypi_values.devtools_cm_css_files
324 outputs = [ resources_out_dir + "cm/{{source_file_part}}" ]
328 if (!debug_devtools) {
329 # Release: Concatenate application CSS.
330 template("concatenate_css") {
331 assert(defined(invoker.app_name), target_name)
332 app_name = invoker.app_name
334 action(target_name) {
335 script = "scripts/concatenate_css_files.py"
337 input_stylesheet = "front_end/" + app_name + ".css"
338 inputs = [ input_stylesheet ] + gypi_values.devtools_core_css_files
340 outputs = [ resources_out_dir + app_name + ".css" ]
342 args = [ rebase_path(input_stylesheet, root_build_dir) ] +
343 rebase_path(outputs, root_build_dir)
347 concatenate_css("concatenated_inspector_css") {
348 app_name = "inspector"
351 concatenate_css("concatenated_toolbox_css") {