Commit b6908dd2 authored by tasak@google.com's avatar tasak@google.com

Update bindings gn files for binding modularization.

bindings gyp files support but gn files are old and doesn't support binding modularization. e.g.
- create WindowCoreConstructors.idl and WindowModulesConstructors.idl instead of WindowConstructors.idl,
- ditto (SharedWorkderGlobalScope, DedicatedWorkerGlobalScope, ServiceWorkerGlobalScope).

BUG=358074

Review URL: https://codereview.chromium.org/633913002

git-svn-id: svn://svn.chromium.org/blink/trunk@183786 bbb929c8-8fbe-4397-9dbb-9b2b20218538
parent 393c8a01
...@@ -7,99 +7,3 @@ import("//third_party/WebKit/Source/build/scripts/scripts.gni") ...@@ -7,99 +7,3 @@ import("//third_party/WebKit/Source/build/scripts/scripts.gni")
import("//third_party/WebKit/Source/core/core.gni") import("//third_party/WebKit/Source/core/core.gni")
import("//third_party/WebKit/Source/modules/modules.gni") import("//third_party/WebKit/Source/modules/modules.gni")
visibility = [ "//third_party/WebKit/*" ]
# Main interface IDL files (excluding dependencies and testing)
# are included as properties on global objects, and in aggregate bindings.
main_interface_idl_files = core_idl_files + modules_idl_files
main_interface_idl_files_list = "$target_gen_dir/main_interface_idl_files.tmp"
write_file(main_interface_idl_files_list,
rebase_path(main_interface_idl_files, root_build_dir))
generated_global_constructors_idl_files = [
"$blink_output_dir/WindowConstructors.idl",
"$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl",
"$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl",
"$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl",
]
generated_global_constructors_header_files = [
"$blink_output_dir/WindowConstructors.h",
"$blink_output_dir/SharedWorkerGlobalScopeConstructors.h",
"$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.h",
"$blink_output_dir/ServiceWorkerGlobalScopeConstructors.h",
]
# FIXME: Generate separate core_global_objects
# http://crbug.com/358074
# GYP version: generated.gyp:global_objects
action("global_objects") {
script = "scripts/compute_global_objects.py"
inputs = [
"scripts/utilities.py",
# Only look in main IDL files (exclude dependencies and testing,
# which should not define global objects).
main_interface_idl_files_list,
] + main_interface_idl_files
outputs = [
"$bindings_output_dir/GlobalObjects.pickle",
]
args = [
"--idl-files-list",
rebase_path(main_interface_idl_files_list, root_build_dir),
"--write-file-only-if-changed=1", # Always true for Ninja. FIXME: remove
# when everything switched to GN.
"--",
rebase_path("$bindings_output_dir/GlobalObjects.pickle", root_build_dir),
]
}
# GYP version: generated.gyp:global_constructors_idls
action("global_constructors_idls") {
script = "scripts/generate_global_constructors.py"
inputs = [
"scripts/generate_global_constructors.py",
"scripts/utilities.py",
"$bindings_output_dir/GlobalObjects.pickle",
# Only includes main IDL files (exclude dependencies and testing,
# which should not appear on global objects).
main_interface_idl_files_list,
] + main_interface_idl_files
outputs = generated_global_constructors_idl_files +
generated_global_constructors_header_files
args = [
"--idl-files-list",
rebase_path(main_interface_idl_files_list, root_build_dir),
"--global-objects-file",
rebase_path("$bindings_output_dir/GlobalObjects.pickle", root_build_dir),
"--write-file-only-if-changed=1", # Always true for Ninja.
"--",
"Window",
rebase_path("$blink_output_dir/WindowConstructors.idl", root_build_dir),
"SharedWorkerGlobalScope",
rebase_path("$blink_output_dir/SharedWorkerGlobalScopeConstructors.idl",
root_build_dir),
"DedicatedWorkerGlobalScope",
rebase_path("$blink_output_dir/DedicatedWorkerGlobalScopeConstructors.idl",
root_build_dir),
"ServiceWorkerGlobalScope",
rebase_path("$blink_output_dir/ServiceWorkerGlobalScopeConstructors.idl",
root_build_dir),
]
deps = [ ":global_objects" ]
}
# GYP version: generated.gyp:generated_idls
group("generated_idls") {
deps = [
":global_constructors_idls",
"//third_party/WebKit/Source/core:generated_testing_idls",
]
}
...@@ -8,10 +8,35 @@ import("//third_party/WebKit/Source/bindings/scripts/scripts.gni") ...@@ -8,10 +8,35 @@ import("//third_party/WebKit/Source/bindings/scripts/scripts.gni")
visibility = [ "//third_party/WebKit/*" ] visibility = [ "//third_party/WebKit/*" ]
core_idl_files_list = "$target_gen_dir/core_idl_files.tmp"
write_file(core_idl_files_list,
rebase_path(core_idl_files, root_build_dir))
# GYP version: Source/bindings/core/generated.gyp:interfaces_info_individual_core # GYP version: Source/bindings/core/generated.gyp:interfaces_info_individual_core
compute_interfaces_info_individual("interfaces_info_individual_core") { compute_interfaces_info_individual("interfaces_info_individual_core") {
sources_static = core_static_idl_files sources_static = core_static_idl_files
sources_generated = core_generated_idl_files sources_generated = core_generated_idl_files
output_file = output_file =
"$bindings_core_output_dir/InterfacesInfoCoreIndividual.pickle" "$bindings_core_output_dir/InterfacesInfoCoreIndividual.pickle"
deps = [
"//third_party/WebKit/Source/bindings/core:core_global_constructors_idls",
]
}
# GYP version: Source/bindings/core/generated.gyp:core_global_objects
compute_global_objects("core_global_objects") {
sources = core_idl_files
sources_generated = []
output_file = "$bindings_core_output_dir/GlobalObjectsCore.pickle"
deps = []
}
# GYP version: Source/bindings/core/generated.gyp:core_global_constructors_idls
generate_global_constructors("core_global_constructors_idls") {
sources = core_idl_files
global_objects_file = "$bindings_core_output_dir/GlobalObjectsCore.pickle"
interfaces = core_global_constructors_original_interfaces
component = "Core"
output_dir = blink_core_output_dir
deps = [ ":core_global_objects" ]
} }
...@@ -4,5 +4,20 @@ ...@@ -4,5 +4,20 @@
# FIXME: factor out bindings_core http://crbug.com/358074 # FIXME: factor out bindings_core http://crbug.com/358074
import("//third_party/WebKit/Source/bindings/bindings.gni") import("//third_party/WebKit/Source/bindings/bindings.gni")
import("//third_party/WebKit/Source/core/core.gni")
bindings_core_output_dir = "$bindings_output_dir/core" bindings_core_output_dir = "$bindings_output_dir/core"
# Global constructors
core_global_constructors_original_interfaces = [
"Window",
"SharedWorkerGlobalScope",
"DedicatedWorkerGlobalScope",
]
core_global_constructors_generated_idl_files = []
foreach (interface, core_global_constructors_original_interfaces) {
core_global_constructors_generated_idl_files += [
"$blink_core_output_dir/${interface}CoreConstructors.idl"
]
}
...@@ -2,6 +2,7 @@ ...@@ -2,6 +2,7 @@
# Use of this source code is governed by a BSD-style license that can be # Use of this source code is governed by a BSD-style license that can be
# found in the LICENSE file. # found in the LICENSE file.
import("//third_party/WebKit/Source/bindings/core/core.gni")
import("//third_party/WebKit/Source/bindings/idl.gni") import("//third_party/WebKit/Source/bindings/idl.gni")
import("//third_party/WebKit/Source/core/core.gni") import("//third_party/WebKit/Source/core/core.gni")
...@@ -35,9 +36,7 @@ core_static_dependency_idl_files = ...@@ -35,9 +36,7 @@ core_static_dependency_idl_files =
core_generated_interface_idl_files = core_generated_interface_idl_files =
generated_webcore_testing_idl_files # interfaces generated_webcore_testing_idl_files # interfaces
core_generated_dependency_idl_files = core_generated_dependency_idl_files =
# FIXME: Generate separate core_global_constructors_idls core_global_constructors_generated_idl_files # partial interfaces
# http://crbug.com/358074
generated_global_constructors_idl_files # partial interfaces
# Static IDL files / Generated IDL files # Static IDL files / Generated IDL files
# #
......
...@@ -10,6 +10,14 @@ import("//third_party/WebKit/Source/build/scripts/scripts.gni") ...@@ -10,6 +10,14 @@ import("//third_party/WebKit/Source/build/scripts/scripts.gni")
visibility = [ "//third_party/WebKit/*" ] visibility = [ "//third_party/WebKit/*" ]
core_idl_files_list = "$target_gen_dir/core_idl_files.tmp"
write_file(core_idl_files_list,
rebase_path(core_idl_files, root_build_dir))
modules_idl_files_list = "$target_gen_dir/modules_idl_files.tmp"
write_file(modules_idl_files_list,
rebase_path(modules_idl_files, root_build_dir))
# GYP version: Source/bindings/modules/generated.gyp:bindings_modules_generated # GYP version: Source/bindings/modules/generated.gyp:bindings_modules_generated
group("bindings_modules_generated") { group("bindings_modules_generated") {
deps = [ deps = [
...@@ -69,6 +77,10 @@ compute_interfaces_info_individual("interfaces_info_individual_modules") { ...@@ -69,6 +77,10 @@ compute_interfaces_info_individual("interfaces_info_individual_modules") {
sources_generated = [] sources_generated = []
output_file = output_file =
"$bindings_modules_output_dir/InterfacesInfoModulesIndividual.pickle" "$bindings_modules_output_dir/InterfacesInfoModulesIndividual.pickle"
deps = [
":modules_core_global_constructors_idls",
":modules_global_constructors_idls",
]
} }
# GYP version: Source/bindings/modules/generated.gyp:interfaces_info # GYP version: Source/bindings/modules/generated.gyp:interfaces_info
...@@ -102,3 +114,31 @@ action("interfaces_info") { ...@@ -102,3 +114,31 @@ action("interfaces_info") {
"//third_party/WebKit/Source/bindings/core:interfaces_info_individual_core", "//third_party/WebKit/Source/bindings/core:interfaces_info_individual_core",
] ]
} }
# GYP version: Source/bindings/modules/generated.gyp:modules_global_objects
compute_global_objects("modules_global_objects") {
sources = modules_idl_files
sources_generated = [ "$bindings_core_output_dir/GlobalObjectsCore.pickle" ]
output_file = "$bindings_modules_output_dir/GlobalObjectsModules.pickle"
deps = [ "//third_party/WebKit/Source/bindings/core:core_global_objects" ]
}
# GYP version: Source/bindings/modules/generated.gyp:modules_core_global_constructors_idls
generate_global_constructors("modules_core_global_constructors_idls") {
sources = core_idl_files
global_objects_file = "$bindings_modules_output_dir/GlobalObjectsModules.pickle"
interfaces = modules_core_global_constructors_original_interfaces
component = "Core"
output_dir = blink_modules_output_dir
deps = [ ":modules_global_objects" ]
}
# GYP version: Source/bindings/modules/generated.gyp:modules_global_constructors_idls
generate_global_constructors("modules_global_constructors_idls") {
sources = modules_idl_files
global_objects_file = "$bindings_modules_output_dir/GlobalObjectsModules.pickle"
interfaces = modules_global_constructors_original_interfaces
component = "Modules"
output_dir = blink_modules_output_dir
deps = [ ":modules_global_objects" ]
}
...@@ -3,6 +3,7 @@ ...@@ -3,6 +3,7 @@
# found in the LICENSE file. # found in the LICENSE file.
import("//third_party/WebKit/Source/bindings/core/idl.gni") import("//third_party/WebKit/Source/bindings/core/idl.gni")
import("//third_party/WebKit/Source/bindings/modules/modules.gni")
import("//third_party/WebKit/Source/modules/modules.gni") import("//third_party/WebKit/Source/modules/modules.gni")
# IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces # IDL file lists; see: http://www.chromium.org/developers/web-idl-interfaces
...@@ -33,11 +34,15 @@ modules_static_idl_files = ...@@ -33,11 +34,15 @@ modules_static_idl_files =
modules_static_interface_idl_files + modules_static_interface_idl_files +
modules_static_dependency_idl_files modules_static_dependency_idl_files
modules_generated_dependency_idl_files =
modules_core_global_constructors_generated_idl_files +
modules_global_constructors_generated_idl_files
# 'modules_dependency_idl_files' is already used in Source/modules, so avoid # 'modules_dependency_idl_files' is already used in Source/modules, so avoid
# collision # collision
modules_all_dependency_idl_files = modules_all_dependency_idl_files =
modules_static_dependency_idl_files modules_static_dependency_idl_files +
#+ modules_generated_dependency_idl_files modules_generated_dependency_idl_files
# Dependency IDL files: don't generate individual bindings, but do process # Dependency IDL files: don't generate individual bindings, but do process
# in IDL dependency computation, and count as build dependencies # in IDL dependency computation, and count as build dependencies
......
...@@ -4,5 +4,32 @@ ...@@ -4,5 +4,32 @@
# FIXME: factor out bindings_core http://crbug.com/358074 # FIXME: factor out bindings_core http://crbug.com/358074
import("//third_party/WebKit/Source/bindings/bindings.gni") import("//third_party/WebKit/Source/bindings/bindings.gni")
import("//third_party/WebKit/Source/modules/modules.gni")
bindings_modules_output_dir = "$bindings_output_dir/modules"
modules_core_global_constructors_original_interfaces = [
"ServiceWorkerGlobalScope",
]
modules_global_constructors_original_interfaces = [
"Window",
"SharedWorkerGlobalScope",
"DedicatedWorkerGlobalScope",
"ServiceWorkerGlobalScope",
]
modules_core_global_constructors_generated_idl_files = []
foreach (interface, modules_core_global_constructors_original_interfaces) {
modules_core_global_constructors_generated_idl_files += [
"$blink_modules_output_dir/${interface}CoreConstructors.idl"
]
}
modules_global_constructors_generated_idl_files = []
foreach (interface, modules_global_constructors_original_interfaces) {
modules_global_constructors_generated_idl_files += [
"$blink_modules_output_dir/${interface}ModulesConstructors.idl"
]
}
bindings_modules_output_dir = "$bindings_output_dir/bindings/modules"
...@@ -28,6 +28,7 @@ idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath") ...@@ -28,6 +28,7 @@ idl_compiler_files = get_path_info(_gypi.idl_compiler_files, "abspath")
# sources_generated = list of generated IDL files to pass as inputs # sources_generated = list of generated IDL files to pass as inputs
# component_dir = name if subdirectory (one word, no slashes) of component. # component_dir = name if subdirectory (one word, no slashes) of component.
# output_file = pickle file to write # output_file = pickle file to write
# deps = dependencies
# #
# FIXME: Note the static/generated split is for consistency with GYP. This # FIXME: Note the static/generated split is for consistency with GYP. This
# split is not necessary in the GN build and could be combined into a single # split is not necessary in the GN build and could be combined into a single
...@@ -61,11 +62,7 @@ template("compute_interfaces_info_individual") { ...@@ -61,11 +62,7 @@ template("compute_interfaces_info_individual") {
"--", "--",
] + rebase_path(invoker.sources_generated, root_build_dir) ] + rebase_path(invoker.sources_generated, root_build_dir)
deps = [ deps = invoker.deps
# FIXME: should be {modules|core}_generated_idls
# http://crbug.com/358074
"//third_party/WebKit/Source/bindings:generated_idls",
]
} }
} }
...@@ -238,3 +235,97 @@ template("aggregate_generated_bindings") { ...@@ -238,3 +235,97 @@ template("aggregate_generated_bindings") {
args += rebase_path(invoker.outputs, root_build_dir) args += rebase_path(invoker.outputs, root_build_dir)
} }
} }
# Calls the compute_global_objects script.
#
# Parameters:
# sources = a list of source IDL files.
# sources_generated = a list of generated pickle sources.
# output_file = a pickle file to write to (need to specify directory)
#
template("compute_global_objects") {
action(target_name) {
script = "//third_party/WebKit/Source/bindings/scripts/compute_global_objects.py"
# Write the file list to a unique temp file to avoid blowing out the
# command line length limit.
idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
write_file(idl_files_list,
rebase_path(invoker.sources, root_build_dir))
inputs = [
"//third_party/WebKit/Source/bindings/scripts/utilities.py",
idl_files_list,
] + invoker.sources_generated + invoker.sources
outputs = [ invoker.output_file ]
args = [
"--idl-files-list",
rebase_path(idl_files_list, root_build_dir),
"--write-file-only-if-changed=1", # Always true for Ninja.
"--",
]
args += rebase_path(invoker.sources_generated, root_build_dir)
args += [ rebase_path(invoker.output_file, root_build_dir) ]
deps = invoker.deps
}
}
# Calls the generate_global_constructors script.
#
# Parameters:
# sources = a list of source IDL files.
# global_objects_file = a global objects file generated by compute_global_objects
# interfaces = interfaces to generate global constructors for.
# component = component to generate global constructors for.
# output_dir = output directory to generate idl files and header files.
# deps = dependencies
#
template("generate_global_constructors") {
action(target_name) {
script = "//third_party/WebKit/Source/bindings/scripts/generate_global_constructors.py"
# Write the file list to a unique temp file to avoid blowing out the
# command line length limit.
idl_files_list = "$target_gen_dir/${target_name}_file_list.tmp"
write_file(idl_files_list,
rebase_path(invoker.sources, root_build_dir))
inputs = [
"//third_party/WebKit/Source/bindings/scripts/utilities.py",
idl_files_list,
invoker.global_objects_file,
] + invoker.sources
args = [
"--idl-files-list",
rebase_path(idl_files_list, root_build_dir),
"--global-objects-file",
rebase_path(invoker.global_objects_file, root_build_dir),
"--write-file-only-if-changed=1", # Always true for Ninja.
"--",
]
output_dir = invoker.output_dir
component = invoker.component
# generate outputs from invoker.interfaces.
output_idl_files = []
output_header_files = []
foreach(interface, invoker.interfaces) {
args += [ interface ]
output_idl_file = "$output_dir/${interface}${component}Constructors.idl"
args += [ rebase_path(output_idl_file, root_build_dir) ]
output_idl_files += [ output_idl_file ]
output_header_files += [
"$output_dir/${interface}${component}Constructors.h"
]
}
outputs = output_idl_files + output_header_files
deps = invoker.deps
}
}
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment