| # Copyright 2019 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/renderer/bindings/bindings.gni") |
| import("//third_party/blink/renderer/bindings/core/v8/generated.gni") |
| import("//third_party/blink/renderer/bindings/generated_in_core.gni") |
| import("//third_party/blink/renderer/bindings/generated_in_modules.gni") |
| import("//third_party/blink/renderer/bindings/idl_in_core.gni") |
| import("//third_party/blink/renderer/bindings/idl_in_modules.gni") |
| import("//third_party/blink/renderer/bindings/modules/v8/generated.gni") |
| import("//third_party/blink/renderer/bindings/scripts/scripts.gni") |
| import("//third_party/blink/renderer/build/scripts/scripts.gni") |
| import("//third_party/blink/renderer/core/core_idl_files.gni") |
| import("//third_party/blink/renderer/modules/modules_idl_files.gni") |
| |
| visibility = [ "//third_party/blink/renderer/*" ] |
| |
| action("interfaces_info") { |
| script = "$bindings_scripts_dir/compute_interfaces_info_overall.py" |
| |
| inputs = [ |
| "$bindings_core_output_dir/interfaces_info_core.pickle", |
| "$bindings_modules_output_dir/interfaces_info_modules.pickle", |
| ] |
| outputs = [ "$bindings_output_dir/interfaces_info.pickle" ] |
| |
| args = [ |
| "--", |
| rebase_path("$bindings_core_output_dir/interfaces_info_core.pickle", |
| root_build_dir), |
| rebase_path("$bindings_modules_output_dir/interfaces_info_modules.pickle", |
| root_build_dir), |
| rebase_path("$bindings_output_dir/interfaces_info.pickle", root_build_dir), |
| ] |
| |
| public_deps = [ |
| "//third_party/blink/renderer/bindings/core:interfaces_info_core", |
| "//third_party/blink/renderer/bindings/modules:interfaces_info_modules", |
| ] |
| } |
| |
| generate_global_constructors("global_constructors_idls") { |
| sources = core_idl_files + core_idl_with_modules_dependency_files |
| global_objects_file = |
| "$bindings_modules_output_dir/global_objects_modules.pickle" |
| interfaces = modules_core_global_constructors_original_interfaces |
| basenames = modules_core_global_constructors_original_interface_basenames |
| component = "core" |
| output_dir = blink_modules_output_dir |
| deps = [ |
| "//third_party/blink/renderer/bindings/modules:modules_global_constructors_idls", |
| "//third_party/blink/renderer/bindings/modules:modules_global_objects", |
| ] |
| } |
| |
| template("collect_idl_files") { |
| action_with_pydeps(target_name) { |
| script = "${bindings_scripts_dir}/collect_idl_files.py" |
| |
| inputs = invoker.inputs |
| outputs = [ invoker.output ] |
| |
| # List input file names in a temporary file. |
| response_file_contents = rebase_path(inputs, root_build_dir) |
| args = [ |
| "--idl-list-file", |
| "{{response_file_name}}", |
| "--component", |
| invoker.component, |
| "--output", |
| rebase_path(invoker.output, root_build_dir), |
| ] |
| |
| if (defined(invoker.deps)) { |
| deps = invoker.deps |
| } |
| } |
| } |
| |
| collect_idl_files("web_idl_in_core") { |
| component = "core" |
| |
| inputs = static_idl_files_in_core |
| deps = [] |
| |
| inputs += get_path_info( |
| [ |
| "$root_gen_dir/third_party/blink/renderer/core/testing/internal_runtime_flags.idl", |
| "$root_gen_dir/third_party/blink/renderer/core/testing/internal_settings_generated.idl", |
| ], |
| "abspath") |
| deps += [ |
| "//third_party/blink/renderer/core:generated_testing_idls_internal_runtime_flags", |
| "//third_party/blink/renderer/core:generated_testing_idls_settings", |
| ] |
| |
| # Supplemental IDL definitions to support the migration from the old bindings |
| # generator to the new one. |
| inputs += [ "${bindings_scripts_dir}/web_idl/migration_adapter.idl" ] |
| |
| # Additional IDL files to test and demonstrate the new IDL compiler. |
| inputs += [ "${bindings_scripts_dir}/web_idl/demonstration_and_testing.idl" ] |
| |
| output = "${bindings_output_dir}/web_idl_in_core.pickle" |
| } |
| |
| collect_idl_files("web_idl_in_modules") { |
| component = "modules" |
| |
| inputs = static_idl_files_in_modules |
| |
| output = "${bindings_output_dir}/web_idl_in_modules.pickle" |
| } |
| |
| action_with_pydeps("web_idl_database") { |
| script = "${bindings_scripts_dir}/build_web_idl_database.py" |
| |
| input_data_files = get_target_outputs(":web_idl_in_core") + |
| get_target_outputs(":web_idl_in_modules") |
| runtime_enabled_features_file = "../platform/runtime_enabled_features.json5" |
| runtime_enabled_features_test_file = |
| "${bindings_scripts_dir}/web_idl/runtime_enabled_features.json5" |
| inputs = input_data_files + [ |
| runtime_enabled_features_file, |
| runtime_enabled_features_test_file, |
| ] |
| output_data_file = "${bindings_output_dir}/web_idl_database.pickle" |
| outputs = [ output_data_file ] |
| |
| args = [ |
| "--output", |
| rebase_path(output_data_file, root_build_dir), |
| "--runtime_enabled_features", |
| rebase_path(runtime_enabled_features_file, root_build_dir), |
| "--runtime_enabled_features", |
| rebase_path(runtime_enabled_features_test_file, root_build_dir), |
| "--", |
| ] + rebase_path(input_data_files, root_build_dir) |
| |
| deps = [ |
| ":web_idl_in_core", |
| ":web_idl_in_modules", |
| ] |
| } |
| |
| group("generate_v8_bindings") { |
| public_deps = [] |
| if (use_v8_bind_gen_for_dictionary) { |
| public_deps += [ ":generate_bindings_dictionary" ] |
| } |
| } |
| |
| template("generate_bindings") { |
| action_with_pydeps(target_name) { |
| script = "${bindings_scripts_dir}/generate_bindings.py" |
| |
| web_idl_database_outputs = get_target_outputs(":web_idl_database") |
| web_idl_database = web_idl_database_outputs[0] |
| |
| inputs = [ web_idl_database ] |
| outputs = invoker.outputs |
| |
| args = [ |
| invoker.target, |
| "--web_idl_database", |
| rebase_path(web_idl_database, root_build_dir), |
| "--root_src_dir", |
| rebase_path("//", root_build_dir), |
| "--root_gen_dir", |
| rebase_path(root_gen_dir, root_build_dir), |
| "--output_core_reldir", |
| rebase_path("${bindings_output_dir}/core/v8/", root_gen_dir), |
| "--output_modules_reldir", |
| rebase_path("${bindings_output_dir}/modules/v8/", root_gen_dir), |
| ] |
| |
| deps = [ ":web_idl_database" ] |
| } |
| } |
| |
| if (use_v8_bind_gen_for_dictionary) { |
| generate_bindings("generate_bindings_dictionary") { |
| target = "dictionary" |
| outputs = |
| generated_core_dictionary_files + generated_modules_dictionary_files + |
| generated_core_testing_dictionary_files + generated_demo_files |
| } |
| } |
| |
| generate_bindings("generate_bindings_enumeration") { |
| target = "enumeration" |
| outputs = generated_enumeration_sources_in_core + |
| generated_enumeration_sources_in_modules |
| } |
| |
| action_with_pydeps("generate_high_entropy_list") { |
| script = "${bindings_scripts_dir}/generate_high_entropy_list.py" |
| |
| web_idl_database_outputs = get_target_outputs(":web_idl_database") |
| web_idl_database = web_idl_database_outputs[0] |
| |
| inputs = [ web_idl_database ] |
| output_data_file = "${root_build_dir}/high_entropy_list.csv" |
| outputs = [ output_data_file ] |
| |
| args = [ |
| "--web_idl_database", |
| rebase_path(web_idl_database, root_build_dir), |
| "--output", |
| rebase_path(output_data_file, root_build_dir), |
| ] |
| |
| deps = [ ":web_idl_database" ] |
| } |