blob: ee7ec082948d22c71e9abdd9e81e2ea5a60b235e [file] [log] [blame]
# Copyright 2014 The Chromium Authors. All rights reserved.
# Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file.
import("//build/config/python.gni")
import("./all_devtools_files.gni")
import("./all_devtools_modules.gni")
import("./devtools_grd_files.gni")
import("./devtools_image_files.gni")
import("./devtools_module_entrypoints.gni")
import("./front_end/emulated_devices/optimized/optimized_images.gni")
import("./scripts/build/ninja/vars.gni")
import("./third_party/blink/public/public_features.gni")
devtools_test_files = [
"front_end/third_party/axe-core/axe.js",
"front_end/accessibility_test_runner/accessibility_test_runner.js",
"front_end/accessibility_test_runner/module.json",
"front_end/bindings_test_runner/bindings_test_runner.js",
"front_end/application_test_runner/application_test_runner.js",
"front_end/application_test_runner/AppcacheTestRunner.js",
"front_end/application_test_runner/CacheStorageTestRunner.js",
"front_end/application_test_runner/IndexedDBTestRunner.js",
"front_end/application_test_runner/module.json",
"front_end/application_test_runner/ResourcesTestRunner.js",
"front_end/application_test_runner/ResourceTreeTestRunner.js",
"front_end/application_test_runner/ServiceWorkersTestRunner.js",
"front_end/application_test_runner/StorageTestRunner.js",
"front_end/lighthouse_test_runner/lighthouse_test_runner.js",
"front_end/lighthouse_test_runner/module.json",
"front_end/axe_core_test_runner/axe_core_test_runner.js",
"front_end/axe_core_test_runner/module.json",
"front_end/bindings_test_runner/AutomappingTestRunner.js",
"front_end/bindings_test_runner/BindingsTestRunner.js",
"front_end/bindings_test_runner/IsolatedFilesystemTestRunner.js",
"front_end/bindings_test_runner/module.json",
"front_end/bindings_test_runner/OverridesTestRunner.js",
"front_end/bindings_test_runner/PersistenceTestRunner.js",
"front_end/console_test_runner/console_test_runner.js",
"front_end/console_test_runner/module.json",
"front_end/coverage_test_runner/coverage_test_runner.js",
"front_end/coverage_test_runner/module.json",
"front_end/cpu_profiler_test_runner/module.json",
"front_end/cpu_profiler_test_runner/cpu_profiler_test_runner.js",
"front_end/data_grid_test_runner/data_grid_test_runner.js",
"front_end/data_grid_test_runner/module.json",
"front_end/device_mode_test_runner/device_mode_test_runner.js",
"front_end/device_mode_test_runner/module.json",
"front_end/elements_test_runner/elements_test_runner.js",
"front_end/elements_test_runner/EditDOMTestRunner.js",
"front_end/elements_test_runner/ElementsPanelShadowSelectionOnRefreshTestRunner.js",
"front_end/elements_test_runner/ElementsTestRunner.js",
"front_end/elements_test_runner/module.json",
"front_end/elements_test_runner/SetOuterHTMLTestRunner.js",
"front_end/elements_test_runner/StylesUpdateLinksTestRunner.js",
"front_end/extensions_test_runner/extensions_test_runner.js",
"front_end/extensions_test_runner/ExtensionsNetworkTestRunner.js",
"front_end/extensions_test_runner/ExtensionsTestRunner.js",
"front_end/extensions_test_runner/module.json",
"front_end/heap_profiler_test_runner/heap_profiler_test_runner.js",
"front_end/heap_profiler_test_runner/module.json",
"front_end/integration_test_runner.html",
"front_end/integration_test_runner.js",
"front_end/integration_test_runner.json",
"front_end/layers_test_runner/layers_test_runner.js",
"front_end/layers_test_runner/module.json",
"front_end/network_test_runner/module.json",
"front_end/network_test_runner/network_test_runner.js",
"front_end/performance_test_runner/performance_test_runner.js",
"front_end/performance_test_runner/module.json",
"front_end/performance_test_runner/TimelineDataTestRunner.js",
"front_end/performance_test_runner/TimelineTestRunner.js",
"front_end/sdk_test_runner/module.json",
"front_end/sdk_test_runner/sdk_test_runner.js",
"front_end/security_test_runner/module.json",
"front_end/security_test_runner/security_test_runner.js",
"front_end/sources_test_runner/sources_test_runner.js",
"front_end/sources_test_runner/AutocompleteTestRunner.js",
"front_end/sources_test_runner/DebuggerTestRunner.js",
"front_end/sources_test_runner/EditorTestRunner.js",
"front_end/sources_test_runner/LiveEditTestRunner.js",
"front_end/sources_test_runner/module.json",
"front_end/sources_test_runner/SearchTestRunner.js",
"front_end/sources_test_runner/SourcesTestRunner.js",
"front_end/test_runner/module.json",
]
devtools_embedder_scripts = [
"devtools_compatibility.js",
"Tests.js",
]
application_templates = [ "front_end/entrypoint_template.html" ]
generated_applications_html = [
"devtools_app.html",
"inspector.html",
"integration_test_runner.html",
"js_app.html",
"ndb_app.html",
"node_app.html",
"toolbox.html",
"worker_app.html",
]
applications_js = [
"lighthouse_worker.js",
"devtools_app.js",
"inspector.js",
"js_app.js",
"node_app.js",
"shell.js",
"worker_app.js",
]
resources_generated_applications_js = []
gen_generated_applications_js = []
foreach(application, applications_js) {
resources_generated_applications_js += [ "$resources_out_dir/$application" ]
gen_generated_applications_js += [ "$target_gen_dir/front_end/$application" ]
}
non_autostart_non_remote_modules = [
"accessibility/accessibility_module.js",
"animation/animation_module.js",
"browser_debugger/browser_debugger_module.js",
"changes/changes_module.js",
"client_variations/client_variations_module.js",
"cm/cm_module.js",
"color_picker/color_picker_module.js",
"console/console_module.js",
"cookie_table/cookie_table_module.js",
"coverage/coverage_module.js",
"css_overview/css_overview_module.js",
"data_grid/data_grid_module.js",
"diff/diff_module.js",
"elements/elements_module.js",
"event_listeners/event_listeners_module.js",
"formatter/formatter_module.js",
"har_importer/har_importer_module.js",
"heap_snapshot_model/heap_snapshot_model_module.js",
"help/help_module.js",
"inline_editor/inline_editor_module.js",
"input/input_module.js",
"javascript_metadata/javascript_metadata_module.js",
"js_profiler/js_profiler_module.js",
"layer_viewer/layer_viewer_module.js",
"layers/layers_module.js",
"lighthouse/lighthouse_module.js",
"linear_memory_inspector/linear_memory_inspector_module.js",
"media/media_module.js",
"network/network_module.js",
"node_debugger/node_debugger_module.js",
"object_ui/object_ui_module.js",
"perf_ui/perf_ui_module.js",
"performance_monitor/performance_monitor_module.js",
"profiler/profiler_module.js",
"issues/issues_module.js",
"developer_resources/developer_resources_module.js",
"protocol_monitor/protocol_monitor_module.js",
"quick_open/quick_open_module.js",
"resources/resources_module.js",
"search/search_module.js",
"security/security_module.js",
"settings/settings_module.js",
"snippets/snippets_module.js",
"source_frame/source_frame_module.js",
"sources/sources_module.js",
"text_editor/text_editor_module.js",
"timeline_model/timeline_model_module.js",
"timeline/timeline_module.js",
"web_audio/web_audio_module.js",
"webauthn/webauthn_module.js",
"workspace_diff/workspace_diff_module.js",
"emulated_devices/emulated_devices_module.js",
]
resources_non_autostart_non_remote_modules = []
gen_non_autostart_non_remote_modules = []
foreach(module_file, non_autostart_non_remote_modules) {
resources_non_autostart_non_remote_modules +=
[ "$resources_out_dir/$module_file" ]
gen_non_autostart_non_remote_modules +=
[ "$target_gen_dir/front_end/$module_file" ]
}
test_modules = [
"accessibility_test_runner/accessibility_test_runner_module.js",
"application_test_runner/application_test_runner_module.js",
"lighthouse_test_runner/lighthouse_test_runner_module.js",
"axe_core_test_runner/axe_core_test_runner_module.js",
"bindings_test_runner/bindings_test_runner_module.js",
"console_test_runner/console_test_runner_module.js",
"coverage_test_runner/coverage_test_runner_module.js",
"cpu_profiler_test_runner/cpu_profiler_test_runner_module.js",
"data_grid_test_runner/data_grid_test_runner_module.js",
"device_mode_test_runner/device_mode_test_runner_module.js",
"elements_test_runner/elements_test_runner_module.js",
"extensions_test_runner/extensions_test_runner_module.js",
"heap_profiler_test_runner/heap_profiler_test_runner_module.js",
"heap_snapshot_worker/heap_snapshot_worker_module.js",
"integration_test_runner.js",
"layers_test_runner/layers_test_runner_module.js",
"network_test_runner/network_test_runner_module.js",
"performance_test_runner/performance_test_runner_module.js",
"sdk_test_runner/sdk_test_runner_module.js",
"security_test_runner/security_test_runner_module.js",
"sources_test_runner/sources_test_runner_module.js",
]
resources_test_modules = []
gen_test_modules = []
foreach(module_file, test_modules) {
resources_test_modules += [ "$resources_out_dir/$module_file" ]
gen_test_modules += [ "$target_gen_dir/front_end/$module_file" ]
}
devtools_applications = [
"lighthouse_worker",
"devtools_app",
"inspector",
"integration_test_runner",
"js_app",
"ndb_app",
"node_app",
"shell",
"worker_app",
]
#-------------------------------------------------------------------------------
devtools_frontend_resources_deps = [
":build_release_devtools",
"front_end",
"test",
]
group("devtools_all_files") {
testonly = true
data = all_devtools_files
data += [
# This enables us to test bots with whitespace changes.
"scripts/whitespaces.txt",
]
data_deps = devtools_frontend_resources_deps
public_deps = [ "front_end/component_docs" ]
}
group("devtools_frontend_resources") {
public_deps = devtools_frontend_resources_deps
}
group("generate_devtools_inspector_overlay_resources") {
public_deps = [ "inspector_overlay:build_inspector_overlay" ]
}
action("generate_devtools_grd") {
script = "scripts/build/generate_devtools_grd.py"
deps = [ ":devtools_frontend_resources" ]
_grd_files = []
_unique_frontend_files =
generated_applications_html + applications_js +
non_autostart_non_remote_modules + devtools_embedder_scripts +
optimized_emulated_device_images + copied_devtools_locale_files +
devtools_module_entrypoint_sources
if (is_debug) {
_unique_frontend_files += all_typescript_module_sources
}
foreach(_input_file, _unique_frontend_files) {
_grd_files += [ "$target_gen_dir/front_end/$_input_file" ]
}
inputs = _grd_files + front_end_image_files
# Confirm that the files in the inputs match expectations.
# There is some path wrangling necessary here because some paths come with
# //out/{Target} at the start, others with front_end
_normalized_inputs = []
foreach(input, inputs) {
_normalized_inputs += [ string_replace(input, "$target_gen_dir/", "") ]
}
# Always assume the release files are included.
_expected_files = []
_expected_files += grd_files_release_sources
if (is_debug) {
_expected_files += grd_files_debug_sources
}
# Remove the inputs from the expectations, any leftovers means that not all inputs were provided.
_missing_files_expected = filter_exclude(_expected_files, _normalized_inputs)
assert(
_missing_files_expected == [],
"Files were expected that weren't found in the GRD inputs: $_missing_files_expected")
# Remove the expectations from the inputs, any leftovers means that too many files were provided.
_missing_files_normalized =
filter_exclude(_normalized_inputs, _expected_files)
assert(
_missing_files_normalized == [],
"Files were provided that weren't expected in the GRD inputs: $_missing_files_normalized")
response_file_contents = rebase_path(_grd_files, root_build_dir)
outfile = "$root_gen_dir/devtools/devtools_resources.grd"
outputs = [ outfile ]
relative_path_dirs = [
"$target_gen_dir/front_end",
"front_end",
]
args = [
"--file_list",
"{{response_file_name}}",
"--relative_path_dirs",
] + rebase_path(relative_path_dirs, root_build_dir) +
[
"--images",
rebase_path("front_end/Images", root_build_dir),
"--output",
rebase_path(outfile, root_build_dir),
]
if (!is_debug) {
# Compression is slow, particularly in debug builds, so only compress in
# non-debug builds.
args += [ "--compress" ]
}
}
build_release_devtools_args = []
if (!is_debug) {
build_release_devtools_args += [ "--rollup" ]
}
# TODO(crbug.com/1112471): Get this to work cleanly under Python3.
python2_action("build_release_devtools") {
script = "scripts/build/build_release_applications.py"
helper_scripts = [
"scripts/build/modular_build.py",
"scripts/build/rjsmin.py",
"front_end/rollup.config.js",
]
deps = [
"front_end",
"front_end:legacy_test-resources",
]
inputs = helper_scripts + all_devtools_files + devtools_test_files +
application_templates
outputs =
resources_generated_applications_js + gen_generated_applications_js +
resources_non_autostart_non_remote_modules +
gen_non_autostart_non_remote_modules + resources_test_modules +
gen_test_modules
args = devtools_applications + [
"--input_path",
rebase_path("front_end", root_build_dir),
# TODO(crbug.com/1174013): Remove output to resources_out_dir
"--output_path",
rebase_path(resources_out_dir, root_build_dir),
"--output_path_gen",
rebase_path("$target_gen_dir/front_end", root_build_dir),
] + build_release_devtools_args
}