Esempio n. 1
0
def createBuild(baseDir,
                type='chrome',
                outFile=None,
                buildNum=None,
                releaseBuild=False,
                keyFile=None,
                devenv=False):
    metadata = readMetadata(baseDir, type)
    version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)

    if outFile == None:
        file_extension = get_extension(type, keyFile is not None)
        outFile = getDefaultFileName(metadata, version, file_extension)

    params = {
        'type': type,
        'baseDir': baseDir,
        'releaseBuild': releaseBuild,
        'version': version,
        'devenv': devenv,
        'metadata': metadata,
    }

    mapped = metadata.items('mapping') if metadata.has_section(
        'mapping') else []
    files = Files(getPackageFiles(params),
                  getIgnoredFiles(params),
                  process=lambda path, data: processFile(path, data, params))

    files.readMappedFiles(mapped)
    files.read(baseDir, skip=[opt for opt, _ in mapped])

    if metadata.has_section('bundles'):
        bundle_tests = devenv and metadata.has_option('general', 'testScripts')
        create_bundles(params, files, bundle_tests)

    if metadata.has_section('preprocess'):
        files.preprocess(
            [f for f, _ in metadata.items('preprocess')],
            {'needsExt': True},
        )

    if metadata.has_section('import_locales'):
        import_locales(params, files)

    files['manifest.json'] = createManifest(params, files)
    if type == 'chrome':
        fix_translations_for_chrome(files)

    if devenv:
        add_devenv_requirements(files, metadata, params)

    zipdata = files.zipToString()
    signature = None
    pubkey = None
    if keyFile != None:
        signature = signBinary(zipdata, keyFile)
        pubkey = getPublicKey(keyFile)
    writePackage(outFile, pubkey, signature, zipdata)
Esempio n. 2
0
def createBuild(baseDir, type='chrome', outFile=None, buildNum=None, releaseBuild=False, keyFile=None, devenv=False):
    metadata = readMetadata(baseDir, type)
    version = getBuildVersion(baseDir, metadata, releaseBuild, buildNum)

    if outFile == None:
        file_extension = get_extension(type, keyFile is not None)
        outFile = getDefaultFileName(metadata, version, file_extension)

    params = {
        'type': type,
        'baseDir': baseDir,
        'releaseBuild': releaseBuild,
        'version': version,
        'devenv': devenv,
        'metadata': metadata,
    }

    mapped = metadata.items('mapping') if metadata.has_section('mapping') else []
    files = Files(getPackageFiles(params), getIgnoredFiles(params),
                  process=lambda path, data: processFile(path, data, params))

    files.readMappedFiles(mapped)
    files.read(baseDir, skip=[opt for opt, _ in mapped])

    if metadata.has_section('bundles'):
        bundle_tests = devenv and metadata.has_option('general', 'testScripts')
        create_bundles(params, files, bundle_tests)

    if metadata.has_section('preprocess'):
        files.preprocess(
            [f for f, _ in metadata.items('preprocess')],
            {'needsExt': True},
        )

    if metadata.has_section('import_locales'):
        import_locales(params, files)

    files['manifest.json'] = createManifest(params, files)
    if type == 'chrome':
        fix_translations_for_chrome(files)

    if devenv:
        add_devenv_requirements(files, metadata, params)

    zipdata = files.zipToString()
    signature = None
    pubkey = None
    if keyFile != None:
        signature = signBinary(zipdata, keyFile)
        pubkey = getPublicKey(keyFile)
    writePackage(outFile, pubkey, signature, zipdata)
def create_build(platform, base_dir, target_path, version, key_file=None):
    """Create a build for the target platform and version."""
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    metadata = readMetadata(base_dir, platform)
    update_metadata(metadata, version)

    build_path = os.path.join(
        target_path,
        getDefaultFileName(metadata, version,
                           get_extension(platform, key_file is not None)),
    )

    packager.createBuild(base_dir, type=platform, outFile=build_path,
                         releaseBuild=True, keyFile=key_file)

    return build_path
Esempio n. 4
0
def create_build(platform, base_dir, target_path, version, key_file=None):
    """Create a build for the target platform and version."""
    if platform == 'edge':
        import buildtools.packagerEdge as packager
    else:
        import buildtools.packagerChrome as packager

    metadata = readMetadata(base_dir, platform)
    update_metadata(metadata, version)

    build_path = os.path.join(
        target_path,
        getDefaultFileName(metadata, version,
                           get_extension(platform, key_file is not None)),
    )

    packager.createBuild(base_dir,
                         type=platform,
                         outFile=build_path,
                         releaseBuild=True,
                         keyFile=key_file)

    return build_path