Пример #1
0
def build_database(idl_files,
                   database_dir,
                   feature_defines=None,
                   parallel=False):
    """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
    current_dir = os.path.dirname(__file__)
    logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

    db = database.Database(database_dir)

    # Delete all existing IDLs in the DB.
    db.Delete()

    builder = databasebuilder.DatabaseBuilder(db)

    # TODO(vsm): Move this to a README.
    # This is the Dart SVN revision.
    webkit_revision = '1060'

    # TODO(vsm): Reconcile what is exposed here and inside WebKit code
    # generation.  We need to recheck this periodically for now.
    webkit_defines = ['LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT']
    if feature_defines is None:
        feature_defines = DEFAULT_FEATURE_DEFINES

    webkit_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.WEBKIT_SYNTAX,
        # TODO(vsm): What else should we define as on when processing IDL?
        idl_defines=webkit_defines + feature_defines,
        source='WebKit',
        source_attributes={'revision': webkit_revision})

    # Import WebKit IDLs.
    builder.import_idl_files(idl_files, webkit_options, parallel)

    # Import Dart idl:
    dart_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.FREMONTCUT_SYNTAX,
        source='Dart',
        rename_operation_arguments_on_merge=True)

    builder.import_idl_files(
        [os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl')],
        dart_options, parallel)

    # Merging:
    builder.merge_imported_interfaces()

    builder.fetch_constructor_data(webkit_options)
    builder.fix_displacements('WebKit')

    # Cleanup:
    builder.normalize_annotations(['WebKit', 'Dart'])

    db.Save()
    return db
Пример #2
0
def build_database(idl_files,
                   database_dir,
                   feature_defines=None,
                   logging_level=logging.WARNING,
                   examine_idls=False):
    """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
    current_dir = os.path.dirname(__file__)
    logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

    _logger.setLevel(logging_level)

    db = database.Database(database_dir)

    # Delete all existing IDLs in the DB.
    db.Delete()

    builder = databasebuilder.DatabaseBuilder(db)
    dependency.set_builder(builder)

    # TODO(vsm): Move this to a README.
    # This is the Chrome revision.
    webkit_revision = '63'

    # TODO(vsm): Reconcile what is exposed here and inside WebKit code
    # generation.  We need to recheck this periodically for now.
    webkit_defines = ['LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT']

    if feature_defines is None:
        feature_defines = FEATURE_DEFINES

    webkit_options = databasebuilder.DatabaseBuilderOptions(
        # TODO(vsm): What else should we define as on when processing IDL?
        idl_defines=webkit_defines + feature_defines,
        source='WebKit',
        source_attributes={'revision': webkit_revision},
        logging_level=logging_level)

    # Import WebKit IDLs.
    builder.import_idl_files(idl_files, webkit_options, False)

    # Import Dart idl:
    dart_options = databasebuilder.DatabaseBuilderOptions(
        source='Dart',
        rename_operation_arguments_on_merge=True,
        logging_level=logging_level)

    utilities.KNOWN_COMPONENTS = frozenset(['core', 'modules', 'dart'])

    builder.import_idl_files(
        [os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl')],
        dart_options, True)

    start_time = time.time()

    # All typedefs MUST be resolved here before any database fixups (merging, implements, etc.)
    ResolveAllTypedefs(builder._imported_interfaces)

    # Merging:
    builder.merge_imported_interfaces()

    builder.fetch_constructor_data(webkit_options)
    builder.fix_displacements('WebKit')

    # Cleanup:
    builder.normalize_annotations(['WebKit', 'Dart'])

    # Map any IDL defined dictionaries to Dictionary.
    builder.map_dictionaries()

    # Examine all IDL and produce a diagnoses of areas (e.g., list dictionaries
    # declared and usage, etc.)
    if examine_idls:
        builder.examine_database()

    conditionals_met = set(
        'ENABLE_' + conditional for conditional in builder.conditionals_met)
    known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED)

    unused_conditionals = known_conditionals - conditionals_met
    if unused_conditionals:
        _logger.warning('There are some unused conditionals %s' %
                        sorted(unused_conditionals))
        _logger.warning('Please update fremontcutbuilder.py')

    unknown_conditionals = conditionals_met - known_conditionals
    if unknown_conditionals:
        _logger.warning('There are some unknown conditionals %s' %
                        sorted(unknown_conditionals))
        _logger.warning('Please update fremontcutbuilder.py')

    print('Merging interfaces %s seconds' % round(time.time() - start_time, 2))

    return db
def build_database(idl_files, database_dir, feature_defines=None):
    """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
    current_dir = os.path.dirname(__file__)
    logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

    db = database.Database(database_dir)

    # Delete all existing IDLs in the DB.
    db.Delete()

    builder = databasebuilder.DatabaseBuilder(db)

    # TODO(vsm): Move this to a README.
    # This is the Dart SVN revision.
    webkit_revision = '1060'

    # TODO(vsm): Reconcile what is exposed here and inside WebKit code
    # generation.  We need to recheck this periodically for now.
    webkit_defines = ['LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT']
    if feature_defines is None:
        feature_defines = DEFAULT_FEATURE_DEFINES

    webkit_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.WEBKIT_SYNTAX,
        # TODO(vsm): What else should we define as on when processing IDL?
        idl_defines=[
            define for define in webkit_defines + feature_defines
            if define not in UNSUPPORTED_FEATURES
        ],
        source='WebKit',
        source_attributes={'revision': webkit_revision},
        type_rename_map={
            'BarInfo': 'BarProp',
            'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope',
            'DOMApplicationCache': 'ApplicationCache',
            'DOMCoreException': 'DOMException',
            'DOMFormData': 'FormData',
            'DOMSelection': 'Selection',
            'DOMWindow': 'Window',
            'SharedWorkerContext': 'SharedWorkerGlobalScope',
            'WorkerContext': 'WorkerGlobalScope',
        })

    optional_argument_whitelist = [
        ('CSSStyleDeclaration', 'setProperty', 'priority'),
        ('IDBDatabase', 'transaction', 'mode'),
    ]

    # Import WebKit IDLs.
    for file_name in idl_files:
        builder.import_idl_file(file_name, webkit_options)

    # Import Dart idl:
    dart_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.FREMONTCUT_SYNTAX,
        source='Dart',
        rename_operation_arguments_on_merge=True)

    builder.import_idl_file(
        os.path.join(current_dir, '..', 'elemental', 'elemental.idl'),
        dart_options)

    # Merging:
    builder.merge_imported_interfaces(optional_argument_whitelist)

    builder.fix_displacements('WebKit')

    # Cleanup:
    builder.normalize_annotations(['WebKit', 'Dart'])

    db.Save()
Пример #4
0
def main():
    """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
    current_dir = os.path.dirname(__file__)
    logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

    db = database.Database(os.path.join(current_dir, '..', 'database'))

    # Delete all existing IDLs in the DB.
    db.Delete()

    builder = databasebuilder.DatabaseBuilder(db)

    # Import WebKit IDL files:
    webkit_dirs = [
        'css',
        'dom',
        'fileapi',
        'html',
        'html/canvas',
        'inspector',
        'loader',
        'loader/appcache',
        'notifications',
        'page',
        'plugins',
        'storage',
        'svg',
        'webaudio',
        'websockets',
        'workers',
        'xml',
    ]
    # TODO(vsm): Move this to a README.
    # This is the Dart SVN revision.
    webkit_revision = '1060'

    # TODO(vsm): Reconcile what is exposed here and inside WebKit code
    # generation.
    webkit_defines = [
        'LANGUAGE_DART',
        'LANGUAGE_JAVASCRIPT',
        'ENABLE_DOM_STORAGE',
        'ENABLE_FILE_SYSTEM',
        'ENABLE_FULLSCREEN_API',
        'ENABLE_NOTIFICATIONS',
        'ENABLE_OFFLINE_WEB_APPLICATIONS',
        'ENABLE_REQUEST_ANIMATION_FRAME',
        'ENABLE_WEB_TIMING',
    ]
    webkit_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.WEBKIT_SYNTAX,
        # TODO(vsm): What else should we define as on when processing IDL?
        idl_defines=webkit_defines,
        source='WebKit',
        source_attributes={'revision': webkit_revision},
        type_rename_map={
            'float': 'double',
            'BarInfo': 'BarProp',
            'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope',
            'DOMApplicationCache': 'ApplicationCache',
            'DOMCoreException': 'DOMException',
            'DOMFormData': 'FormData',
            'DOMObject': 'object',
            'DOMSelection': 'Selection',
            'DOMWindow': 'Window',
            'SharedWorkerContext': 'SharedWorkerGlobalScope',
            'WorkerContext': 'WorkerGlobalScope',
        })

    optional_argument_whitelist = [
        ('CSSStyleDeclaration', 'setProperty', 'priority'),
    ]

    for dir_name in webkit_dirs:
        dir_path = os.path.join(current_dir, '..', '..', '..', '..',
                                'third_party', 'WebKit', 'Source', 'WebCore',
                                dir_name)
        builder.import_idl_directory(dir_path, webkit_options)

    webkit_supplemental_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.FREMONTCUT_SYNTAX,
        source='WebKit',
        rename_operation_arguments_on_merge=True)
    builder.import_idl_file(
        os.path.join(current_dir, '..', 'idl', 'dart',
                     'webkit-supplemental.idl'), webkit_supplemental_options)

    # Import Dart idl:
    dart_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.FREMONTCUT_SYNTAX,
        source='Dart',
        rename_operation_arguments_on_merge=True)

    builder.import_idl_file(
        os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'),
        dart_options)

    builder.set_same_signatures({
        'EventListener': 'Function',
        'int': 'long',
    })

    # Merging:
    builder.merge_imported_interfaces(optional_argument_whitelist)

    builder.fix_displacements('WebKit')

    # Cleanup:
    builder.normalize_annotations(['WebKit', 'Dart'])

    db.Save()
Пример #5
0
def build_database(idl_files,
                   database_dir,
                   feature_defines=None,
                   parallel=False,
                   blink_parser=False,
                   logging_level=logging.WARNING):
    """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
    current_dir = os.path.dirname(__file__)
    logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

    _logger.setLevel(logging_level)

    db = database.Database(database_dir)

    # Delete all existing IDLs in the DB.
    db.Delete()

    builder = databasebuilder.DatabaseBuilder(db)

    # TODO(vsm): Move this to a README.
    # This is the Dart SVN revision.
    webkit_revision = '1060'

    # TODO(vsm): Reconcile what is exposed here and inside WebKit code
    # generation.  We need to recheck this periodically for now.
    webkit_defines = ['LANGUAGE_DART', 'LANGUAGE_JAVASCRIPT']

    if feature_defines is None:
        feature_defines = FEATURE_DEFINES

    webkit_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.WEBKIT_SYNTAX,
        # TODO(vsm): What else should we define as on when processing IDL?
        idl_defines=webkit_defines + feature_defines,
        source='WebKit',
        source_attributes={'revision': webkit_revision},
        logging_level=logging_level)

    # Import WebKit IDLs.
    builder.import_idl_files(idl_files, webkit_options, parallel, blink_parser,
                             False)

    # Import Dart idl:
    dart_options = databasebuilder.DatabaseBuilderOptions(
        idl_syntax=idlparser.FREMONTCUT_SYNTAX,
        source='Dart',
        rename_operation_arguments_on_merge=True,
        logging_level=logging_level)

    builder.import_idl_files(
        [os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl')],
        dart_options, parallel, blink_parser, True)

    start_time = time.time()

    # Merging:
    builder.merge_imported_interfaces(blink_parser)

    builder.fetch_constructor_data(webkit_options)
    builder.fix_displacements('WebKit')

    # Cleanup:
    builder.normalize_annotations(['WebKit', 'Dart'])

    conditionals_met = set('ENABLE_' + conditional
                           for conditional in builder.conditionals_met)
    known_conditionals = set(FEATURE_DEFINES + FEATURE_DISABLED)

    unused_conditionals = known_conditionals - conditionals_met
    if unused_conditionals:
        _logger.warning('There are some unused conditionals %s' %
                        sorted(unused_conditionals))
        _logger.warning('Please update fremontcutbuilder.py')

    unknown_conditionals = conditionals_met - known_conditionals
    if unknown_conditionals:
        _logger.warning('There are some unknown conditionals %s' %
                        sorted(unknown_conditionals))
        _logger.warning('Please update fremontcutbuilder.py')

    print 'Merging interfaces %s seconds' % round(time.time() - start_time, 2)

    # TODO(terry): Don't generate the database cache.
    #  db.Save()

    return db
Пример #6
0
def main():
  """This code reconstructs the FremontCut IDL database from W3C,
  WebKit and Dart IDL files."""
  current_dir = os.path.dirname(__file__)
  logging.config.fileConfig(os.path.join(current_dir, "logging.conf"))

  db = database.Database(os.path.join(current_dir, '..', 'database'))

  # Delete all existing IDLs in the DB.
  db.Delete()

  builder = databasebuilder.DatabaseBuilder(db)

  # Import WebKit IDL files:
  webkit_dirs = [
      'Modules/speech',
      'Modules/indexeddb',
      'css',
      'dom',
      'fileapi',
      'Modules/filesystem',
      'html',
      'html/canvas',
      'inspector',
      'loader',
      'loader/appcache',
      'Modules/mediastream',
      'Modules/geolocation',
      'notifications',
      'page',
      'plugins',
      'storage',
      'Modules/webdatabase',
      'svg',
      'Modules/webaudio',
      'Modules/websockets',
      'workers',
      'xml',
      ]

  # TODO(vsm): Move this to a README.
  # This is the Dart SVN revision.
  webkit_revision = '1060'

  # TODO(vsm): Reconcile what is exposed here and inside WebKit code
  # generation.  We need to recheck this periodically for now.
  webkit_defines = [
      'LANGUAGE_DART',
      'LANGUAGE_JAVASCRIPT',

      # Enabled Chrome WebKit build.
      'ENABLE_3D_PLUGIN',
      'ENABLE_3D_RENDERING',
      'ENABLE_ACCELERATED_2D_CANVAS',
      'ENABLE_BLOB',
      'ENABLE_BLOB_SLICE',
      'ENABLE_CHANNEL_MESSAGING',
      'ENABLE_CLIENT_BASED_GEOLOCATION',
      'ENABLE_DATA_TRANSFER_ITEMS',
      'ENABLE_DETAILS',
      'ENABLE_DEVICE_ORIENTATION',
      'ENABLE_DIRECTORY_UPLOAD',
      'ENABLE_DOWNLOAD_ATTRIBUTE',
      'ENABLE_FILE_SYSTEM',
      'ENABLE_FILTERS',
      'ENABLE_FULLSCREEN_API',
      'ENABLE_GAMEPAD',
      'ENABLE_GEOLOCATION',
      'ENABLE_GESTURE_EVENTS',
      'ENABLE_GESTURE_RECOGNIZER',
      'ENABLE_INDEXED_DATABASE',
      'ENABLE_INPUT_SPEECH',
      'ENABLE_JAVASCRIPT_DEBUGGER',
      'ENABLE_JAVASCRIPT_I18N_API',
      'ENABLE_LINK_PREFETCH',
      'ENABLE_MEDIA_SOURCE',
      'ENABLE_MEDIA_STATISTICS',
      'ENABLE_MEDIA_STREAM',
      'ENABLE_METER_TAG',
      'ENABLE_MHTML',
      'ENABLE_MOUSE_LOCK_API',
      'ENABLE_NOTIFICATIONS',
      'ENABLE_PAGE_VISIBILITY_API',
      'ENABLE_PROGRESS_TAG',
      'ENABLE_QUOTA',
      'ENABLE_REGISTER_PROTOCOL_HANDLER',
      'ENABLE_REQUEST_ANIMATION_FRAME',
      'ENABLE_RUBY',
      'ENABLE_SANDBOX',
      'ENABLE_SCRIPTED_SPEECH',
      'ENABLE_SHADOW_DOM',
      'ENABLE_SHARED_WORKERS',
      'ENABLE_SMOOTH_SCROLLING',
      'ENABLE_SPEECH_RECOGNITION',
      'ENABLE_SQL_DATABASE',
      'ENABLE_SVG',
      'ENABLE_SVG_FONTS',
      'ENABLE_TOUCH_EVENTS',
      'ENABLE_V8_SCRIPT_DEBUG_SERVER',
      'ENABLE_VIDEO',
      'ENABLE_VIDEO_TRACK',
      'ENABLE_WEBGL',
      'ENABLE_WEB_AUDIO',
      'ENABLE_WEB_SOCKETS',
      'ENABLE_WEB_TIMING',
      'ENABLE_WORKERS',
      'ENABLE_XHR_RESPONSE_BLOB',
      'ENABLE_XSLT',
      ]
  webkit_options = databasebuilder.DatabaseBuilderOptions(
      idl_syntax=idlparser.WEBKIT_SYNTAX,
# TODO(vsm): What else should we define as on when processing IDL?
      idl_defines=webkit_defines,
      source='WebKit',
      source_attributes={'revision': webkit_revision},
      type_rename_map={
        # Some of these are typos in the IDL.
        'float': 'double',
        'BarInfo': 'BarProp',
        'DedicatedWorkerContext': 'DedicatedWorkerGlobalScope',
        'DOMApplicationCache': 'ApplicationCache',
        'DOMCoreException': 'DOMException',
        'DOMExceptionJSC': 'DOMException', # Node.replaceChild
        'DomException': 'DOMException',    # Navigator.registerProtocolHandler
        'DOMFormData': 'FormData',
        'DOMObject': 'object',
        'DOMSelection': 'Selection',
        'DOMWindow': 'Window',
        'Exception': 'DOMException',     # NotificationCenter.createNotification
        'SharedWorkerContext': 'SharedWorkerGlobalScope',
        'WorkerContext': 'WorkerGlobalScope',
      })

  optional_argument_whitelist = [
      ('CSSStyleDeclaration', 'setProperty', 'priority'),
      ('IDBDatabase', 'transaction', 'mode'),
      ]

  # Assume standard Dart checkout.
  webcore_path = os.path.join(current_dir, '..', '..', '..',
                              'third_party', 'WebCore')

  if not os.path.exists(webcore_path):
    # Dartium checkout.
    webcore_path = os.path.join(current_dir, '..', '..', '..', '..',
                                'third_party', 'WebKit', 'Source', 'WebCore')

  for dir_name in webkit_dirs:
    dir_path = os.path.join(webcore_path, dir_name)
    builder.import_idl_directory(dir_path, webkit_options)

  webkit_supplemental_options = databasebuilder.DatabaseBuilderOptions(
    idl_syntax=idlparser.FREMONTCUT_SYNTAX,
    source='WebKit',
    rename_operation_arguments_on_merge=True)
  builder.import_idl_file(
      os.path.join(current_dir, '..', 'idl', 'dart', 'webkit-supplemental.idl'),
      webkit_supplemental_options)

  # Import Dart idl:
  dart_options = databasebuilder.DatabaseBuilderOptions(
    idl_syntax=idlparser.FREMONTCUT_SYNTAX,
    source='Dart',
    rename_operation_arguments_on_merge=True)

  builder.import_idl_file(
      os.path.join(current_dir, '..', 'idl', 'dart', 'dart.idl'),
      dart_options)

  builder.set_same_signatures({
    'EventListener': 'Function',
    'int': 'long',
  })

  # Merging:
  builder.merge_imported_interfaces(optional_argument_whitelist)

  builder.fix_displacements('WebKit')

  # Cleanup:
  builder.normalize_annotations(['WebKit', 'Dart'])

  db.Save()