Rietveld Code Review Tool
Help | Bug tracker | Discussion group | Source code

Unified Diff: build.py

Issue 29345751: Issue 4028 - Add support for Edge extensions to buildtools (Closed)
Patch Set: Address Windows Store issues with blockmap and devbuild display name Created Oct. 14, 2016, 12:07 p.m.
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | docs/metadata.edge.example » ('j') | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: build.py
===================================================================
--- a/build.py
+++ b/build.py
@@ -7,17 +7,17 @@
import re
import subprocess
import shutil
import buildtools
from getopt import getopt, GetoptError
from StringIO import StringIO
from zipfile import ZipFile
-knownTypes = ('gecko', 'chrome', 'safari', 'generic')
+knownTypes = ('gecko', 'chrome', 'safari', 'generic', 'edge')
class Command(object):
name = property(lambda self: self._name)
shortDescription = property(
lambda self: self._shortDescription,
lambda self, value: self.__dict__.update({'_shortDescription': value})
)
@@ -171,50 +171,43 @@
'name': command.name,
'params': command.params,
'description': description,
'options': '\n'.join(options)
}
def runBuild(baseDir, scriptName, opts, args, type):
- locales = None
- buildNum = None
- multicompartment = False
- releaseBuild = False
- keyFile = None
+ kwargs = {}
for option, value in opts:
- if option in ('-l', '--locales'):
- locales = value.split(',')
- elif option in ('-b', '--build'):
- buildNum = value
- if type != 'gecko' and not re.search(r'^\d+$', buildNum):
+ if option in {'-l', '--locales'} and type == 'gecko':
+ kwargs['locales'] = value.split(',')
+ elif option in {'-b', '--build'}:
+ kwargs['buildNum'] = value
+ if type != 'gecko' and not kwargs['buildNum'].isdigit():
raise TypeError('Build number must be numerical')
- elif option in ('-k', '--key'):
- keyFile = value
- elif option in ('-m', '--multi-compartment'):
- multicompartment = True
- elif option in ('-r', '--release'):
- releaseBuild = True
- outFile = args[0] if len(args) > 0 else None
+ elif option in {'-k', '--key'}:
+ kwargs['keyFile'] = value
+ elif option in {'-m', '--multi-compartment'} and type == 'gecko':
+ kwargs['multicompartment'] = True
+ elif option in {'-r', '--release'}:
+ kwargs['releaseBuild'] = True
+ if len(args) > 0:
+ kwargs['outFile'] = args[0]
if type == 'gecko':
import buildtools.packagerGecko as packager
- packager.createBuild(baseDir, type=type, outFile=outFile,
- locales=locales, buildNum=buildNum,
- releaseBuild=releaseBuild,
- multicompartment=multicompartment)
elif type == 'chrome':
import buildtools.packagerChrome as packager
- packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
- releaseBuild=releaseBuild, keyFile=keyFile)
elif type == 'safari':
import buildtools.packagerSafari as packager
- packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
- releaseBuild=releaseBuild, keyFile=keyFile)
+ elif type == 'edge':
+ import buildtools.packagerEdge as packager
+
+ packager.createBuild(baseDir, type=type, **kwargs)
def runAutoInstall(baseDir, scriptName, opts, args, type):
if len(args) == 0:
print 'Port of the Extension Auto-Installer needs to be specified'
usage(scriptName, type, 'autoinstall')
return
@@ -469,17 +462,17 @@
command.shortDescription = 'Create a build'
command.description = 'Creates an extension build with given file name. If output_file is missing a default name will be chosen.'
command.params = '[options] [output_file]'
command.addOption('Only include the given locales (if omitted: all locales not marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('gecko'))
command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types=('chrome', 'safari'))
command.addOption('Create a build for leak testing', short='m', long='multi-compartment', types=('gecko'))
command.addOption('Create a release build', short='r', long='release')
- command.supportedTypes = ('gecko', 'chrome', 'safari')
+ command.supportedTypes = ('gecko', 'chrome', 'safari', 'edge')
with addCommand(runAutoInstall, 'autoinstall') as command:
command.shortDescription = 'Install extension automatically'
command.description = 'Will automatically install the extension in a browser running Extension Auto-Installer. If host parameter is omitted assumes that the browser runs on localhost.'
command.params = '[<host>:]<port>'
command.addOption('Create a build for leak testing', short='m', long='multi-compartment')
command.supportedTypes = ('gecko')
« no previous file with comments | « no previous file | docs/metadata.edge.example » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld