Commit 03665486 authored by Jarred Nicholls's avatar Jarred Nicholls
Browse files

<third_party/WebKit>: Prevent cl.exe crash on Windows


cl.exe does not like long relative include paths. In shadow builds that result
in large relative paths, some of the IDL binding include paths are too long
and often completely incorrect, specifically for IDL files that are generated
and are not sourced in the Blink repository. This patch resolves that problem
and makes the paths minimal for generated IDL bindings, preventing the cl.exe
fatal C1001 crash.

Change-Id: I912e2c8d2c4a6de79693c63ff5313958360cb42b
Reviewed-by: default avatarMichael Bruning <michael.bruning@digia.com>
No related merge requests found
Showing with 12 additions and 5 deletions
......@@ -49,7 +49,7 @@ import sys
from utilities import get_file_contents, read_file_to_list, idl_filename_to_interface_name, write_pickle_file, get_interface_extended_attributes_from_idl, is_callback_interface_from_idl, get_partial_interface_name_from_idl, get_implements_from_idl, get_parent_interface, get_put_forward_interfaces_from_idl
module_path = os.path.dirname(__file__)
module_path = os.path.abspath(os.path.dirname(__file__))
source_path = os.path.normpath(os.path.join(module_path, os.pardir, os.pardir))
# Global variables (filled in and exported)
......@@ -85,13 +85,20 @@ def parse_options():
# Computations
################################################################################
def include_path(idl_filename, implemented_as=None):
def include_path(idl_filename, component_dir, implemented_as=None):
"""Returns relative path to header file in POSIX format; used in includes.
POSIX format is used for consistency of output, so reference tests are
platform-independent.
"""
relative_path_local = os.path.relpath(idl_filename, source_path)
# Some IDL files are generated at build-time and are not sourced in the
# Blink repository. So to avoid incorrect and/or very long relative paths
# in our include_paths, we have to compute the relative path specially
# for these generated IDL files.
if idl_filename.startswith(source_path):
relative_path_local = os.path.relpath(idl_filename, source_path)
else:
relative_path_local = os.path.join(component_dir, os.path.basename(idl_filename))
relative_dir_local = os.path.dirname(relative_path_local)
relative_dir_posix = relative_dir_local.replace(os.path.sep, posixpath.sep)
......@@ -115,7 +122,7 @@ def compute_info_individual(idl_filename, component_dir):
extended_attributes = get_interface_extended_attributes_from_idl(idl_file_contents)
implemented_as = extended_attributes.get('ImplementedAs')
this_include_path = include_path(idl_filename, implemented_as)
this_include_path = include_path(idl_filename, component_dir, implemented_as)
# Handle partial interfaces
partial_interface_name = get_partial_interface_name_from_idl(idl_file_contents)
......@@ -181,7 +188,7 @@ def main():
# Information is stored in global variables interfaces_info and
# partial_interface_files.
for idl_filename in idl_files:
compute_info_individual(idl_filename, options.component_dir)
compute_info_individual(os.path.abspath(idl_filename), options.component_dir)
write_pickle_file(options.interfaces_info_file,
info_individual(),
......
Supports Markdown
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