def main(): options = parse_options() event_idl_files = read_file_to_list(options.event_idl_files_list) write_event_interfaces_file(event_idl_files, options.event_interfaces_file, options.write_file_only_if_changed, options.suffix)
def test_get_definitions(self): pathfile = utilities.read_file_to_list(_FILE) pathfile = [ os.path.join(testdata_path, filename) for filename in pathfile ] for actual in collect_idls_into_json.get_definitions(pathfile): self.assertEqual(actual.GetName(), self.definition.GetName())
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)
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() # args = Input1, Input2, ..., Output output_global_objects_filename = args.pop() interface_name_global_names = dict_union( existing_interface_name_global_names for existing_interface_name_global_names in read_pickle_files(args) ) # 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) interface_name_global_names.update(idl_files_to_interface_name_global_names(idl_files)) write_pickle_file(output_global_objects_filename, interface_name_global_names, options.write_file_only_if_changed)
def main(): options, args = parse_options() output_global_objects_filename = args.pop() interface_name_global_names = dict_union( existing_interface_name_global_names 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. idl_files = read_file_to_list(options.idl_files_list) interface_name_global_names.update( idl_files_to_interface_name_global_names(idl_files)) write_pickle_file(output_global_objects_filename, interface_name_global_names)
def main(): options, args = parse_options() output_global_objects_filename = args.pop() interface_name_global_names = dict_union( existing_interface_name_global_names for existing_interface_name_global_names in read_pickle_files( options.global_objects_component_files)) # 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)) write_pickle_file(output_global_objects_filename, interface_name_global_names)
def main(): options, args = parse_options() # Static IDL files are passed in a file (generated at GYP time), due to OS # command line length limits idl_files = read_file_to_list(options.idl_files_list) # Generated IDL files are passed at the command line, since these are in the # build directory, which is determined at build time, not GYP time, so these # cannot be included in the file listing static files idl_files.extend(args) # Compute information for individual files # 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) write_pickle_file(options.interfaces_info_file, info_individual(), options.write_file_only_if_changed)
def main(args): if len(args) != 2: usage() exit(1) path_file = args[0] json_file = args[1] path_list = utilities.read_file_to_list(path_file) implement_node_list = [definition for definition in get_definitions(path_list) if is_implements(definition)] interfaces_dict = {definition.GetName(): interface_node_to_dict(definition) for definition in get_definitions(path_list) if not is_partial(definition)} partials_dict = {definition.GetName(): interface_node_to_dict(definition) for definition in get_definitions(path_list) if is_partial(definition)} dictionary = merge_partial_dicts(interfaces_dict, partials_dict) interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list) export_to_jsonfile(dictionary, json_file)
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)] with open(options.global_objects_file) as global_objects_file: interface_name_to_global_names.update(pickle.load(global_objects_file)) for idl_filename in idl_files: record_global_constructors(idl_filename) # Check for [Exposed] / [Global] mismatch. known_global_names = frozenset( itertools.chain.from_iterable(interface_name_to_global_names.values())) 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, options.write_file_only_if_changed)
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)
def main(args): if len(args) != 2: usage() exit(1) path_file = args[0] json_file = args[1] path_list = utilities.read_file_to_list(path_file) implement_node_list = [ definition for definition in get_definitions(path_list) if is_implements(definition) ] interfaces_dict = { definition.GetName(): interface_node_to_dict(definition) for definition in get_definitions(path_list) if not is_partial(definition) } partials_dict = { definition.GetName(): interface_node_to_dict(definition) for definition in get_definitions(path_list) if is_partial(definition) } dictionary = merge_partial_dicts(interfaces_dict, partials_dict) interfaces_dict = merge_implement_nodes(interfaces_dict, implement_node_list) export_to_jsonfile(dictionary, json_file)
def setUp(self): parser = BlinkIDLParser() path = utilities.read_file_to_list(_FILE)[0] definitions = parse_file(parser, path) self.definition = definitions.GetChildren()[0]
def test_get_definitions(self): pathfile = utilities.read_file_to_list(_FILE) for actual in collect_idls_into_json.get_definitions(pathfile): self.assertEqual(actual.GetName(), self.definition.GetName())
def setUp(self): parser = BlinkIDLParser() path = os.path.join( testdata_path, utilities.read_file_to_list(_FILE)[0]) definitions = parse_file(parser, path) self.definition = definitions.GetChildren()[0]
def test_get_definitions(self): pathfile = utilities.read_file_to_list(_FILE) pathfile = [os.path.join(testdata_path, filename) for filename in pathfile] for actual in collect_idls_into_json.get_definitions(pathfile): self.assertEqual(actual.GetName(), self.definition.GetName())