Commit 9b73b196 authored by Hitoshi Yoshida's avatar Hitoshi Yoshida Committed by Commit Bot

bindings: Drop support and comments for GYP in bindings

We no longer use GYP, and it is confusing to keep having
APIs or comments for it.

Bug: None
Change-Id: I0d2cd0f4c5b41edeab3ea65785a5eec9a4324b44
Reviewed-on: https://chromium-review.googlesource.com/c/1322344Reviewed-by: default avatarYuki Shiino <yukishiino@chromium.org>
Reviewed-by: default avatarKentaro Hara <haraken@chromium.org>
Commit-Queue: Hitoshi Yoshida <peria@chromium.org>
Cr-Commit-Position: refs/heads/master@{#605998}
parent dd3cf62f
...@@ -21,49 +21,42 @@ core/modules. ...@@ -21,49 +21,42 @@ core/modules.
The file name for a generated class is basically the same as its class The file name for a generated class is basically the same as its class
name, but we use some aliases to avoid too-long file names name, but we use some aliases to avoid too-long file names
(See http://crbug.com/611437 why we need to avoid long file names). (See https://crbug.com/611437 why we need to avoid long file names).
Currently we use following alias(es).
```
CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrWebGL2ComputeRenderingContextOrImageBitmapRenderingContextOrXRPresentationContext -> RenderingContext
```
The paths for generated classes depend on the places union types are The paths for generated classes depend on the places union types are
used. If a union type is used only by IDL files under modules/, the used. If a union type is used only in IDL files under modules/, the
include path is `bindings/modules/v8/FooOrBar.h`. Otherwise, the include path is `bindings/modules/v8/foo_or_bar.h`. Otherwise, the
include path is `bindings/core/v8/FooOrBar.h`. For example, given include path is `bindings/core/v8/foo_or_bar.h`. For example, given
following definitions: following definitions:
```webidl ```webidl
// core/fileapi/FileReader.idl // core/fileapi/file_reader.idl
readonly attribute (DOMString or ArrayBuffer)? result; readonly attribute (DOMString or ArrayBuffer)? result;
// dom/CommonDefinitions.idl // dom/common_definitions.idl
typedef (ArrayBuffer or ArrayBufferView) BufferSource; typedef (ArrayBuffer or ArrayBufferView) BufferSource;
// modules/encoding/TextDecoder.idl // modules/encoding/text_decoder.idl
DOMString decode(optional BufferSource input, optional TextDecodeOptions options); DOMString decode(optional BufferSource input, optional TextDecodeOptions options);
// modules/fetch/Request.idl // modules/fetch/request.idl
typedef (Request or USVString) RequestInfo; typedef (Request or USVString) RequestInfo;
``` ```
The include paths will be: The include paths will be:
- bindings/core/v8/StringOrArrayBuffer.h - bindings/core/v8/string_or_array_buffer.h
- bindings/core/v8/ArrayBufferOrArrayBufferView.h - bindings/core/v8/array_buffer_or_array_buffer_view.h
- bindings/modules/v8/RequestOrUSVString.h - bindings/modules/v8/request_or_usv_string.h
Note that `ArrayBufferOrArrayBufferView` is located under core/ even Note that `array_buffer_or_array_buffer_view.h` is located under core/ even
it is used by `Request.idl` which is located under modules/. it is used by `request.idl` which is located under modules/.
**Special NOTE**: If you are going to use a union type under core/ and **Special NOTE**: If you are going to use a union type under core/ and
the union type is currently used only under modules/, you will need the union type is currently used only under modules/, you will need
to update the include path for the union type under modules/. to update the include path for the union type under modules/.
## Updating GN/GYP files ## Updating GN files
TODO(bashi): Mitigate the pain of updating GN/GYP files. Due to the requirements of GN, we need to put generated file names
in GN files. Please update
Due to the requirements of GN/GYP, we need to put generated file names `bindings/core/v8/generated.gni` and/or
in gni/gypi files. Please update `bindings/modules/v8/generated.gni` accordingly.
`bindings/core/v8/generated.{gni,gypi}` and/or
`bindings/modules/v8/generated.{gni,gypi}` accordingly.
...@@ -120,8 +120,7 @@ def write_content(content, output_file_name): ...@@ -120,8 +120,7 @@ def write_content(content, output_file_name):
def main(): def main():
options, filenames = parse_options() options, filenames = parse_options()
component = options.component component = options.component
idl_filenames = read_idl_files_list_from_file(filenames[0], idl_filenames = read_idl_files_list_from_file(filenames[0])
is_gyp_format=False)
basenames = [idl_filename_to_basename(file_path) basenames = [idl_filename_to_basename(file_path)
for file_path in idl_filenames] for file_path in idl_filenames]
file_contents = generate_content(component, basenames) file_contents = generate_content(component, basenames)
......
...@@ -101,8 +101,8 @@ def main(): ...@@ -101,8 +101,8 @@ def main():
for existing_interface_name_global_names for existing_interface_name_global_names
in read_pickle_files(options.global_objects_component_files)) in read_pickle_files(options.global_objects_component_files))
# Input IDL files are passed in a file, due to OS command line length # File paths of input IDL files are passed in a file, which is generated at
# limits. This is generated at GYP time, which is ok b/c files are static. # GN time. It is OK because the target IDL files themselves are static.
idl_files = read_file_to_list(options.idl_files_list) idl_files = read_file_to_list(options.idl_files_list)
interface_name_global_names.update( interface_name_global_names.update(
idl_files_to_interface_name_global_names(idl_files)) idl_files_to_interface_name_global_names(idl_files))
......
...@@ -347,7 +347,7 @@ def main(): ...@@ -347,7 +347,7 @@ def main():
options, _ = parse_options() options, _ = parse_options()
# IDL files are passed in a file, due to OS command line length limits # IDL files are passed in a file, due to OS command line length limits
idl_files = read_idl_files_list_from_file(options.idl_files_list, is_gyp_format=False) idl_files = read_idl_files_list_from_file(options.idl_files_list)
# Compute information for individual files # Compute information for individual files
# Information is stored in global variables interfaces_info and # Information is stored in global variables interfaces_info and
......
...@@ -153,14 +153,14 @@ def write_global_constructors_partial_interface(interface_name, idl_filename, co ...@@ -153,14 +153,14 @@ def write_global_constructors_partial_interface(interface_name, idl_filename, co
def main(): def main():
options, args = parse_options() options, args = parse_options()
# Input IDL files are passed in a file, due to OS command line length # File paths of input IDL files are passed in a file, which is generated at
# limits. This is generated at GYP time, which is ok b/c files are static. # GN time. It is OK because the target IDL files are static.
idl_files = read_file_to_list(options.idl_files_list) idl_files = read_file_to_list(options.idl_files_list)
# Output IDL files (to generate) are passed at the command line, since # Output IDL files (to generate) are passed at the command line, since
# these are in the build directory, which is determined at build time, not # these are in the build directory, which is determined at build time, not
# GYP time. # GN time.
# These are passed as pairs of GlobalObjectName, GlobalObject.idl # These are passed as pairs of GlobalObjectName, global_object.idl
interface_name_idl_filename = [(args[i], args[i + 1]) interface_name_idl_filename = [(args[i], args[i + 1])
for i in range(0, len(args), 2)] for i in range(0, len(args), 2)]
......
...@@ -43,9 +43,6 @@ def parse_options(): ...@@ -43,9 +43,6 @@ def parse_options():
parser = OptionParser(usage=usage) parser = OptionParser(usage=usage)
parser.add_option('--idl-files-list', parser.add_option('--idl-files-list',
help='a text file containing the IDL file paths, so the command line doesn\'t exceed OS length limits.') help='a text file containing the IDL file paths, so the command line doesn\'t exceed OS length limits.')
parser.add_option('--gyp-format-list', default=False, action='store_true',
help='if specified, idl-files-list is newline separated. ' +
'When unspecified, it\'s formatted as a Posix command line.')
parser.add_option('--output') parser.add_option('--output')
options, args = parser.parse_args() options, args = parser.parse_args()
...@@ -86,7 +83,7 @@ def extract_meta_data(file_paths): ...@@ -86,7 +83,7 @@ def extract_meta_data(file_paths):
def main(): def main():
options = parse_options() options = parse_options()
idl_file_names = read_idl_files_list_from_file(options.idl_files_list, is_gyp_format=options.gyp_format_list) idl_file_names = read_idl_files_list_from_file(options.idl_files_list)
meta_data_list = extract_meta_data(idl_file_names) meta_data_list = extract_meta_data(idl_file_names)
interface_names = ['V8%sPartial' % meta_data['basename'] interface_names = ['V8%sPartial' % meta_data['basename']
......
...@@ -220,7 +220,7 @@ def main(): ...@@ -220,7 +220,7 @@ def main():
opts.info_dir, opts.target_component) opts.info_dir, opts.target_component)
generator = ExternalReferenceTableGenerator(opts, info_provider) generator = ExternalReferenceTableGenerator(opts, info_provider)
idl_files = utilities.read_idl_files_list_from_file(opts.idl_files_list, False) idl_files = utilities.read_idl_files_list_from_file(opts.idl_files_list)
for idl_file in idl_files: for idl_file in idl_files:
generator.process_idl_file(idl_file) generator.process_idl_file(idl_file)
output_code = generator.generate() output_code = generator.generate()
......
...@@ -32,7 +32,7 @@ def parse_options(): ...@@ -32,7 +32,7 @@ def parse_options():
def main(): def main():
options, _ = parse_options() options, _ = parse_options()
idl_file_names = utilities.read_idl_files_list_from_file(options.idl_list_file, False) idl_file_names = utilities.read_idl_files_list_from_file(options.idl_list_file)
parser = blink_idl_parser.BlinkIDLParser() parser = blink_idl_parser.BlinkIDLParser()
collector = Collector(component=options.component, parser=parser) collector = Collector(component=options.component, parser=parser)
......
...@@ -178,8 +178,7 @@ def main(): ...@@ -178,8 +178,7 @@ def main():
if options.generate_impl or options.read_idl_list_from_file: if options.generate_impl or options.read_idl_list_from_file:
# |input_filename| should be a file which contains a list of IDL # |input_filename| should be a file which contains a list of IDL
# dictionary paths. # dictionary paths.
input_filenames = read_idl_files_list_from_file(input_filename, input_filenames = read_idl_files_list_from_file(input_filename)
is_gyp_format=True)
else: else:
input_filenames = [input_filename] input_filenames = [input_filename]
......
...@@ -281,19 +281,10 @@ def resolve_cygpath(cygdrive_names): ...@@ -281,19 +281,10 @@ def resolve_cygpath(cygdrive_names):
return idl_file_names return idl_file_names
def read_idl_files_list_from_file(filename, is_gyp_format): def read_idl_files_list_from_file(filename):
"""Similar to read_file_to_list, but also resolves cygpath. """Similar to read_file_to_list, but also resolves cygpath."""
If is_gyp_format is True, the file is treated as a newline-separated list
with no quoting or escaping. When False, the file is interpreted as a
Posix-style quoted and space-separated list."""
with open(filename) as input_file: with open(filename) as input_file:
if is_gyp_format: file_names = sorted(shlex.split(input_file))
file_names = sorted([os.path.realpath(line.rstrip('\n'))
for line in input_file])
else:
file_names = sorted(shlex.split(input_file))
idl_file_names = [file_name for file_name in file_names idl_file_names = [file_name for file_name in file_names
if not file_name.startswith('/cygdrive')] if not file_name.startswith('/cygdrive')]
cygdrive_names = [file_name for file_name in file_names cygdrive_names = [file_name for file_name in file_names
......
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