def GenerateFromDatabase(common_database, dart2js_output_dir, dartium_output_dir, update_dom_metadata=False): current_dir = os.path.dirname(__file__) auxiliary_dir = os.path.join(current_dir, '..', 'src') template_dir = os.path.join(current_dir, '..', 'templates') generator = dartgenerator.DartGenerator() generator.LoadAuxiliary(auxiliary_dir) generator.FilterMembersWithUnidentifiedTypes(common_database) webkit_database = common_database.Clone() # Generate Dart interfaces for the WebKit DOM. generator.FilterInterfaces(database=webkit_database, or_annotations=['WebKit', 'Dart'], exclude_displaced=['WebKit'], exclude_suppressed=['WebKit', 'Dart']) generator.FixEventTargets(webkit_database) generator.AddMissingArguments(webkit_database) emitters = multiemitter.MultiEmitter() metadata = DartMetadata( os.path.join(current_dir, '..', 'dom.json'), os.path.join(current_dir, '..', 'docs', 'docs.json')) renamer = HtmlRenamer(webkit_database, metadata) type_registry = TypeRegistry(webkit_database, renamer) def RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory): options = GeneratorOptions(template_loader, webkit_database, type_registry, renamer, metadata) dart_library_emitter = DartLibraryEmitter(emitters, dart_output_dir, dart_libraries) event_generator = HtmlEventGenerator(webkit_database, renamer, metadata, template_loader) def generate_interface(interface): backend = backend_factory(interface) interface_generator = HtmlDartInterfaceGenerator( options, dart_library_emitter, event_generator, interface, backend) interface_generator.Generate() generator.Generate(webkit_database, common_database, generate_interface) dart_library_emitter.EmitLibraries(auxiliary_dir) if dart2js_output_dir: template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, { 'DARTIUM': False, 'DART2JS': True }) backend_options = GeneratorOptions(template_loader, webkit_database, type_registry, renamer, metadata) backend_factory = lambda interface:\ Dart2JSBackend(interface, backend_options) dart_output_dir = os.path.join(dart2js_output_dir, 'dart') dart_libraries = DartLibraries(HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir) RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory) if dartium_output_dir: template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, { 'DARTIUM': True, 'DART2JS': False }) backend_options = GeneratorOptions(template_loader, webkit_database, type_registry, renamer, metadata) cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) backend_factory = lambda interface:\ DartiumBackend(interface, cpp_library_emitter, backend_options) dart_output_dir = os.path.join(dartium_output_dir, 'dart') dart_libraries = DartLibraries(HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir) RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory) cpp_library_emitter.EmitDerivedSources( template_loader.Load('cpp_derived_sources.template'), dartium_output_dir) cpp_library_emitter.EmitResolver( template_loader.Load('cpp_resolver.template'), dartium_output_dir) cpp_library_emitter.EmitClassIdTable(webkit_database, dartium_output_dir, type_registry, renamer) emitters.Flush() if update_dom_metadata: metadata.Flush() monitored.FinishMonitoring(dart2js_output_dir)
def GenerateFromDatabase(common_database, dart2js_output_dir, update_dom_metadata=False, logging_level=logging.WARNING, dart_js_interop=False, nnbd=False): print '\n ----- Accessing DOM using %s -----\n' % ( 'dart:js' if dart_js_interop else 'C++') start_time = time.time() current_dir = os.path.dirname(__file__) if nnbd: auxiliary_dir = os.path.join(current_dir, '..', 'nnbd_src') else: auxiliary_dir = os.path.join(current_dir, '..', 'src') template_dir = os.path.join(current_dir, '..', 'templates') _logger.setLevel(logging_level) generator = dartgenerator.DartGenerator(logging_level) generator.LoadAuxiliary(auxiliary_dir) generator.FilterMembersWithUnidentifiedTypes(common_database) webkit_database = common_database.Clone() # Generate Dart interfaces for the WebKit DOM. generator.FilterInterfaces( database=webkit_database, or_annotations=['WebKit', 'Dart'], exclude_displaced=['WebKit'], exclude_suppressed=['WebKit', 'Dart']) generator.FixEventTargets(webkit_database) generator.AddMissingArguments(webkit_database) generator.CleanupOperationArguments(webkit_database) emitters = multiemitter.MultiEmitter(logging_level) metadata = DartMetadata( os.path.join(current_dir, '..', 'dom.json'), os.path.join(current_dir, '..', 'docs', 'docs.json'), logging_level) renamer = HtmlRenamer(webkit_database, metadata) type_registry = TypeRegistry(webkit_database, renamer) print 'GenerateFromDatabase %s seconds' % round( (time.time() - start_time), 2) def RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory, dart_js_interop): options = GeneratorOptions(template_loader, webkit_database, type_registry, renamer, metadata, dart_js_interop, nnbd) dart_library_emitter = DartLibraryEmitter(emitters, dart_output_dir, dart_libraries) event_generator = HtmlEventGenerator(webkit_database, renamer, metadata, template_loader) def generate_interface(interface, gl_constants=None): backend = backend_factory(interface) interface_generator = HtmlDartInterfaceGenerator( options, dart_library_emitter, event_generator, interface, backend) interface_generator.Generate() if len(backend._gl_constants) > 0 and not (gl_constants is None): gl_constants.extend(backend._gl_constants) generator.Generate(webkit_database, common_database, generate_interface) dart_library_emitter.EmitLibraries(auxiliary_dir, dart_js_interop) if dart2js_output_dir: template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, { 'DARTIUM': False, 'DART2JS': True, 'JSINTEROP': False, 'NNBD': nnbd }) backend_options = GeneratorOptions(template_loader, webkit_database, type_registry, renamer, metadata, dart_js_interop, nnbd) backend_factory = lambda interface:\ Dart2JSBackend(interface, backend_options, logging_level) dart_output_dir = os.path.join(dart2js_output_dir, 'dart') dart_libraries = DartLibraries(HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir, dart_js_interop) for file in generator._auxiliary_files.values(): if file.endswith('darttemplate'): dart_libraries._libraries['html'].AddFile(file) print '\nGenerating dart2js:\n' start_time = time.time() RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory, dart_js_interop) print 'Generated dart2js in %s seconds' % round( time.time() - start_time, 2) emitters.Flush() if update_dom_metadata: metadata.Flush() monitored.FinishMonitoring(dart2js_output_dir, _logger)
def Generate(systems, database_dir, use_database_cache, dom_output_dir, html_output_dir): current_dir = os.path.dirname(__file__) auxiliary_dir = os.path.join(current_dir, '..', 'src') template_dir = os.path.join(current_dir, '..', 'templates') generator = dartgenerator.DartGenerator() generator.LoadAuxiliary(auxiliary_dir) common_database = database.Database(database_dir) if use_database_cache: common_database.LoadFromCache() else: common_database.Load() generator.FilterMembersWithUnidentifiedTypes(common_database) webkit_database = common_database.Clone() # Generate Dart interfaces for the WebKit DOM. generator.FilterInterfaces(database=webkit_database, or_annotations=['WebKit', 'Dart'], exclude_displaced=['WebKit'], exclude_suppressed=['WebKit', 'Dart']) generator.RenameTypes(webkit_database, _webkit_renames, True) generator.FixEventTargets(webkit_database) emitters = multiemitter.MultiEmitter() for system in systems: if system in ['htmlfrog', 'htmldartium']: output_dir = html_output_dir interface_system = HtmlInterfacesSystem( TemplateLoader(template_dir, ['html/interface', 'html', '']), webkit_database, emitters, output_dir) else: output_dir = dom_output_dir interface_system = InterfacesSystem( TemplateLoader(template_dir, ['dom/interface', 'dom', '']), webkit_database, emitters, output_dir) if system == 'dummy': implementation_system = dartgenerator.DummyImplementationSystem( TemplateLoader(template_dir, ['dom/dummy', 'dom', '']), webkit_database, emitters, output_dir) elif system == 'frog': implementation_system = FrogSystem( TemplateLoader(template_dir, ['dom/frog', 'dom', '']), webkit_database, emitters, output_dir) elif system == 'htmlfrog': implementation_system = HtmlFrogSystem( TemplateLoader(template_dir, ['html/frog', 'html/impl', 'html', ''], { 'DARTIUM': False, 'FROG': True }), webkit_database, emitters, output_dir) elif system == 'htmldartium': # Generate native wrappers. native_system = NativeImplementationSystem( TemplateLoader(template_dir, ['dom/native', 'html/dartium', 'html/impl', ''], { 'DARTIUM': True, 'FROG': False }), webkit_database, emitters, output_dir) generator.Generate(webkit_database, native_system, source_filter=['WebKit', 'Dart'], super_database=common_database, common_prefix='common', webkit_renames=_webkit_renames) dom_implementation_classes = native_system.DartImplementationFiles( ) implementation_system = HtmlDartiumSystem( TemplateLoader(template_dir, ['html/dartium', 'html/impl', 'html', ''], { 'DARTIUM': True, 'FROG': False }), webkit_database, emitters, auxiliary_dir, dom_implementation_classes, output_dir) else: raise Exception('Unsupported system %s' % system) # Makes interface files available for listing in the library for the # implementation system. implementation_system._interface_system = interface_system for system in [interface_system, implementation_system]: generator.Generate(webkit_database, system, source_filter=['WebKit', 'Dart'], super_database=common_database, common_prefix='common', webkit_renames=_webkit_renames) _logger.info('Flush...') emitters.Flush()
def GenerateFromDatabase(common_database, dart2js_output_dir, dartium_output_dir, blink_output_dir, update_dom_metadata=False, logging_level=logging.WARNING, dart_js_interop=False): print '\n ----- Accessing DOM using %s -----\n' % ('dart:js' if dart_js_interop else 'C++') start_time = time.time() current_dir = os.path.dirname(__file__) auxiliary_dir = os.path.join(current_dir, '..', 'src') template_dir = os.path.join(current_dir, '..', 'templates') _logger.setLevel(logging_level) generator = dartgenerator.DartGenerator(logging_level) generator.LoadAuxiliary(auxiliary_dir) generator.FilterMembersWithUnidentifiedTypes(common_database) webkit_database = common_database.Clone() # Generate Dart interfaces for the WebKit DOM. generator.FilterInterfaces(database = webkit_database, or_annotations = ['WebKit', 'Dart'], exclude_displaced = ['WebKit'], exclude_suppressed = ['WebKit', 'Dart']) generator.FixEventTargets(webkit_database) generator.AddMissingArguments(webkit_database) generator.CleanupOperationArguments(webkit_database) emitters = multiemitter.MultiEmitter(logging_level) metadata = DartMetadata( os.path.join(current_dir, '..', 'dom.json'), os.path.join(current_dir, '..', 'docs', 'docs.json'), logging_level) renamer = HtmlRenamer(webkit_database, metadata) type_registry = TypeRegistry(webkit_database, renamer) print 'GenerateFromDatabase %s seconds' % round((time.time() - start_time), 2) def RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory, dart_js_interop): options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer, metadata, dart_js_interop) dart_library_emitter = DartLibraryEmitter( emitters, dart_output_dir, dart_libraries) event_generator = HtmlEventGenerator(webkit_database, renamer, metadata, template_loader) def generate_interface(interface): backend = backend_factory(interface) interface_generator = HtmlDartInterfaceGenerator( options, dart_library_emitter, event_generator, interface, backend) interface_generator.Generate() generator.Generate(webkit_database, common_database, generate_interface) dart_library_emitter.EmitLibraries(auxiliary_dir, dart_js_interop) if dart2js_output_dir: template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, {'DARTIUM': False, 'DART2JS': True, 'JSINTEROP': False}) backend_options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer, metadata, dart_js_interop) backend_factory = lambda interface:\ Dart2JSBackend(interface, backend_options, logging_level) dart_output_dir = os.path.join(dart2js_output_dir, 'dart') dart_libraries = DartLibraries( HTML_LIBRARY_NAMES, template_loader, 'dart2js', dart2js_output_dir, dart_js_interop) print '\nGenerating dart2js:\n' start_time = time.time() RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory, dart_js_interop) print 'Generated dart2js in %s seconds' % round(time.time() - start_time, 2) if dartium_output_dir: template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, {'DARTIUM': True, 'DART2JS': False, 'JSINTEROP': dart_js_interop}) backend_options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer, metadata, dart_js_interop) cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) dart_output_dir = os.path.join(dartium_output_dir, 'dart') backend_factory = lambda interface:\ DartiumBackend(interface, cpp_library_emitter, backend_options, _logger) dart_libraries = DartLibraries( HTML_LIBRARY_NAMES, template_loader, 'dartium', dartium_output_dir, dart_js_interop) print '\nGenerating dartium:\n' start_time = time.time() RunGenerator(dart_libraries, dart_output_dir, template_loader, backend_factory, dart_js_interop) print 'Generated dartium in %s seconds' % round(time.time() - start_time, 2) cpp_library_emitter.EmitDerivedSources( template_loader.Load('cpp_derived_sources.template'), dartium_output_dir) cpp_library_emitter.EmitResolver( template_loader.Load('cpp_resolver.template'), dartium_output_dir) cpp_library_emitter.EmitClassIdTable( webkit_database, dartium_output_dir, type_registry, renamer) emitters.Flush() if blink_output_dir: print '\nGenerating _blink:\n' start_time = time.time() Generate_Blink(blink_output_dir, webkit_database, type_registry) print 'Generated _blink in %s seconds' % round(time.time() - start_time, 2) if update_dom_metadata: metadata.Flush() monitored.FinishMonitoring(dart2js_output_dir, _logger)
def Generate(database_dir, use_database_cache, dart2js_output_dir=None, dartium_output_dir=None): current_dir = os.path.dirname(__file__) auxiliary_dir = os.path.join(current_dir, '..', 'src') template_dir = os.path.join(current_dir, '..', 'templates') generator = dartgenerator.DartGenerator() generator.LoadAuxiliary(auxiliary_dir) common_database = database.Database(database_dir) if use_database_cache: common_database.LoadFromCache() else: common_database.Load() generator.FilterMembersWithUnidentifiedTypes(common_database) webkit_database = common_database.Clone() # Generate Dart interfaces for the WebKit DOM. generator.FilterInterfaces(database = webkit_database, or_annotations = ['WebKit', 'Dart'], exclude_displaced = ['WebKit'], exclude_suppressed = ['WebKit', 'Dart']) generator.RenameTypes(webkit_database, _webkit_renames, True) generator.FixEventTargets(webkit_database) generator.AddMissingArguments(webkit_database) emitters = multiemitter.MultiEmitter() renamer = HtmlRenamer(webkit_database) type_registry = TypeRegistry(webkit_database, renamer) def RunGenerator(dart_library_template, dart_output_dir, dart_library_path, template_loader, backend_factory): options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer) dart_library_emitter = DartLibraryEmitter( emitters, dart_library_template, dart_output_dir) html_system = HtmlInterfacesSystem( options, dart_library_emitter, backend_factory) generator.Generate( webkit_database, html_system, common_database, _webkit_renames) dart_library_emitter.EmitLibrary(dart_library_path, auxiliary_dir) if dart2js_output_dir: template_paths = ['html/dart2js', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, {'DARTIUM': False, 'DART2JS': True}) backend_options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer) backend_factory = lambda interface:\ Dart2JSBackend(interface, backend_options) dart_library_template = template_loader.Load('html_dart2js.darttemplate') dart_output_dir = os.path.join(dart2js_output_dir, 'dart') dart_library_path = os.path.join(dart2js_output_dir, 'html_dart2js.dart') RunGenerator(dart_library_template, dart_output_dir, dart_library_path, template_loader, backend_factory) if dartium_output_dir: template_paths = ['html/dartium', 'html/impl', 'html/interface', ''] template_loader = TemplateLoader(template_dir, template_paths, {'DARTIUM': True, 'DART2JS': False}) backend_options = GeneratorOptions( template_loader, webkit_database, type_registry, renamer) cpp_output_dir = os.path.join(dartium_output_dir, 'cpp') cpp_library_emitter = CPPLibraryEmitter(emitters, cpp_output_dir) backend_factory = lambda interface:\ DartiumBackend(interface, cpp_library_emitter, backend_options) dart_library_template = template_loader.Load('html_dartium.darttemplate') dart_output_dir = os.path.join(dartium_output_dir, 'dart') dart_library_path = os.path.join(dartium_output_dir, 'html_dartium.dart') RunGenerator(dart_library_template, dart_output_dir, dart_library_path, template_loader, backend_factory) cpp_library_emitter.EmitDerivedSources( template_loader.Load('cpp_derived_sources.template'), dartium_output_dir) cpp_library_emitter.EmitResolver( template_loader.Load('cpp_resolver.template'), dartium_output_dir) _logger.info('Flush...') emitters.Flush()
def Generate(self, database, output_dir, module_source_preference=[], source_filter=None, super_database=None, common_prefix=None, super_map={}, html_map={}, lib_dir=None, systems=[]): """Generates Dart and JS files for the loaded interfaces. Args: database -- database containing interfaces to generate code for. output_dir -- directory to write generated files to. module_source_preference -- priority order list of source annotations to use when choosing a module name, if none specified uses the module name from the database. source_filter -- if specified, only outputs interfaces that have one of these source annotation and rewrites the names of superclasses not marked with this source to use the common prefix. super_database -- database containing super interfaces that the generated interfaces should extend. common_prefix -- prefix for the common library, if any. lib_file_path -- filename for generated .lib file, None if not required. lib_template -- template file in this directory for generated lib file. """ self._emitters = multiemitter.MultiEmitter() self._database = database self._output_dir = output_dir self._ComputeInheritanceClosure() self._systems = [] # TODO(jmesserly): only create these if needed if ('htmlfrog' in systems) or ('htmldartium' in systems): html_interface_system = HtmlInterfacesSystem( TemplateLoader(self._template_dir, ['html/interface', 'html', '']), self._database, self._emitters, self._output_dir, self) self._systems.append(html_interface_system) else: interface_system = InterfacesSystem( TemplateLoader(self._template_dir, ['dom/interface', 'dom', '']), self._database, self._emitters, self._output_dir) self._systems.append(interface_system) if 'native' in systems: native_system = NativeImplementationSystem( TemplateLoader(self._template_dir, ['dom/native', 'dom', '']), self._database, self._emitters, self._auxiliary_dir, self._output_dir) self._systems.append(native_system) if 'wrapping' in systems: wrapping_system = WrappingImplementationSystem( TemplateLoader(self._template_dir, ['dom/wrapping', 'dom', '']), self._database, self._emitters, self._output_dir) # Makes interface files available for listing in the library for the # wrapping implementation. wrapping_system._interface_system = interface_system self._systems.append(wrapping_system) if 'dummy' in systems: dummy_system = DummyImplementationSystem( TemplateLoader(self._template_dir, ['dom/dummy', 'dom', '']), self._database, self._emitters, self._output_dir) # Makes interface files available for listing in the library for the # dummy implementation. dummy_system._interface_system = interface_system self._systems.append(dummy_system) if 'frog' in systems: frog_system = FrogSystem( TemplateLoader(self._template_dir, ['dom/frog', 'dom', '']), self._database, self._emitters, self._output_dir) frog_system._interface_system = interface_system self._systems.append(frog_system) if 'htmlfrog' in systems: html_system = HtmlFrogSystem( TemplateLoader(self._template_dir, ['html/frog', 'html/impl', 'html', ''], { 'DARTIUM': False, 'FROG': True }), self._database, self._emitters, self._output_dir, self) html_system._interface_system = html_interface_system self._systems.append(html_system) if 'htmldartium' in systems: html_system = HtmlDartiumSystem( TemplateLoader(self._template_dir, ['html/dartium', 'html/impl', 'html', ''], { 'DARTIUM': True, 'FROG': False }), self._database, self._emitters, self._output_dir, self) html_system._interface_system = html_interface_system self._systems.append(html_system) # Collect interfaces interfaces = [] for interface in database.GetInterfaces(): if not MatchSourceFilter(source_filter, interface): # Skip this interface since it's not present in the required source _logger.info('Omitting interface - %s' % interface.id) continue interfaces.append(interface) # TODO(sra): Use this list of exception names to generate information to # tell Frog which exceptions can be passed from JS to Dart code. exceptions = self._CollectExceptions(interfaces) # Render all interfaces into Dart and save them in files. for interface in self._PreOrderInterfaces(interfaces): super_interface = None super_name = interface.id if super_name in super_map: super_name = super_map[super_name] if (super_database is not None and super_database.HasInterface(super_name)): super_interface = super_name interface_name = interface.id auxiliary_file = self._auxiliary_files.get(interface_name) if auxiliary_file is not None: _logger.info('Skipping %s because %s exists' % (interface_name, auxiliary_file)) continue info = RecognizeCallback(interface) if info: for system in self._systems: system.ProcessCallback(interface, info) else: if 'Callback' in interface.ext_attrs: _logger.info('Malformed callback: %s' % interface.id) self._ProcessInterface(interface, super_interface, source_filter, common_prefix) # Libraries if lib_dir: for system in self._systems: system.GenerateLibraries(lib_dir) for system in self._systems: system.Finish()
def classFactory(iface): # load TemplateLoader class from file TemplateLoader from templateloader import TemplateLoader return TemplateLoader(iface)
def Generate(self, database, output_dir, module_source_preference=[], source_filter=None, super_database=None, common_prefix=None, super_map={}, html_map={}, lib_dir=None, systems=[]): """Generates Dart and JS files for the loaded interfaces. Args: database -- database containing interfaces to generate code for. output_dir -- directory to write generated files to. module_source_preference -- priority order list of source annotations to use when choosing a module name, if none specified uses the module name from the database. source_filter -- if specified, only outputs interfaces that have one of these source annotation and rewrites the names of superclasses not marked with this source to use the common prefix. super_database -- database containing super interfaces that the generated interfaces should extend. common_prefix -- prefix for the common library, if any. lib_file_path -- filename for generated .lib file, None if not required. lib_template -- template file in this directory for generated lib file. """ self._emitters = multiemitter.MultiEmitter() self._database = database self._output_dir = output_dir self._FixEventTargets() self._ComputeInheritanceClosure() self._systems = [] # TODO(jmesserly): only create these if needed if ('gwtjso' in systems): jso_system = ElementalJsoSystem( TemplateLoader(self._template_dir, ['dom/jso', 'dom', '']), self._database, self._emitters, self._output_dir) self._systems.append(jso_system) if ('gwt' in systems): interface_system = ElementalInterfacesSystem( TemplateLoader(self._template_dir, ['dom/interface', 'dom', '']), self._database, self._emitters, self._output_dir) self._systems.append(interface_system) # if 'gwt' in systems: # elemental_system = ElementalSystem( # TemplateLoader(self._template_dir, ['dom/elemental', 'dom', '']), # self._database, self._emitters, self._output_dir) # elemental_system._interface_system = interface_system # self._systems.append(elemental_system) # Collect interfaces interfaces = [] for interface in database.GetInterfaces(): if not MatchSourceFilter(source_filter, interface): # Skip this interface since it's not present in the required source _logger.info('Omitting interface - %s' % interface.id) continue interfaces.append(interface) # TODO(sra): Use this list of exception names to generate information to # tell Frog which exceptions can be passed from JS to Dart code. exceptions = self._CollectExceptions(interfaces) mixins = self._ComputeMixins(self._PreOrderInterfaces(interfaces)) for system in self._systems: # give outputters a chance to see the mixin list before starting system.ProcessMixins(mixins) # copy all mixin methods from every interface to this base interface self.PopulateMixinBase(self._database.GetInterface('ElementalMixinBase'), mixins) # Render all interfaces into Dart and save them in files. for interface in self._PreOrderInterfaces(interfaces): super_interface = None super_name = interface.id if super_name in super_map: super_name = super_map[super_name] if (super_database is not None and super_database.HasInterface(super_name)): super_interface = super_name interface_name = interface.id auxiliary_file = self._auxiliary_files.get(interface_name) if auxiliary_file is not None: _logger.info('Skipping %s because %s exists' % ( interface_name, auxiliary_file)) continue info = RecognizeCallback(interface) if info: for system in self._systems: system.ProcessCallback(interface, info) else: if 'Callback' in interface.ext_attrs: _logger.info('Malformed callback: %s' % interface.id) self._ProcessInterface(interface, super_interface, source_filter, common_prefix) for system in self._systems: system.Finish()