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

Side by Side Diff: build.py

Issue 11544056: Prepared buildtools for Safari (Closed)
Patch Set: Prepared buildtools for Safari Created Sept. 6, 2013, 2:45 p.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
« no previous file with comments | « background.html.tmpl ('k') | packagerChrome.py » ('j') | no next file with comments »
Toggle Intra-line Diffs ('i') | Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
OLDNEW
1 # coding: utf-8 1 # coding: utf-8
2 2
3 # This file is part of the Adblock Plus build tools, 3 # This file is part of the Adblock Plus build tools,
4 # Copyright (C) 2006-2013 Eyeo GmbH 4 # Copyright (C) 2006-2013 Eyeo GmbH
5 # 5 #
6 # Adblock Plus is free software: you can redistribute it and/or modify 6 # Adblock Plus is free software: you can redistribute it and/or modify
7 # it under the terms of the GNU General Public License version 3 as 7 # it under the terms of the GNU General Public License version 3 as
8 # published by the Free Software Foundation. 8 # published by the Free Software Foundation.
9 # 9 #
10 # Adblock Plus is distributed in the hope that it will be useful, 10 # Adblock Plus is distributed in the hope that it will be useful,
11 # but WITHOUT ANY WARRANTY; without even the implied warranty of 11 # but WITHOUT ANY WARRANTY; without even the implied warranty of
12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the 12 # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13 # GNU General Public License for more details. 13 # GNU General Public License for more details.
14 # 14 #
15 # You should have received a copy of the GNU General Public License 15 # You should have received a copy of the GNU General Public License
16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>. 16 # along with Adblock Plus. If not, see <http://www.gnu.org/licenses/>.
17 17
18 import os, sys, re, subprocess, buildtools 18 import os, sys, re, subprocess, buildtools
19 from getopt import getopt, GetoptError 19 from getopt import getopt, GetoptError
20 20
21 knownTypes = ('gecko', 'chrome', 'opera') 21 knownTypes = ('gecko', 'chrome', 'opera', 'safari')
22 22
23 class Command(object): 23 class Command(object):
24 name = property(lambda self: self._name) 24 name = property(lambda self: self._name)
25 shortDescription = property(lambda self: self._shortDescription, 25 shortDescription = property(lambda self: self._shortDescription,
26 lambda self, value: self.__dict__.update({'_shortDescription': value})) 26 lambda self, value: self.__dict__.update({'_shortDescription': value}))
27 description = property(lambda self: self._description, 27 description = property(lambda self: self._description,
28 lambda self, value: self.__dict__.update({'_description': value})) 28 lambda self, value: self.__dict__.update({'_description': value}))
29 params = property(lambda self: self._params, 29 params = property(lambda self: self._params,
30 lambda self, value: self.__dict__.update({'_params': value})) 30 lambda self, value: self.__dict__.update({'_params': value}))
31 supportedTypes = property(lambda self: self._supportedTypes, 31 supportedTypes = property(lambda self: self._supportedTypes,
(...skipping 136 matching lines...) Expand 10 before | Expand all | Expand 10 after
168 } 168 }
169 169
170 170
171 def runBuild(baseDir, scriptName, opts, args, type): 171 def runBuild(baseDir, scriptName, opts, args, type):
172 locales = None 172 locales = None
173 buildNum = None 173 buildNum = None
174 multicompartment = False 174 multicompartment = False
175 releaseBuild = False 175 releaseBuild = False
176 keyFile = None 176 keyFile = None
177 experimentalAPI = False 177 experimentalAPI = False
178 certs = []
178 for option, value in opts: 179 for option, value in opts:
179 if option in ('-l', '--locales'): 180 if option in ('-l', '--locales'):
180 locales = value.split(',') 181 locales = value.split(',')
181 elif option in ('-b', '--build'): 182 elif option in ('-b', '--build'):
182 buildNum = int(value) 183 buildNum = int(value)
183 elif option in ('-k', '--key'): 184 elif option in ('-k', '--key'):
184 keyFile = value 185 keyFile = value
185 elif option in ('-m', '--multi-compartment'): 186 elif option in ('-m', '--multi-compartment'):
186 multicompartment = True 187 multicompartment = True
187 elif option in ('-r', '--release'): 188 elif option in ('-r', '--release'):
188 releaseBuild = True 189 releaseBuild = True
189 elif option == '--experimental': 190 elif option == '--experimental':
190 experimentalAPI = True 191 experimentalAPI = True
192 elif option == '--cert':
193 certs.append(value)
191 outFile = args[0] if len(args) > 0 else None 194 outFile = args[0] if len(args) > 0 else None
192 195
193 if type == 'gecko': 196 if type == 'gecko':
194 import buildtools.packagerGecko as packager 197 import buildtools.packagerGecko as packager
195 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b uildNum=buildNum, 198 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b uildNum=buildNum,
196 releaseBuild=releaseBuild, keyFile=keyFile, 199 releaseBuild=releaseBuild, keyFile=keyFile,
197 multicompartment=multicompartment) 200 multicompartment=multicompartment)
198 elif type == 'chrome' or type == 'opera': 201 elif type == 'chrome' or type == 'opera':
199 import buildtools.packagerChrome as packager 202 import buildtools.packagerChrome as packager
200 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, 203 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum,
201 releaseBuild=releaseBuild, keyFile=keyFile, 204 releaseBuild=releaseBuild, keyFile=keyFile,
202 experimentalAPI=experimentalAPI) 205 experimentalAPI=experimentalAPI)
206 elif type == 'safari':
207 import buildtools.packagerSafari as packager
208 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, releaseBuild=releaseBuild, keyFile=keyFile, certs=certs)
209
203 210
204 211
205 def runAutoInstall(baseDir, scriptName, opts, args, type): 212 def runAutoInstall(baseDir, scriptName, opts, args, type):
206 if len(args) == 0: 213 if len(args) == 0:
207 print 'Port of the Extension Auto-Installer needs to be specified' 214 print 'Port of the Extension Auto-Installer needs to be specified'
208 usage(scriptName, type, 'autoinstall') 215 usage(scriptName, type, 'autoinstall')
209 return 216 return
210 217
211 multicompartment = False 218 multicompartment = False
212 for option, value in opts: 219 for option, value in opts:
(...skipping 205 matching lines...) Expand 10 before | Expand all | Expand 10 after
418 425
419 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command: 426 with addCommand(lambda baseDir, scriptName, opts, args, type: usage(scriptName, type), ('help', '-h', '--help')) as command:
420 command.shortDescription = 'Show this message' 427 command.shortDescription = 'Show this message'
421 428
422 with addCommand(runBuild, 'build') as command: 429 with addCommand(runBuild, 'build') as command:
423 command.shortDescription = 'Create a build' 430 command.shortDescription = 'Create a build'
424 command.description = 'Creates an extension build with given file name. If out put_file is missing a default name will be chosen.' 431 command.description = 'Creates an extension build with given file name. If out put_file is missing a default name will be chosen.'
425 command.params = '[options] [output_file]' 432 command.params = '[options] [output_file]'
426 command.addOption('Only include the given locales (if omitted: all locales not marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge cko')) 433 command.addOption('Only include the given locales (if omitted: all locales not marked as incomplete)', short='l', long='locales', value='l1,l2,l3', types=('ge cko'))
427 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') 434 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
428 command.addOption('File containing private key and certificates required to si gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 'opera')) 435 command.addOption('File containing private key and certificates required to si gn the package', short='k', long='key', value='file', types=('gecko', 'chrome', 'opera', 'safari'))
436 command.addOption('File containing an X509 certificate to be inlcuded into the package. Can be given multiple times.', long='cert', value='file', types=('safa ri',))
429 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment', types=('gecko')) 437 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment', types=('gecko'))
430 command.addOption('Create a release build', short='r', long='release') 438 command.addOption('Create a release build', short='r', long='release')
431 command.addOption('Enable use of experimental APIs', long='experimental') 439 command.addOption('Enable use of experimental APIs', long='experimental')
432 command.supportedTypes = ('gecko', 'chrome', 'opera') 440 command.supportedTypes = ('gecko', 'chrome', 'opera', 'safari')
433 441
434 with addCommand(runAutoInstall, 'autoinstall') as command: 442 with addCommand(runAutoInstall, 'autoinstall') as command:
435 command.shortDescription = 'Install extension automatically' 443 command.shortDescription = 'Install extension automatically'
436 command.description = 'Will automatically install the extension in a browser r unning Extension Auto-Installer. If host parameter is omitted assumes that the b rowser runs on localhost.' 444 command.description = 'Will automatically install the extension in a browser r unning Extension Auto-Installer. If host parameter is omitted assumes that the b rowser runs on localhost.'
437 command.params = '[<host>:]<port>' 445 command.params = '[<host>:]<port>'
438 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment') 446 command.addOption('Create a build for leak testing', short='m', long='multi-co mpartment')
439 command.supportedTypes = ('gecko') 447 command.supportedTypes = ('gecko')
440 448
441 with addCommand(createDevEnv, 'devenv') as command: 449 with addCommand(createDevEnv, 'devenv') as command:
442 command.shortDescription = 'Set up a development environment' 450 command.shortDescription = 'Set up a development environment'
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after
562 if option in ('-h', '--help'): 570 if option in ('-h', '--help'):
563 usage(scriptName, type, command) 571 usage(scriptName, type, command)
564 sys.exit() 572 sys.exit()
565 commands[command](baseDir, scriptName, opts, args, type) 573 commands[command](baseDir, scriptName, opts, args, type)
566 else: 574 else:
567 print 'Command %s is not supported for this application type' % command 575 print 'Command %s is not supported for this application type' % command
568 usage(scriptName, type) 576 usage(scriptName, type)
569 else: 577 else:
570 print 'Command %s is unrecognized' % command 578 print 'Command %s is unrecognized' % command
571 usage(scriptName, type) 579 usage(scriptName, type)
OLDNEW
« no previous file with comments | « background.html.tmpl ('k') | packagerChrome.py » ('j') | no next file with comments »

Powered by Google App Engine
This is Rietveld