Index: Source/devtools/BUILD.gn |
diff --git a/Source/devtools/BUILD.gn b/Source/devtools/BUILD.gn |
index 4982e12a03a93301cd2f33aaf46004c4a1235839..1294cea2b89312fe87fd7de25fc5a91a29adbfff 100644 |
--- a/Source/devtools/BUILD.gn |
+++ b/Source/devtools/BUILD.gn |
@@ -2,6 +2,8 @@ |
# Use of this source code is governed by a BSD-style license that can be |
# found in the LICENSE file. |
+import("//build/config/features.gni") |
+ |
gypi_values = exec_script( |
"//build/gypi_to_gn.py", |
[ rebase_path("devtools.gypi") ], |
@@ -21,8 +23,8 @@ devtools_core_files = |
gypi_values.devtools_components_js_files + |
gypi_values.devtools_host_js_files + |
gypi_values.devtools_main_js_files + |
- gypi_values.devtools_sdk_js_files + |
gypi_values.devtools_screencast_js_files + |
+ gypi_values.devtools_sdk_js_files + |
gypi_values.devtools_toolbox_js_files + |
gypi_values.devtools_toolbox_bootstrap_js_files + |
gypi_values.devtools_ui_js_files + |
@@ -60,27 +62,35 @@ all_devtools_files = |
devtools_modules_js_files + |
gypi_values.devtools_uglify_files |
+# FIXME: Fix the generate_devtools_grd.py script to accept trailing slashes. |
+resources_out_dir_no_slash = "$root_out_dir/resources/inspector" |
+resources_out_dir = resources_out_dir_no_slash + "/" |
+ |
+generated_scripts = [ |
+ resources_out_dir + "InspectorBackendCommands.js", |
+ resources_out_dir + "SupportedCSSProperties.js", |
+] |
+ |
#------------------------------------------------------------------------------- |
visibility = [ "//third_party/WebKit/*" ] |
-# Probably need to parameterize this. If we set it to true, there will be some |
-# further work in the scripts below. |
-debug_devtools = false |
- |
group("devtools_frontend_resources") { |
deps = [ |
- ":copy_inspector_images", |
":devtools_html", |
":toolbox_html", |
+ ":copy_inspector_images", |
+ ":copy_standalone_css", |
+ ":devtools_extension_api", |
":frontend_protocol_sources", |
":supported_css_properties", |
":build_applications", |
] |
if (!debug_devtools) { |
+ # This overwrites application-specific core CSS (devtools.css), |
+ # and thus should be guarded out in Debug builds. |
deps += [ |
- ":copy_standalone_css", |
":concatenated_devtools_css", |
":concatenated_toolbox_css", |
] |
@@ -89,40 +99,52 @@ group("devtools_frontend_resources") { |
copy("copy_inspector_images") { |
sources = gypi_values.devtools_image_files |
- outputs = [ "$root_out_dir/resources/inspector/Images/{{source_file_part}}" ] |
+ outputs = [ resources_out_dir + "Images/{{source_file_part}}" ] |
} |
-# TODO(GYP) need debug_devtools support (this runs somewhat differently). |
action("generate_devtools_grd") { |
script = "scripts/generate_devtools_grd.py" |
- input_pages = [ |
- "$root_out_dir/resources/inspector/devtools.css", |
- "$root_out_dir/resources/inspector/devtools.html", |
- "$root_out_dir/resources/inspector/devtools.js", |
- "$root_out_dir/resources/inspector/toolbox.css", |
- "$root_out_dir/resources/inspector/toolbox.html", |
- "$root_out_dir/resources/inspector/toolbox.js", |
- "$root_out_dir/resources/inspector/audits_module.js", |
- "$root_out_dir/resources/inspector/console_module.js", |
- "$root_out_dir/resources/inspector/devices_module.js", |
- "$root_out_dir/resources/inspector/documentation_module.js", |
- "$root_out_dir/resources/inspector/elements_module.js", |
- "$root_out_dir/resources/inspector/extensions_module.js", |
- "$root_out_dir/resources/inspector/heap_snapshot_worker_module.js", |
- "$root_out_dir/resources/inspector/layers_module.js", |
- "$root_out_dir/resources/inspector/network_module.js", |
- "$root_out_dir/resources/inspector/profiler_module.js", |
- "$root_out_dir/resources/inspector/promises_module.js", |
- "$root_out_dir/resources/inspector/resources_module.js", |
- "$root_out_dir/resources/inspector/script_formatter_worker_module.js", |
- "$root_out_dir/resources/inspector/settings_module.js", |
- "$root_out_dir/resources/inspector/source_frame_module.js", |
- "$root_out_dir/resources/inspector/sources_module.js", |
- "$root_out_dir/resources/inspector/temp_storage_shared_worker_module.js", |
- "$root_out_dir/resources/inspector/timeline_module.js", |
- "$root_out_dir/resources/inspector/devtools_extension_api.js", |
- ] + gypi_values.devtools_standalone_files + gypi_values.devtools_cm_css_files |
+ deps = [ ":devtools_frontend_resources" ] |
+ |
+ if (debug_devtools) { |
+ # Debug: all files are picked as-is. |
+ input_pages = all_devtools_files + generated_scripts + [ |
+ resources_out_dir + "devtools.html", |
+ resources_out_dir + "toolbox.html", |
+ ] |
+ } else { |
+ # Release: pick compiled files and lazy-loaded CSS. |
+ input_pages = [ |
+ resources_out_dir + "devtools.css", |
+ resources_out_dir + "devtools.html", |
+ resources_out_dir + "devtools.js", |
+ resources_out_dir + "toolbox.css", |
+ resources_out_dir + "toolbox.html", |
+ resources_out_dir + "toolbox.js", |
+ resources_out_dir + "audits_module.js", |
+ resources_out_dir + "console_module.js", |
+ resources_out_dir + "devices_module.js", |
+ resources_out_dir + "documentation_module.js", |
+ resources_out_dir + "elements_module.js", |
+ resources_out_dir + "extensions_module.js", |
+ resources_out_dir + "heap_snapshot_worker_module.js", |
+ resources_out_dir + "layers_module.js", |
+ resources_out_dir + "network_module.js", |
+ resources_out_dir + "profiler_module.js", |
+ resources_out_dir + "promises_module.js", |
+ resources_out_dir + "resources_module.js", |
+ resources_out_dir + "script_formatter_worker_module.js", |
+ resources_out_dir + "settings_module.js", |
+ resources_out_dir + "source_frame_module.js", |
+ resources_out_dir + "sources_module.js", |
+ resources_out_dir + "temp_storage_shared_worker_module.js", |
+ resources_out_dir + "timeline_module.js", |
+ resources_out_dir + "devtools_extension_api.js", |
+ ] |
+ input_pages += gypi_values.devtools_standalone_files + |
+ gypi_values.devtools_cm_css_files |
+ } |
images = gypi_values.devtools_image_files |
images_path = "front_end/Images" |
@@ -133,7 +155,7 @@ action("generate_devtools_grd") { |
outputs = [ outfile ] |
relative_path_dirs = [ |
- "$root_out_dir/resources/inspector", |
+ resources_out_dir_no_slash, |
"front_end", |
] |
@@ -143,25 +165,17 @@ action("generate_devtools_grd") { |
"--images", rebase_path(images_path, root_build_dir), |
"--output", rebase_path(outfile, root_build_dir), |
] |
- |
- deps = [ |
- ":devtools_html", |
- ":toolbox_html", |
- ":devtools_extension_api", |
- ":devtools_frontend_resources", |
- ] |
} |
template("generate_app_html") { |
assert(defined(invoker.app_name), target_name) |
+ app_name = invoker.app_name |
action(target_name) { |
script = "scripts/generate_devtools_html.py" |
- inputs = [ "front_end/" + invoker.app_name + ".html"] |
- outputs = [ |
- "$root_out_dir/resources/inspector/" + invoker.app_name + ".html" |
- ] |
+ inputs = [ "front_end/" + app_name + ".html"] |
+ outputs = [ resources_out_dir + app_name + ".html" ] |
args = rebase_path(inputs, root_build_dir) + |
rebase_path(outputs, root_build_dir) |
@@ -186,7 +200,7 @@ action("devtools_extension_api") { |
script = "scripts/generate_devtools_extension_api.py" |
inputs = gypi_values.devtools_extension_api_files |
- outputs = [ "$root_out_dir/resources/inspector/devtools_extension_api.js" ] |
+ outputs = [ resources_out_dir + "devtools_extension_api.js" ] |
args = rebase_path(outputs, root_build_dir) + |
rebase_path(gypi_values.devtools_extension_api_files, root_build_dir) |
@@ -195,13 +209,9 @@ action("devtools_extension_api") { |
action("supported_css_properties") { |
script = "scripts/generate_supported_css.py" |
- inputs = [ |
- "../core/css/CSSProperties.in", |
- ] |
+ inputs = [ "../core/css/CSSProperties.in" ] |
- outputs = [ |
- "$root_out_dir/resources/inspector/SupportedCSSProperties.js" |
- ] |
+ outputs = [ resources_out_dir + "SupportedCSSProperties.js" ] |
args = rebase_path(inputs, root_build_dir) + |
rebase_path(outputs, root_build_dir) |
@@ -211,115 +221,323 @@ action("frontend_protocol_sources") { |
script = "scripts/CodeGeneratorFrontend.py" |
inputs = [ "protocol.json" ] |
- outputs = [ "$root_out_dir/resources/inspector/InspectorBackendCommands.js" ] |
+ outputs = [ resources_out_dir + "InspectorBackendCommands.js" ] |
args = rebase_path(inputs, root_build_dir) + [ |
"--output_js_dir", |
- rebase_path("$root_out_dir/resources/inspector", root_build_dir), |
+ rebase_path(resources_out_dir, root_build_dir), |
] |
} |
-action("build_applications") { |
- script = "scripts/build_applications.py" |
- helper_scripts = [ |
- "scripts/modular_build.py", |
- "scripts/concatenate_application_code.py", |
- ] |
- |
- generated_inputs = [ |
- "$root_out_dir/resources/inspector/InspectorBackendCommands.js", |
- "$root_out_dir/resources/inspector/SupportedCSSProperties.js", |
- ] |
- |
- inputs = helper_scripts + all_devtools_files + generated_inputs |
- |
- output_path = "$root_out_dir/resources/inspector/" |
- outputs = [ |
- output_path + "devtools.js", |
- output_path + "toolbox.js", |
- output_path + "audits_module.js", |
- output_path + "console_module.js", |
- output_path + "devices_module.js", |
- output_path + "documentation_module.js", |
- output_path + "elements_module.js", |
- output_path + "extensions_module.js", |
- output_path + "heap_snapshot_worker_module.js", |
- output_path + "layers_module.js", |
- output_path + "network_module.js", |
- output_path + "profiler_module.js", |
- output_path + "promises_module.js", |
- output_path + "resources_module.js", |
- output_path + "script_formatter_worker_module.js", |
- output_path + "settings_module.js", |
- output_path + "source_frame_module.js", |
- output_path + "sources_module.js", |
- output_path + "temp_storage_shared_worker_module.js", |
- output_path + "timeline_module.js", |
- ] |
+group("build_applications") { |
+ deps = [] |
- if (debug_devtools) { |
- debug_flag = "1" |
+ if (!debug_devtools) { |
+ # Release: concatenate application code. This overwrites |
+ # application-specific scripts (devtools.js), and thus should be guarded. |
+ action("build_applications_release") { |
dgozman
2014/10/01 13:28:24
Shouldn't you add "build_applications_release" to
apavlov
2014/10/01 13:55:19
Done.
|
+ script = "scripts/build_applications.py" |
+ helper_scripts = [ |
+ "scripts/modular_build.py", |
+ "scripts/concatenate_application_code.py", |
+ ] |
+ |
+ inputs = helper_scripts + all_devtools_files + generated_scripts |
+ |
+ outputs = [ |
+ resources_out_dir + "devtools.js", |
+ resources_out_dir + "toolbox.js", |
+ resources_out_dir + "audits_module.js", |
+ resources_out_dir + "console_module.js", |
+ resources_out_dir + "devices_module.js", |
+ resources_out_dir + "documentation_module.js", |
+ resources_out_dir + "elements_module.js", |
+ resources_out_dir + "extensions_module.js", |
+ resources_out_dir + "heap_snapshot_worker_module.js", |
+ resources_out_dir + "layers_module.js", |
+ resources_out_dir + "network_module.js", |
+ resources_out_dir + "profiler_module.js", |
+ resources_out_dir + "promises_module.js", |
+ resources_out_dir + "resources_module.js", |
+ resources_out_dir + "script_formatter_worker_module.js", |
+ resources_out_dir + "settings_module.js", |
+ resources_out_dir + "source_frame_module.js", |
+ resources_out_dir + "sources_module.js", |
+ resources_out_dir + "temp_storage_shared_worker_module.js", |
+ resources_out_dir + "timeline_module.js", |
+ ] |
+ |
+ args = [ |
+ "devtools", "toolbox", |
+ "--input_path", rebase_path("front_end", root_build_dir), |
+ "--output_path", rebase_path(resources_out_dir, root_build_dir), |
+ "--debug", "0" |
+ ] |
+ |
+ deps += [ |
+ ":supported_css_properties", |
+ ":frontend_protocol_sources", |
+ ] |
+ } |
} else { |
- debug_flag = "0" |
+ deps += [ |
+ ":copy_debug_modules" |
+ ] |
} |
+} |
- app_names = [ |
- "devtools", |
- "toolbox" |
- ] |
+copy("copy_standalone_css") { |
+ sources = gypi_values.devtools_standalone_files |
+ outputs = [ resources_out_dir + "{{source_file_part}}" ] |
- args = app_names + [ |
- "--input_path", rebase_path("front_end", root_build_dir), |
- "--output_path", rebase_path(output_path, root_build_dir), |
- "--debug", debug_flag |
- ] |
+ copy("copy_codemirror_css") { |
+ sources = gypi_values.devtools_cm_css_files |
+ outputs = [ resources_out_dir + "cm/{{source_file_part}}" ] |
+ } |
- deps = [] |
+ deps = [ ":copy_codemirror_css" ] |
+} |
- if (!debug_devtools) { |
- deps += [ |
- ":devtools_html", |
- ":toolbox_html", |
- ":supported_css_properties", |
- ":frontend_protocol_sources", |
+if (debug_devtools) { |
+ # Debug: copy front-end into resources_out_dir as-is. |
+ group("copy_debug_modules") { |
+ deps = [ |
+ ":copy_audits_module", |
+ ":copy_bindings_module", |
+ ":copy_common_module", |
+ ":copy_components_module", |
+ ":copy_console_module", |
+ ":copy_devices_module", |
+ ":copy_documentation_module", |
+ ":copy_elements_module", |
+ ":copy_extensions_module", |
+ ":copy_host_module", |
+ ":copy_layers_module", |
+ ":copy_main_module", |
+ ":copy_network_module", |
+ ":copy_profiler_module", |
+ ":copy_promises_module", |
+ ":copy_resources_module", |
+ ":copy_screencast_module", |
+ ":copy_sdk_module", |
+ ":copy_settings_module", |
+ ":copy_source_frame_module", |
+ ":copy_sources_module", |
+ ":copy_timeline_module", |
+ ":copy_toolbox_module", |
+ ":copy_toolbox_bootstrap_module", |
+ ":copy_ui_module", |
+ ":copy_workspace_module", |
] |
+ |
+ copy("copy_runtime_core") { |
+ sources = devtools_core_base_files - |
+ gypi_values.devtools_standalone_files |
+ outputs = [ resources_out_dir + "/{{source_file_part}}" ] |
+ } |
+ deps += [ ":copy_runtime_core" ] |
} |
-} |
-template("concatenate_css") { |
- assert(defined(invoker.app_name), target_name) |
+ # Copies module contents into resources_out_dir in debug_devtools=1 builds. |
+ # module_name: (String) The JS module name to process. |
+ # imported_files: (List of strings) The list of files the input depends on. |
+ template("copy_debug_module") { |
+ assert(defined(invoker.module_name), target_name) |
+ assert(defined(invoker.imported_files), target_name) |
- action(target_name) { |
- script = "scripts/concatenate_css_files.py" |
+ imported_files = invoker.imported_files |
+ module_name = invoker.module_name |
+ module_json = "front_end/" + module_name + "/module.json" |
+ |
+ copy(target_name) { |
+ sources = [ module_json ] + imported_files |
+ outputs = [ resources_out_dir + module_name + "/{{source_file_part}}" ] |
+ } |
+ } |
+ |
+ copy_debug_module("copy_audits_module") { |
+ module_name = "audits" |
+ imported_files = gypi_values.devtools_audits_js_files |
+ } |
- input_stylesheet = "front_end/" + invoker.app_name + ".css" |
- inputs = [ input_stylesheet ] + devtools_core_base_files |
+ copy_debug_module("copy_bindings_module") { |
+ module_name = "bindings" |
+ imported_files = gypi_values.devtools_bindings_js_files |
+ } |
- outputs = [ |
- "$root_out_dir/resources/inspector/" + invoker.app_name + ".css" |
+ copy_debug_module("copy_common_module") { |
+ module_name = "common" |
+ imported_files = gypi_values.devtools_common_js_files |
+ } |
+ |
+ copy_debug_module("copy_components_module") { |
+ module_name = "components" |
+ imported_files = gypi_values.devtools_components_js_files |
+ } |
+ |
+ copy_debug_module("copy_console_module") { |
+ module_name = "console" |
+ imported_files = gypi_values.devtools_console_js_files |
+ } |
+ |
+ copy_debug_module("copy_devices_module") { |
+ module_name = "devices" |
+ imported_files = gypi_values.devtools_devices_js_files |
+ } |
+ |
+ copy_debug_module("copy_documentation_module") { |
+ module_name = "documentation" |
+ imported_files = gypi_values.devtools_documentation_js_files |
+ } |
+ |
+ copy_debug_module("copy_elements_module") { |
+ module_name = "elements" |
+ imported_files = gypi_values.devtools_elements_js_files |
+ } |
+ |
+ copy_debug_module("copy_extensions_module") { |
+ module_name = "extensions" |
+ imported_files = devtools_extensions_js_files |
+ } |
+ |
+ copy_debug_module("copy_heap_snapshot_worker_module") { |
+ module_name = "heap_snapshot_worker" |
+ imported_files = gypi_values.devtools_heap_snapshot_worker_js_files |
+ } |
+ |
+ copy_debug_module("copy_host_module") { |
+ module_name = "host" |
+ imported_files = gypi_values.devtools_host_js_files |
+ } |
+ |
+ copy_debug_module("copy_layers_module") { |
+ module_name = "layers" |
+ imported_files = gypi_values.devtools_layers_js_files |
+ } |
+ |
+ copy_debug_module("copy_main_module") { |
+ module_name = "main" |
+ imported_files = gypi_values.devtools_main_js_files |
+ } |
+ |
+ copy_debug_module("copy_network_module") { |
+ module_name = "network" |
+ imported_files = gypi_values.devtools_network_js_files |
+ } |
+ |
+ copy_debug_module("copy_profiler_module") { |
+ module_name = "profiler" |
+ imported_files = gypi_values.devtools_profiler_js_files |
+ } |
+ |
+ copy_debug_module("copy_promises_module") { |
+ module_name = "promises" |
+ imported_files = gypi_values.devtools_promises_js_files |
+ } |
+ |
+ copy_debug_module("copy_resources_module") { |
+ module_name = "resources" |
+ imported_files = gypi_values.devtools_resources_js_files |
+ } |
+ |
+ copy_debug_module("copy_screencast_module") { |
+ module_name = "screencast" |
+ imported_files = gypi_values.devtools_screencast_js_files |
+ } |
+ |
+ group("copy_script_formatter_worker_module") { |
+ copy_debug_module("copy_script_formatter_worker_module_base") { |
+ module_name = "script_formatter_worker" |
+ imported_files = gypi_values.devtools_uglify_files + |
+ gypi_values.devtools_script_formatter_worker_js_files |
+ } |
+ |
+ copy("copy_uglify_js_files") { |
+ sources = gypi_values.devtools_uglify_files |
+ outputs = [ resources_out_dir + "UglifyJS/{{source_file_part}}" ] |
+ } |
+ |
+ deps = [ |
+ ":copy_script_formatter_worker_module_base", |
+ ":copy_uglify_js_files" |
] |
+ } |
- args = [ rebase_path(input_stylesheet, root_build_dir) ] + |
- rebase_path(outputs, root_build_dir) |
+ copy_debug_module("copy_sdk_module") { |
+ module_name = "sdk" |
+ imported_files = gypi_values.devtools_sdk_js_files |
} |
-} |
-concatenate_css("concatenated_devtools_css") { |
- app_name = "devtools" |
-} |
+ copy_debug_module("copy_settings_module") { |
+ module_name = "settings" |
+ imported_files = gypi_values.devtools_settings_js_files |
+ } |
-concatenate_css("concatenated_toolbox_css") { |
- app_name = "toolbox" |
-} |
+ copy_debug_module("copy_source_frame_module") { |
+ module_name = "source_frame" |
+ imported_files = gypi_values.devtools_source_frame_js_files |
+ } |
+ |
+ copy_debug_module("copy_sources_module") { |
+ module_name = "sources" |
+ imported_files = gypi_values.devtools_sources_js_files |
+ } |
+ |
+ copy_debug_module("copy_temp_storage_shared_worker_module") { |
+ module_name = "temp_storage_shared_worker" |
+ imported_files = gypi_values.devtools_temp_storage_shared_worker_js_files |
+ } |
+ |
+ copy_debug_module("copy_timeline_module") { |
+ module_name = "timeline" |
+ imported_files = gypi_values.devtools_timeline_js_files |
+ } |
+ |
+ copy_debug_module("copy_toolbox_module") { |
+ module_name = "toolbox" |
+ imported_files = gypi_values.devtools_toolbox_js_files |
+ } |
-copy("copy_codemirror_css") { |
- sources = gypi_values.devtools_cm_css_files |
- outputs = [ "$root_out_dir/resources/inspector/cm/{{source_file_part}}" ] |
+ copy_debug_module("copy_toolbox_bootstrap_module") { |
+ module_name = "toolbox_bootstrap" |
+ imported_files = gypi_values.devtools_toolbox_bootstrap_js_files |
+ } |
+ |
+ copy_debug_module("copy_ui_module") { |
+ module_name = "ui" |
+ imported_files = gypi_values.devtools_ui_js_files |
+ } |
+ |
+ copy_debug_module("copy_workspace_module") { |
+ module_name = "workspace" |
+ imported_files = gypi_values.devtools_workspace_js_files |
+ } |
} |
-copy("copy_standalone_css") { |
- sources = gypi_values.devtools_standalone_files |
- outputs = [ "$root_out_dir/resources/inspector/{{source_file_part}}" ] |
+if (!debug_devtools) { |
+ # Release: Concatenate application CSS. |
+ template("concatenate_css") { |
+ assert(defined(invoker.app_name), target_name) |
+ app_name = invoker.app_name |
+ |
+ action(target_name) { |
+ script = "scripts/concatenate_css_files.py" |
+ |
+ input_stylesheet = "front_end/" + app_name + ".css" |
+ inputs = [ input_stylesheet ] + devtools_core_base_files |
- deps = [ ":copy_codemirror_css" ] |
+ outputs = [ resources_out_dir + app_name + ".css" ] |
+ |
+ args = [ rebase_path(input_stylesheet, root_build_dir) ] + |
+ rebase_path(outputs, root_build_dir) |
+ } |
+ } |
+ |
+ concatenate_css("concatenated_devtools_css") { |
+ app_name = "devtools" |
+ } |
+ |
+ concatenate_css("concatenated_toolbox_css") { |
+ app_name = "toolbox" |
+ } |
} |