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. 4 5gypi_values = exec_script( 6 "//build/gypi_to_gn.py", 7 [ rebase_path("devtools.gypi") ], 8 "scope", 9 [ "devtools.gypi" ]) 10 11# Some of the files in the .gypi use GYP variable expansions, go through and 12# fix them. 13devtools_core_base_files = gypi_values.devtools_core_base_files - [ 14 "<@(devtools_standalone_files)", 15] + gypi_values.devtools_standalone_files 16 17devtools_core_files = 18 devtools_core_base_files + 19 gypi_values.devtools_bindings_js_files + 20 gypi_values.devtools_common_js_files + 21 gypi_values.devtools_components_js_files + 22 gypi_values.devtools_host_js_files + 23 gypi_values.devtools_main_js_files + 24 gypi_values.devtools_sdk_js_files + 25 gypi_values.devtools_screencast_js_files + 26 gypi_values.devtools_toolbox_js_files + 27 gypi_values.devtools_toolbox_bootstrap_js_files + 28 gypi_values.devtools_ui_js_files + 29 gypi_values.devtools_workspace_js_files 30 31devtools_extensions_js_files = gypi_values.devtools_extensions_js_files - 32 [ "<@(devtools_extension_api_files)" ] + 33 gypi_values.devtools_extension_api_files 34 35#------------------------------------------------------------------------------- 36 37visibility = [ "//third_party/WebKit/*" ] 38 39# Probably need to parameterize this. If we set it to true, there will be some 40# further work in the scripts below. 41debug_devtools = false 42 43group("devtools_frontend_resources") { 44 deps = [ 45 ":copy_inspector_images", 46 ":devtools_html", 47 ":toolbox_html", 48 ":frontend_protocol_sources", 49 ":supported_css_properties", 50 ":build_applications", 51 ] 52 53 if (!debug_devtools) { 54 deps += [ 55 ":copy_standalone_css", 56 ":concatenated_devtools_css", 57 ":concatenated_toolbox_css", 58 ] 59 } 60} 61 62copy("copy_inspector_images") { 63 sources = gypi_values.devtools_image_files 64 outputs = [ "$root_out_dir/resources/inspector/Images/{{source_file_part}}" ] 65} 66 67# TODO(GYP) need debug_devtools support (this runs somewhat differently). 68action("generate_devtools_grd") { 69 script = "scripts/generate_devtools_grd.py" 70 71 input_pages = [ 72 "$root_out_dir/resources/inspector/devtools.css", 73 "$root_out_dir/resources/inspector/devtools.html", 74 "$root_out_dir/resources/inspector/devtools.js", 75 "$root_out_dir/resources/inspector/toolbox.css", 76 "$root_out_dir/resources/inspector/toolbox.html", 77 "$root_out_dir/resources/inspector/toolbox.js", 78 "$root_out_dir/resources/inspector/audits_module.js", 79 "$root_out_dir/resources/inspector/console_module.js", 80 "$root_out_dir/resources/inspector/devices_module.js", 81 "$root_out_dir/resources/inspector/documentation_module.js", 82 "$root_out_dir/resources/inspector/elements_module.js", 83 "$root_out_dir/resources/inspector/extensions_module.js", 84 "$root_out_dir/resources/inspector/heap_snapshot_worker_module.js", 85 "$root_out_dir/resources/inspector/layers_module.js", 86 "$root_out_dir/resources/inspector/network_module.js", 87 "$root_out_dir/resources/inspector/profiler_module.js", 88 "$root_out_dir/resources/inspector/promises_module.js", 89 "$root_out_dir/resources/inspector/resources_module.js", 90 "$root_out_dir/resources/inspector/script_formatter_worker_module.js", 91 "$root_out_dir/resources/inspector/settings_module.js", 92 "$root_out_dir/resources/inspector/source_frame_module.js", 93 "$root_out_dir/resources/inspector/sources_module.js", 94 "$root_out_dir/resources/inspector/temp_storage_shared_worker_module.js", 95 "$root_out_dir/resources/inspector/timeline_module.js", 96 "$root_out_dir/resources/inspector/devtools_extension_api.js", 97 ] + gypi_values.devtools_standalone_files + gypi_values.devtools_cm_css_files 98 99 images = gypi_values.devtools_image_files 100 images_path = "front_end/Images" 101 102 inputs = input_pages + images 103 104 outfile = "$root_gen_dir/devtools/devtools_resources.grd" 105 outputs = [ outfile ] 106 107 relative_path_dirs = [ 108 "$root_out_dir/resources/inspector", 109 "front_end", 110 ] 111 112 args = rebase_path(input_pages, root_build_dir) + [ 113 "--relative_path_dirs" ] + 114 rebase_path(relative_path_dirs, root_build_dir) + [ 115 "--images", rebase_path(images_path, root_build_dir), 116 "--output", rebase_path(outfile, root_build_dir), 117 ] 118 119 deps = [ 120 ":devtools_html", 121 ":toolbox_html", 122 ":devtools_extension_api", 123 ":devtools_frontend_resources", 124 ] 125} 126 127template("generate_app_html") { 128 assert(defined(invoker.app_name), target_name) 129 130 action(target_name) { 131 script = "scripts/generate_devtools_html.py" 132 133 inputs = [ "front_end/" + invoker.app_name + ".html"] 134 outputs = [ 135 "$root_out_dir/resources/inspector/" + invoker.app_name + ".html" 136 ] 137 138 args = rebase_path(inputs, root_build_dir) + 139 rebase_path(outputs, root_build_dir) 140 141 if (debug_devtools) { 142 args += [ "1" ] 143 } else { 144 args += [ "0" ] 145 } 146 } 147} 148 149generate_app_html("devtools_html") { 150 app_name = "devtools" 151} 152 153generate_app_html("toolbox_html") { 154 app_name = "toolbox" 155} 156 157action("devtools_extension_api") { 158 script = "scripts/generate_devtools_extension_api.py" 159 160 inputs = gypi_values.devtools_extension_api_files 161 outputs = [ "$root_out_dir/resources/inspector/devtools_extension_api.js" ] 162 163 args = rebase_path(outputs, root_build_dir) + 164 rebase_path(gypi_values.devtools_extension_api_files, root_build_dir) 165} 166 167action("supported_css_properties") { 168 script = "scripts/generate_supported_css.py" 169 170 inputs = [ 171 "../core/css/CSSProperties.in", 172 ] 173 174 outputs = [ 175 "$root_out_dir/resources/inspector/SupportedCSSProperties.js" 176 ] 177 178 args = rebase_path(inputs, root_build_dir) + 179 rebase_path(outputs, root_build_dir) 180} 181 182action("frontend_protocol_sources") { 183 script = "scripts/CodeGeneratorFrontend.py" 184 185 inputs = [ "protocol.json" ] 186 outputs = [ "$root_out_dir/resources/inspector/InspectorBackendCommands.js" ] 187 188 args = rebase_path(inputs, root_build_dir) + [ 189 "--output_js_dir", 190 rebase_path("$root_out_dir/resources/inspector", root_build_dir), 191 ] 192} 193 194action("build_applications") { 195 script = "scripts/build_applications.py" 196 helper_scripts = [ 197 "scripts/modular_build.py", 198 "scripts/concatenate_application_code.py", 199 ] 200 201 app_descriptor_names = [ 202 "front_end/devtools.json", 203 "front_end/toolbox.json", 204 ] 205 206 app_loader_names = [ 207 "front_end/devtools.js", 208 "front_end/toolbox.js", 209 ] 210 211 generated_inputs = [ 212 "$root_out_dir/resources/inspector/Runtime.js", 213 "$root_out_dir/resources/inspector/InspectorBackendCommands.js", 214 "$root_out_dir/resources/inspector/SupportedCSSProperties.js", 215 ] 216 217 inputs = 218 helper_scripts + app_descriptor_names + app_loader_names + 219 devtools_core_files + gypi_values.devtools_module_json_files + 220 generated_inputs 221 222 output_path = "$root_out_dir/resources/inspector/" 223 outputs = [ 224 output_path + "devtools.js", 225 output_path + "toolbox.js", 226 output_path + "heap_snapshot_worker_module.js", 227 output_path + "temp_storage_shared_worker_module.js", 228 output_path + "script_formatter_worker_module.js", 229 ] 230 231 if (debug_devtools) { 232 debug_flag = "1" 233 } else { 234 debug_flag = "0" 235 } 236 237 app_names = [ 238 "devtools", 239 "toolbox" 240 ] 241 242 args = app_names + [ 243 "--input_path", rebase_path("front_end", root_build_dir), 244 "--output_path", rebase_path(output_path, root_build_dir), 245 "--debug", debug_flag 246 ] 247 248 deps = [ 249 ":build_audits_module", 250 ":build_console_module", 251 ":build_devices_module", 252 ":build_documentation_module", 253 ":build_elements_module", 254 ":build_extensions_module", 255 ":build_layers_module", 256 ":build_network_module", 257 ":build_profiler_module", 258 ":build_promises_module", 259 ":build_resources_module", 260 ":build_settings_module", 261 ":build_source_frame_module", 262 ":build_sources_module", 263 ":build_timeline_module", 264 ] 265 266 if (!debug_devtools) { 267 deps += [ 268 ":devtools_html", 269 ":toolbox_html", 270 ":supported_css_properties", 271 ":frontend_protocol_sources", 272 ":concatenated_module_descriptors", 273 ] 274 } 275} 276 277# Runs the concatenate_module_scripts script. 278# module_name: (String) The JS module name to process. 279# imported_files: (List of strings) The list of files the input depends on. 280template("concatenate_module_scripts") { 281 assert(defined(invoker.module_name), target_name) 282 assert(defined(invoker.imported_files), target_name) 283 284 action(target_name) { 285 script = "scripts/concatenate_module_scripts.py" 286 module_name = invoker.module_name 287 288 input = "front_end/" + module_name + "/module.json" 289 inputs = [ input ] + invoker.imported_files 290 291 output = "$root_out_dir/resources/inspector/" + module_name + "_module.js" 292 outputs = [ output ] 293 294 args = [ 295 rebase_path(input, root_build_dir), 296 rebase_path(output, root_build_dir), 297 ] 298 } 299} 300 301concatenate_module_scripts("build_audits_module") { 302 module_name = "audits" 303 imported_files = gypi_values.devtools_audits_js_files 304} 305 306concatenate_module_scripts("build_console_module") { 307 module_name = "console" 308 imported_files = gypi_values.devtools_console_js_files 309} 310 311concatenate_module_scripts("build_devices_module") { 312 module_name = "devices" 313 imported_files = gypi_values.devtools_devices_js_files 314} 315 316concatenate_module_scripts("build_documentation_module") { 317 module_name = "documentation" 318 imported_files = gypi_values.devtools_documentation_js_files 319} 320 321concatenate_module_scripts("build_elements_module") { 322 module_name = "elements" 323 imported_files = gypi_values.devtools_elements_js_files 324} 325 326concatenate_module_scripts("build_extensions_module") { 327 module_name = "extensions" 328 imported_files = devtools_extensions_js_files 329} 330 331concatenate_module_scripts("build_layers_module") { 332 module_name = "layers" 333 imported_files = gypi_values.devtools_layers_js_files 334} 335 336concatenate_module_scripts("build_network_module") { 337 module_name = "network" 338 imported_files = gypi_values.devtools_network_js_files 339} 340 341concatenate_module_scripts("build_profiler_module") { 342 module_name = "profiler" 343 imported_files = gypi_values.devtools_profiler_js_files 344} 345 346concatenate_module_scripts("build_promises_module") { 347 module_name = "promises" 348 imported_files = gypi_values.devtools_promises_js_files 349} 350 351concatenate_module_scripts("build_resources_module") { 352 module_name = "resources" 353 imported_files = gypi_values.devtools_resources_js_files 354} 355 356concatenate_module_scripts("build_settings_module") { 357 module_name = "settings" 358 imported_files = gypi_values.devtools_settings_js_files 359} 360 361group("build_source_frame_module") { 362 concatenate_module_scripts("concatenate_source_frame_module") { 363 module_name = "source_frame" 364 imported_files = gypi_values.devtools_source_frame_js_files + 365 gypi_values.devtools_cm_js_files 366 } 367 368 copy("copy_codemirror_files") { 369 sources = gypi_values.devtools_cm_css_files 370 outputs = [ "$root_out_dir/resources/inspector/cm/{{source_file_part}}" ] 371 } 372 373 deps = [ 374 ":concatenate_source_frame_module", 375 ":copy_codemirror_files", 376 ] 377} 378 379concatenate_module_scripts("build_sources_module") { 380 module_name = "sources" 381 imported_files = gypi_values.devtools_sources_js_files 382} 383 384concatenate_module_scripts("build_timeline_module") { 385 module_name = "timeline" 386 imported_files = gypi_values.devtools_timeline_js_files 387} 388 389action("concatenated_module_descriptors") { 390 script = "scripts/concatenate_module_descriptors.py" 391 392 input = "front_end/Runtime.js" 393 inputs = [ input ] + gypi_values.devtools_module_json_files 394 outputs = [ "$root_out_dir/resources/inspector/Runtime.js" ] 395 396 args = rebase_path([ input ] + outputs + 397 gypi_values.devtools_module_json_files, root_build_dir) 398} 399 400template("concatenate_css") { 401 assert(defined(invoker.app_name), target_name) 402 403 action(target_name) { 404 script = "scripts/concatenate_css_files.py" 405 406 input_stylesheet = "front_end/" + invoker.app_name + ".css" 407 inputs = [ input_stylesheet ] + devtools_core_base_files 408 409 outputs = [ 410 "$root_out_dir/resources/inspector/" + invoker.app_name + ".css" 411 ] 412 413 args = [ rebase_path(input_stylesheet, root_build_dir) ] + 414 rebase_path(outputs, root_build_dir) 415 } 416} 417 418copy("copy_standalone_css") { 419 sources = gypi_values.devtools_standalone_files 420 outputs = [ "$root_out_dir/resources/inspector/{{source_file_part}}" ] 421} 422 423concatenate_css("concatenated_devtools_css") { 424 app_name = "devtools" 425} 426 427concatenate_css("concatenated_toolbox_css") { 428 app_name = "toolbox" 429} 430