| # Copyright 2014 The Chromium Authors | |
| # Use of this source code is governed by a BSD-style license that can be | |
| # found in the LICENSE file. | |
| import("./config/gni/devtools_grd_files.gni") | |
| import("./config/gni/devtools_image_files.gni") | |
| import("./scripts/build/ninja/copy.gni") | |
| import("./scripts/build/ninja/node.gni") | |
| import("./scripts/build/ninja/vars.gni") | |
| import("./scripts/build/typescript/typescript.gni") | |
| import("./third_party/blink/public/public_features.gni") | |
| #------------------------------------------------------------------------------- | |
| devtools_frontend_resources_deps = [ | |
| ":favicon", | |
| "front_end", | |
| ] | |
| group("devtools_all_files") { | |
| testonly = true | |
| data = [ | |
| # This enables us to test bots with whitespace changes. | |
| "scripts/whitespaces.txt", | |
| ] | |
| data_deps = devtools_frontend_resources_deps + [ | |
| "front_end:web_test_resources", | |
| "scripts/build:tests", | |
| "scripts/gn_deps_verifier", | |
| "scripts/hosted_mode", | |
| "test", | |
| ] | |
| deps = [ ":frontend_indexer_tsconfig" ] | |
| public_deps = [ "scripts/component_docs" ] | |
| } | |
| # The subset of DevTools files that Chromium's blink_web_tests need at runtime | |
| # (the DevTools frontend plus the legacy/integration test runners used by | |
| # web_tests/http/tests/devtools). Do not add DevTools' own test suites here: | |
| # when building inside Chromium they have a runtime dependency on //chrome, | |
| # which would force every blink_web_tests build to build all of Chrome. | |
| group("devtools_web_test_files") { | |
| testonly = true | |
| data_deps = | |
| devtools_frontend_resources_deps + [ "front_end:web_test_resources" ] | |
| } | |
| group("devtools_frontend_resources") { | |
| public_deps = devtools_frontend_resources_deps | |
| deps = [ | |
| ":assert_grd", | |
| ":assert_third_party_readmes", | |
| ] | |
| } | |
| group("generate_devtools_inspector_overlay_resources") { | |
| public_deps = [ "inspector_overlay:build_inspector_overlay" ] | |
| } | |
| action("assert_grd") { | |
| script = "scripts/build/assert_grd.py" | |
| deps = [ | |
| ":expected_grd_files", | |
| ":input_grd_files", | |
| ] | |
| inputs = [ | |
| "$target_gen_dir/expected_grd_files.json", | |
| "$target_gen_dir/input_grd_files.json", | |
| ] | |
| args = [ | |
| rebase_path("$target_gen_dir/expected_grd_files.json", root_build_dir), | |
| rebase_path("$target_gen_dir/input_grd_files.json", root_build_dir), | |
| rebase_path("$target_gen_dir/assert_grd.stamp", root_build_dir), | |
| ] | |
| outputs = [ "$target_gen_dir/assert_grd.stamp" ] | |
| } | |
| action("assert_third_party_readmes") { | |
| script = "scripts/build/assert_third_party_readmes.py" | |
| deps = [ ":expected_grd_files" ] | |
| inputs = [ | |
| "$target_gen_dir/expected_grd_files.json", | |
| "front_end/third_party/additional_readme_paths.json", | |
| ] | |
| args = [ | |
| rebase_path("$target_gen_dir/expected_grd_files.json", root_build_dir), | |
| rebase_path("front_end/third_party/additional_readme_paths.json", | |
| root_build_dir), | |
| rebase_path("$target_gen_dir/assert_third_party_readmes.stamp", | |
| root_build_dir), | |
| ] | |
| outputs = [ "$target_gen_dir/assert_third_party_readmes.stamp" ] | |
| } | |
| _expected_grd_files = [] | |
| _expected_grd_files += grd_files_bundled_sources | |
| if (!devtools_bundle) { | |
| _expected_grd_files += grd_files_unbundled_sources | |
| } | |
| generated_file("expected_grd_files") { | |
| outputs = [ "$target_gen_dir/expected_grd_files.json" ] | |
| contents = _expected_grd_files | |
| output_conversion = "json" | |
| } | |
| _grd_entrypoint_files = filter_include(grd_files_bundled_sources, | |
| [ | |
| "*.js", | |
| "*.mjs", | |
| ]) | |
| generated_file("bundled_entrypoints") { | |
| outputs = [ "$target_gen_dir/bundled_entrypoints.json" ] | |
| contents = _grd_entrypoint_files + [ | |
| "front_end/core/legacy_producer/legacy_producer.js", | |
| "front_end/core/split_producer/split_producer.js", | |
| "front_end/panels/legacy_consumer/legacy_consumer.js", | |
| "front_end/panels/legacy_mixed/legacy_mixed.js", | |
| "front_end/panels/split_consumer/split_consumer.js", | |
| "front_end/panels/split_mixed/split_mixed.js", | |
| ] | |
| output_conversion = "json" | |
| } | |
| generated_file("input_grd_files") { | |
| outputs = [ "$target_gen_dir/input_grd_files.json" ] | |
| data_keys = [ "grd_files" ] | |
| output_conversion = "json" | |
| rebase = target_gen_dir | |
| deps = [ "front_end" ] | |
| } | |
| # Files that are not bundled with Chrome (i.e. not part of the GRD), but are | |
| # fetched on demand from the remote DevTools server. | |
| generated_file("remote_files") { | |
| outputs = [ "$target_gen_dir/remote_files.json" ] | |
| data_keys = [ "remote_files" ] | |
| output_conversion = "json" | |
| rebase = target_gen_dir | |
| deps = [ "front_end" ] | |
| } | |
| # Archive of all files that chrome-devtools-frontend.appspot.com serves, i.e. | |
| # the GRD files plus the remote-only files. Official builders upload this | |
| # archive for every Chrome version. | |
| # | |
| # The archive layout is independent of the location of DevTools in the source | |
| # tree: all files are stored under devtools-frontend/front_end/. | |
| action("devtools_frontend_zip") { | |
| script = "scripts/build/zip_devtools_frontend.py" | |
| deps = [ | |
| ":devtools_frontend_resources", | |
| ":expected_grd_files", | |
| ":remote_files", | |
| ] | |
| inputs = [ | |
| "$target_gen_dir/expected_grd_files.json", | |
| "$target_gen_dir/remote_files.json", | |
| ] | |
| outputs = [ "$root_out_dir/devtools-frontend.zip" ] | |
| depfile = "$target_gen_dir/$target_name.d" | |
| args = [ | |
| "--file-list", | |
| rebase_path("$target_gen_dir/expected_grd_files.json", root_build_dir), | |
| "--file-list", | |
| rebase_path("$target_gen_dir/remote_files.json", root_build_dir), | |
| "--base-dir", | |
| rebase_path(target_gen_dir, root_build_dir), | |
| "--prefix", | |
| "devtools-frontend", | |
| "--output", | |
| rebase_path("$root_out_dir/devtools-frontend.zip", root_build_dir), | |
| "--depfile", | |
| rebase_path(depfile, root_build_dir), | |
| ] | |
| } | |
| _compressable_grd_files = filter_include(_expected_grd_files, | |
| [ | |
| "*.css", | |
| "*.html", | |
| "*.js", | |
| "*.svg", | |
| "*.json", | |
| "*.md", | |
| ]) | |
| if (!is_debug) { | |
| node_action("compress") { | |
| script = "scripts/build/compress_files.js" | |
| public_deps = [ ":devtools_frontend_resources" ] | |
| depfile = "$target_gen_dir/$target_name.d" | |
| _compressable_inputs = [] | |
| foreach(_grd_file, _compressable_grd_files) { | |
| _compressable_inputs += [ "$target_gen_dir/$_grd_file" ] | |
| } | |
| response_file_contents = rebase_path(_compressable_inputs, root_build_dir) | |
| outputs = [] | |
| foreach(_grd_file, _compressable_grd_files) { | |
| outputs += [ | |
| "$target_gen_dir/$_grd_file.compressed", | |
| "$target_gen_dir/$_grd_file.hash", | |
| ] | |
| } | |
| args = [ | |
| "--file-list", | |
| "{{response_file_name}}", | |
| "--depfile", | |
| rebase_path(depfile, root_build_dir), | |
| ] | |
| } | |
| } else { | |
| not_needed([ "_compressable_grd_files" ]) | |
| } | |
| action("generate_devtools_grd") { | |
| script = "scripts/build/generate_devtools_grd.py" | |
| depfile = "$target_gen_dir/$target_name.d" | |
| response_file_contents = rebase_path(_expected_grd_files, "front_end") | |
| outfile = "$target_gen_dir/front_end/devtools_resources.grd" | |
| outputs = [ outfile ] | |
| args = [ | |
| "--file_list", | |
| "{{response_file_name}}", | |
| "--output", | |
| rebase_path(outfile, root_build_dir), | |
| "--depfile", | |
| rebase_path(depfile, root_build_dir), | |
| ] | |
| deps = [ ":devtools_frontend_resources" ] | |
| if (!is_debug) { | |
| deps += [ ":compress" ] | |
| # Compression is slow, particularly in debug builds, so only compress in | |
| # non-debug builds. | |
| args += [ "--compress" ] | |
| } | |
| } | |
| generated_file("indexer_ts_files") { | |
| testonly = true | |
| outputs = [ "$root_build_dir/indexer_ts_files.txt" ] | |
| data_keys = [ "typescript_files" ] | |
| deps = [ | |
| "front_end", | |
| "front_end:unittests", | |
| ] | |
| } | |
| action("frontend_indexer_tsconfig") { | |
| testonly = true | |
| script = devtools_location_prepend + | |
| "scripts/build/typescript/generate_indexer_tsconfig.py" | |
| _sourceslist = "$root_build_dir/indexer_ts_files.txt" | |
| _tsconfig_base = | |
| devtools_location_prepend + "config/typescript/tsconfig.base.json" | |
| _global_defs = [ | |
| devtools_location_prepend + "front_end/global_typings/global_defs.d.ts", | |
| devtools_location_prepend + "front_end/legacy/legacy-defs.d.ts", | |
| devtools_location_prepend + "node_modules/@types/filesystem/index.d.ts", | |
| devtools_location_prepend + "node_modules/@types/filewriter/index.d.ts", | |
| ] | |
| public_deps = [ ":indexer_ts_files" ] | |
| inputs = [ | |
| _sourceslist, | |
| _tsconfig_base, | |
| ] + _global_defs | |
| _output_location = "$target_gen_dir/frontend_indexer_tsconfig-tsconfig.json" | |
| outputs = [ _output_location ] | |
| args = [ | |
| "--tsconfig-base", | |
| rebase_path(_tsconfig_base, root_build_dir), | |
| "--tsconfig_output_location", | |
| rebase_path(_output_location, root_build_dir), | |
| "--front-end-directory", | |
| rebase_path(".", root_build_dir), | |
| "--sources-list", | |
| rebase_path(_sourceslist, root_build_dir), | |
| "--additional-type-definitions", | |
| ] + rebase_path(_global_defs, root_build_dir) | |
| } | |
| copy_to_gen("favicon") { | |
| sources = [ "favicon.ico" ] | |
| } | |
| group("mcp") { | |
| deps = [ "./mcp" ] | |
| } | |
| group("harness_tests") { | |
| testonly = true | |
| deps = [ "./test/harness" ] | |
| } | |
| group("api_tests") { | |
| testonly = true | |
| public_deps = [ "test:api_tests" ] | |
| } | |
| group("e2e_tests") { | |
| testonly = true | |
| public_deps = [ "test:e2e_tests" ] | |
| } | |
| group("script_tests") { | |
| testonly = true | |
| public_deps = [ "test:script_tests" ] | |
| } | |
| group("unittests") { | |
| testonly = true | |
| public_deps = [ "test:unittests" ] | |
| } | |
| write_file("$target_gen_dir/package.json", "{\"type\": \"module\"}") |