def main():
    options, args = parse_options()

    # 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
    # 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)]

    interface_name_to_global_names.update(read_pickle_file(options.global_objects_file))

    for idl_filename in idl_files:
        record_global_constructors(idl_filename)

    # Check for [Exposed] / [Global] mismatch.
    known_global_names = EXPOSED_EXECUTION_CONTEXT_METHOD.keys()
    exposed_global_names = frozenset(global_name_to_constructors)
    if not exposed_global_names.issubset(known_global_names):
        unknown_global_names = exposed_global_names.difference(known_global_names)
        raise ValueError('The following global names were used in '
                         '[Exposed=xxx] but do not match any global names: %s'
                         % list(unknown_global_names))

    # Write partial interfaces containing constructor attributes for each
    # global interface.
    for interface_name, idl_filename in interface_name_idl_filename:
        constructors = interface_name_to_constructors(interface_name)
        write_global_constructors_partial_interface(
            interface_name, idl_filename, constructors)
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.
    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
    interface_name_idl_filename = [(args[i], args[i + 1])
                                   for i in range(0, len(args), 2)]

    interface_name_to_global_names.update(read_pickle_file(options.global_objects_file))

    for idl_filename in idl_files:
        record_global_constructors(idl_filename)

    # Check for [Exposed] / [Global] mismatch.
    known_global_names = EXPOSED_EXECUTION_CONTEXT_METHOD.keys()
    exposed_global_names = frozenset(global_name_to_constructors)
    if not exposed_global_names.issubset(known_global_names):
        unknown_global_names = exposed_global_names.difference(known_global_names)
        raise ValueError('The following global names were used in '
                         '[Exposed=xxx] but do not match any [Global] / '
                         '[PrimaryGlobal] interface: %s'
                         % list(unknown_global_names))

    # Write partial interfaces containing constructor attributes for each
    # global interface.
    for interface_name, idl_filename in interface_name_idl_filename:
        constructors = interface_name_to_constructors(interface_name)
        write_global_constructors_partial_interface(
            interface_name, idl_filename, constructors)
Esempio n. 3
0
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.
    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
    interface_name_idl_filename = [(args[i], args[i + 1])
                                   for i in range(0, len(args), 2)]

    interface_name_to_global_names.update(read_pickle_file(options.global_objects_file))

    for idl_filename in idl_files:
        record_global_constructors(idl_filename)

    # Check for [Exposed] / [Global] mismatch.
    known_global_names = EXPOSED_EXECUTION_CONTEXT_METHOD.keys()
    exposed_global_names = frozenset(global_name_to_constructors)
    if not exposed_global_names.issubset(known_global_names):
        unknown_global_names = exposed_global_names.difference(known_global_names)
        raise ValueError('The following global names were used in '
                         '[Exposed=xxx] but do not match any [Global] / '
                         '[PrimaryGlobal] interface: %s'
                         % list(unknown_global_names))

    # Write partial interfaces containing constructor attributes for each
    # global interface.
    for interface_name, idl_filename in interface_name_idl_filename:
        # Work around gyp's path relativization for this parameter that is not
        # a path, but gets interpreted as such.
        interface_name = os.path.basename(interface_name)
        constructors = interface_name_to_constructors(interface_name)
        write_global_constructors_partial_interface(
            interface_name, idl_filename, constructors)