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.
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
(See http://crbug.com/611437 why we need to avoid long file names).
Currently we use following alias(es).
```
CanvasRenderingContext2DOrWebGLRenderingContextOrWebGL2RenderingContextOrWebGL2ComputeRenderingContextOrImageBitmapRenderingContextOrXRPresentationContext -> RenderingContext
```
(See https://crbug.com/611437 why we need to avoid long file names).
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
include path is `bindings/modules/v8/FooOrBar.h`. Otherwise, the
include path is `bindings/core/v8/FooOrBar.h`. For example, given
used. If a union type is used only in IDL files under modules/, the
include path is `bindings/modules/v8/foo_or_bar.h`. Otherwise, the
include path is `bindings/core/v8/foo_or_bar.h`. For example, given
following definitions:
```webidl
// core/fileapi/FileReader.idl
// core/fileapi/file_reader.idl
readonly attribute (DOMString or ArrayBuffer)? result;
// dom/CommonDefinitions.idl
// dom/common_definitions.idl
typedef (ArrayBuffer or ArrayBufferView) BufferSource;
// modules/encoding/TextDecoder.idl
// modules/encoding/text_decoder.idl
DOMString decode(optional BufferSource input, optional TextDecodeOptions options);
// modules/fetch/Request.idl
// modules/fetch/request.idl
typedef (Request or USVString) RequestInfo;
```
The include paths will be:
- bindings/core/v8/StringOrArrayBuffer.h
- bindings/core/v8/ArrayBufferOrArrayBufferView.h
- bindings/modules/v8/RequestOrUSVString.h
- bindings/core/v8/string_or_array_buffer.h
- bindings/core/v8/array_buffer_or_array_buffer_view.h
- bindings/modules/v8/request_or_usv_string.h
Note that `ArrayBufferOrArrayBufferView` is located under core/ even
it is used by `Request.idl` which is located under modules/.
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/.
**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
to update the include path for the union type under modules/.
## Updating GN/GYP files
TODO(bashi): Mitigate the pain of updating GN/GYP files.
Due to the requirements of GN/GYP, we need to put generated file names
in gni/gypi files. Please update
`bindings/core/v8/generated.{gni,gypi}` and/or
`bindings/modules/v8/generated.{gni,gypi}` accordingly.
## Updating GN files
Due to the requirements of GN, we need to put generated file names
in GN files. Please update
`bindings/core/v8/generated.gni` and/or
`bindings/modules/v8/generated.gni` accordingly.
......@@ -120,8 +120,7 @@ def write_content(content, output_file_name):
def main():
options, filenames = parse_options()
component = options.component
idl_filenames = read_idl_files_list_from_file(filenames[0],
is_gyp_format=False)
idl_filenames = read_idl_files_list_from_file(filenames[0])
basenames = [idl_filename_to_basename(file_path)
for file_path in idl_filenames]
file_contents = generate_content(component, basenames)
......
......@@ -101,8 +101,8 @@ def main():
for existing_interface_name_global_names
in read_pickle_files(options.global_objects_component_files))
# Input IDL files are passed in a file, due to OS command line length
# limits. This is generated at GYP time, which is ok b/c files are static.
# File paths of input IDL files are passed in a file, which is generated at
# GN time. It is OK because the target IDL files themselves are static.
idl_files = read_file_to_list(options.idl_files_list)
interface_name_global_names.update(
idl_files_to_interface_name_global_names(idl_files))
......
......@@ -347,7 +347,7 @@ def main():
options, _ = parse_options()
# 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
# Information is stored in global variables interfaces_info and
......
......@@ -153,14 +153,14 @@ def write_global_constructors_partial_interface(interface_name, idl_filename, co
def main():
options, args = parse_options()
# Input IDL files are passed in a file, due to OS command line length
# limits. This is generated at GYP time, which is ok b/c files are static.
# File paths of input IDL files are passed in a file, which is generated at
# GN time. It is OK because the target IDL files are static.
idl_files = read_file_to_list(options.idl_files_list)
# 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
# GYP time.
# These are passed as pairs of GlobalObjectName, GlobalObject.idl
# GN time.
# These are passed as pairs of GlobalObjectName, global_object.idl
interface_name_idl_filename = [(args[i], args[i + 1])
for i in range(0, len(args), 2)]
......
......@@ -43,9 +43,6 @@ def parse_options():
parser = OptionParser(usage=usage)
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.')
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')
options, args = parser.parse_args()
......@@ -86,7 +83,7 @@ def extract_meta_data(file_paths):
def main():
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)
interface_names = ['V8%sPartial' % meta_data['basename']
......
......@@ -220,7 +220,7 @@ def main():
opts.info_dir, opts.target_component)
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:
generator.process_idl_file(idl_file)
output_code = generator.generate()
......
......@@ -32,7 +32,7 @@ def parse_options():
def main():
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()
collector = Collector(component=options.component, parser=parser)
......
......@@ -178,8 +178,7 @@ def main():
if options.generate_impl or options.read_idl_list_from_file:
# |input_filename| should be a file which contains a list of IDL
# dictionary paths.
input_filenames = read_idl_files_list_from_file(input_filename,
is_gyp_format=True)
input_filenames = read_idl_files_list_from_file(input_filename)
else:
input_filenames = [input_filename]
......
......@@ -281,19 +281,10 @@ def resolve_cygpath(cygdrive_names):
return idl_file_names
def read_idl_files_list_from_file(filename, is_gyp_format):
"""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."""
def read_idl_files_list_from_file(filename):
"""Similar to read_file_to_list, but also resolves cygpath."""
with open(filename) as input_file:
if is_gyp_format:
file_names = sorted([os.path.realpath(line.rstrip('\n'))
for line in input_file])
else:
file_names = sorted(shlex.split(input_file))
file_names = sorted(shlex.split(input_file))
idl_file_names = [file_name for file_name in file_names
if not file_name.startswith('/cygdrive')]
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