[go: nahoru, domu]

blob: d5f7f475581baf7dcbf07096eac808dde16e8bbe [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("//third_party/blink/public/public_features.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")
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/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 = [
"front_end/devtools_compatibility.js",
"front_end/Tests.js",
]
application_templates = [ "front_end/entrypoint_template.html" ]
generated_applications_html = [
"$resources_out_dir/devtools_app.html",
"$resources_out_dir/inspector.html",
"$resources_out_dir/integration_test_runner.html",
"$resources_out_dir/js_app.html",
"$resources_out_dir/ndb_app.html",
"$resources_out_dir/node_app.html",
"$resources_out_dir/toolbox.html",
"$resources_out_dir/worker_app.html",
]
generated_applications_js = [
"$resources_out_dir/lighthouse_worker.js",
"$resources_out_dir/devtools_app.js",
"$resources_out_dir/inspector.js",
"$resources_out_dir/js_app.js",
"$resources_out_dir/node_app.js",
"$resources_out_dir/shell.js",
"$resources_out_dir/toolbox.js",
"$resources_out_dir/worker_app.js",
]
generated_non_autostart_non_remote_modules = [
"$resources_out_dir/accessibility/accessibility_module.js",
"$resources_out_dir/animation/animation_module.js",
"$resources_out_dir/browser_debugger/browser_debugger_module.js",
"$resources_out_dir/changes/changes_module.js",
"$resources_out_dir/client_variations/client_variations_module.js",
"$resources_out_dir/cm_modes/cm_modes_module.js",
"$resources_out_dir/cm/cm_module.js",
"$resources_out_dir/color_picker/color_picker_module.js",
"$resources_out_dir/console/console_module.js",
"$resources_out_dir/cookie_table/cookie_table_module.js",
"$resources_out_dir/coverage/coverage_module.js",
"$resources_out_dir/css_overview/css_overview_module.js",
"$resources_out_dir/data_grid/data_grid_module.js",
"$resources_out_dir/devices/devices_module.js",
"$resources_out_dir/diff/diff_module.js",
"$resources_out_dir/elements/elements_module.js",
"$resources_out_dir/event_listeners/event_listeners_module.js",
"$resources_out_dir/formatter/formatter_module.js",
"$resources_out_dir/har_importer/har_importer_module.js",
"$resources_out_dir/heap_snapshot_model/heap_snapshot_model_module.js",
"$resources_out_dir/help/help_module.js",
"$resources_out_dir/inline_editor/inline_editor_module.js",
"$resources_out_dir/input/input_module.js",
"$resources_out_dir/javascript_metadata/javascript_metadata_module.js",
"$resources_out_dir/js_profiler/js_profiler_module.js",
"$resources_out_dir/layer_viewer/layer_viewer_module.js",
"$resources_out_dir/layers/layers_module.js",
"$resources_out_dir/lighthouse/lighthouse_module.js",
"$resources_out_dir/linear_memory_inspector/linear_memory_inspector_module.js",
"$resources_out_dir/media/media_module.js",
"$resources_out_dir/network/network_module.js",
"$resources_out_dir/node_debugger/node_debugger_module.js",
"$resources_out_dir/object_ui/object_ui_module.js",
"$resources_out_dir/perf_ui/perf_ui_module.js",
"$resources_out_dir/performance_monitor/performance_monitor_module.js",
"$resources_out_dir/profiler/profiler_module.js",
"$resources_out_dir/issues/issues_module.js",
"$resources_out_dir/developer_resources/developer_resources_module.js",
"$resources_out_dir/protocol_monitor/protocol_monitor_module.js",
"$resources_out_dir/quick_open/quick_open_module.js",
"$resources_out_dir/resources/resources_module.js",
"$resources_out_dir/search/search_module.js",
"$resources_out_dir/security/security_module.js",
"$resources_out_dir/settings/settings_module.js",
"$resources_out_dir/snippets/snippets_module.js",
"$resources_out_dir/source_frame/source_frame_module.js",
"$resources_out_dir/sources/sources_module.js",
"$resources_out_dir/text_editor/text_editor_module.js",
"$resources_out_dir/timeline_model/timeline_model_module.js",
"$resources_out_dir/timeline/timeline_module.js",
"$resources_out_dir/web_audio/web_audio_module.js",
"$resources_out_dir/webauthn/webauthn_module.js",
"$resources_out_dir/workspace_diff/workspace_diff_module.js",
"$resources_out_dir/emulated_devices/emulated_devices_module.js",
]
generated_test_modules = [
"$resources_out_dir/accessibility_test_runner/accessibility_test_runner_module.js",
"$resources_out_dir/application_test_runner/application_test_runner_module.js",
"$resources_out_dir/lighthouse_test_runner/lighthouse_test_runner_module.js",
"$resources_out_dir/axe_core_test_runner/axe_core_test_runner_module.js",
"$resources_out_dir/bindings_test_runner/bindings_test_runner_module.js",
"$resources_out_dir/console_test_runner/console_test_runner_module.js",
"$resources_out_dir/coverage_test_runner/coverage_test_runner_module.js",
"$resources_out_dir/cpu_profiler_test_runner/cpu_profiler_test_runner_module.js",
"$resources_out_dir/data_grid_test_runner/data_grid_test_runner_module.js",
"$resources_out_dir/device_mode_test_runner/device_mode_test_runner_module.js",
"$resources_out_dir/elements_test_runner/elements_test_runner_module.js",
"$resources_out_dir/extensions_test_runner/extensions_test_runner_module.js",
"$resources_out_dir/heap_profiler_test_runner/heap_profiler_test_runner_module.js",
"$resources_out_dir/heap_snapshot_worker/heap_snapshot_worker_module.js",
"$resources_out_dir/integration_test_runner.js",
"$resources_out_dir/layers_test_runner/layers_test_runner_module.js",
"$resources_out_dir/network_test_runner/network_test_runner_module.js",
"$resources_out_dir/performance_test_runner/performance_test_runner_module.js",
"$resources_out_dir/sdk_test_runner/sdk_test_runner_module.js",
"$resources_out_dir/security_test_runner/security_test_runner_module.js",
"$resources_out_dir/sources_test_runner/sources_test_runner_module.js",
]
all_worker_entrypoints = [
"front_end/heap_snapshot_worker_entrypoint.js",
"front_end/wasmparser_worker_entrypoint.js",
]
generated_worker_bundles = [
"$resources_out_dir/heap_snapshot_worker_entrypoint.js",
"$resources_out_dir/wasmparser_worker_entrypoint.js",
]
devtools_applications = [
"lighthouse_worker",
"devtools_app",
"heap_snapshot_worker_entrypoint",
"inspector",
"integration_test_runner",
"js_app",
"ndb_app",
"node_app",
"shell",
"toolbox",
"wasmparser_worker_entrypoint",
"worker_app",
]
#-------------------------------------------------------------------------------
devtools_frontend_resources_deps = [
":build_release_devtools",
":devtools_extension_api",
"front_end",
"test",
]
group("devtools_all_files") {
testonly = true
data = all_devtools_files + generated_devtools_module_entrypoint_sources
data += [
# This enables us to test bots with whitespace changes.
"scripts/whitespaces.txt",
]
data_deps = devtools_frontend_resources_deps
}
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 =
generated_devtools_module_entrypoint_sources +
generated_applications_html + generated_applications_js +
generated_non_autostart_non_remote_modules + devtools_embedder_scripts +
generated_worker_bundles + generated_typescript_entrypoint_sources +
generated_typescript_modules + generated_devtools_locale_files +
generated_emulated_device_images +
[
"$resources_out_dir/devtools_extension_api.js",
"$resources_out_dir/sdk/wasm_source_map/pkg/wasm_source_map_bg.wasm",
"$resources_out_dir/formatter_worker_entrypoint.js",
"$resources_out_dir/third_party/acorn/package/dist/acorn.mjs",
]
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, resources_out_dir, "front_end") ]
}
# 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 = [
resources_out_dir,
"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),
]
}
action("devtools_extension_api") {
script = "scripts/build/generate_devtools_extension_api.py"
devtools_extension_api_files = [ "front_end/extensions/ExtensionAPI.js" ]
inputs = devtools_extension_api_files
outputs = [ "$resources_out_dir/devtools_extension_api.js" ]
args = rebase_path(outputs, root_build_dir) +
rebase_path(devtools_extension_api_files, root_build_dir)
}
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 + all_worker_entrypoints +
front_end_devtools_module_entrypoint_sources
outputs =
generated_applications_js + generated_non_autostart_non_remote_modules +
generated_test_modules + generated_worker_bundles +
generated_devtools_module_entrypoint_sources
args = devtools_applications + [
"--input_path",
rebase_path("front_end", root_build_dir),
"--output_path",
rebase_path(resources_out_dir, root_build_dir),
] + build_release_devtools_args
}