OLD | NEW |
1 # coding: utf-8 | 1 # coding: utf-8 |
2 | 2 |
3 # This Source Code Form is subject to the terms of the Mozilla Public | 3 # This Source Code Form is subject to the terms of the Mozilla Public |
4 # License, v. 2.0. If a copy of the MPL was not distributed with this | 4 # License, v. 2.0. If a copy of the MPL was not distributed with this |
5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. | 5 # file, You can obtain one at http://mozilla.org/MPL/2.0/. |
6 | 6 |
7 import os, sys, re, subprocess, shutil, buildtools | 7 import os, sys, re, subprocess, shutil, buildtools |
8 from getopt import getopt, GetoptError | 8 from getopt import getopt, GetoptError |
9 from StringIO import StringIO | 9 from StringIO import StringIO |
10 from zipfile import ZipFile | 10 from zipfile import ZipFile |
(...skipping 147 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
158 'options': '\n'.join(options) | 158 'options': '\n'.join(options) |
159 } | 159 } |
160 | 160 |
161 | 161 |
162 def runBuild(baseDir, scriptName, opts, args, type): | 162 def runBuild(baseDir, scriptName, opts, args, type): |
163 locales = None | 163 locales = None |
164 buildNum = None | 164 buildNum = None |
165 multicompartment = False | 165 multicompartment = False |
166 releaseBuild = False | 166 releaseBuild = False |
167 keyFile = None | 167 keyFile = None |
168 experimentalAPI = False | |
169 for option, value in opts: | 168 for option, value in opts: |
170 if option in ('-l', '--locales'): | 169 if option in ('-l', '--locales'): |
171 locales = value.split(',') | 170 locales = value.split(',') |
172 elif option in ('-b', '--build'): | 171 elif option in ('-b', '--build'): |
173 buildNum = int(value) | 172 buildNum = int(value) |
174 elif option in ('-k', '--key'): | 173 elif option in ('-k', '--key'): |
175 keyFile = value | 174 keyFile = value |
176 elif option in ('-m', '--multi-compartment'): | 175 elif option in ('-m', '--multi-compartment'): |
177 multicompartment = True | 176 multicompartment = True |
178 elif option in ('-r', '--release'): | 177 elif option in ('-r', '--release'): |
179 releaseBuild = True | 178 releaseBuild = True |
180 elif option == '--experimental': | |
181 experimentalAPI = True | |
182 outFile = args[0] if len(args) > 0 else None | 179 outFile = args[0] if len(args) > 0 else None |
183 | 180 |
184 if type == 'gecko': | 181 if type == 'gecko': |
185 import buildtools.packagerGecko as packager | 182 import buildtools.packagerGecko as packager |
186 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b
uildNum=buildNum, | 183 packager.createBuild(baseDir, type=type, outFile=outFile, locales=locales, b
uildNum=buildNum, |
187 releaseBuild=releaseBuild, keyFile=keyFile, | 184 releaseBuild=releaseBuild, keyFile=keyFile, |
188 multicompartment=multicompartment) | 185 multicompartment=multicompartment) |
189 elif type == 'chrome': | 186 elif type == 'chrome': |
190 import buildtools.packagerChrome as packager | 187 import buildtools.packagerChrome as packager |
191 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, | 188 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, |
192 releaseBuild=releaseBuild, keyFile=keyFile, | 189 releaseBuild=releaseBuild, keyFile=keyFile) |
193 experimentalAPI=experimentalAPI) | |
194 elif type == 'safari': | 190 elif type == 'safari': |
195 import buildtools.packagerSafari as packager | 191 import buildtools.packagerSafari as packager |
196 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, | 192 packager.createBuild(baseDir, type=type, outFile=outFile, buildNum=buildNum, |
197 releaseBuild=releaseBuild, keyFile=keyFile) | 193 releaseBuild=releaseBuild, keyFile=keyFile) |
198 | 194 |
199 | 195 |
200 def runAutoInstall(baseDir, scriptName, opts, args, type): | 196 def runAutoInstall(baseDir, scriptName, opts, args, type): |
201 if len(args) == 0: | 197 if len(args) == 0: |
202 print 'Port of the Extension Auto-Installer needs to be specified' | 198 print 'Port of the Extension Auto-Installer needs to be specified' |
203 usage(scriptName, type, 'autoinstall') | 199 usage(scriptName, type, 'autoinstall') |
(...skipping 251 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
455 | 451 |
456 with addCommand(runBuild, 'build') as command: | 452 with addCommand(runBuild, 'build') as command: |
457 command.shortDescription = 'Create a build' | 453 command.shortDescription = 'Create a build' |
458 command.description = 'Creates an extension build with given file name. If out
put_file is missing a default name will be chosen.' | 454 command.description = 'Creates an extension build with given file name. If out
put_file is missing a default name will be chosen.' |
459 command.params = '[options] [output_file]' | 455 command.params = '[options] [output_file]' |
460 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')) | 456 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')) |
461 command.addOption('Use given build number (if omitted the build number will be
retrieved from Mercurial)', short='b', long='build', value='num') | 457 command.addOption('Use given build number (if omitted the build number will be
retrieved from Mercurial)', short='b', long='build', value='num') |
462 command.addOption('File containing private key and certificates required to si
gn the package', short='k', long='key', value='file', types=('gecko', 'chrome',
'safari')) | 458 command.addOption('File containing private key and certificates required to si
gn the package', short='k', long='key', value='file', types=('gecko', 'chrome',
'safari')) |
463 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment', types=('gecko')) | 459 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment', types=('gecko')) |
464 command.addOption('Create a release build', short='r', long='release') | 460 command.addOption('Create a release build', short='r', long='release') |
465 command.addOption('Enable use of experimental APIs', long='experimental') | |
466 command.supportedTypes = ('gecko', 'chrome', 'safari') | 461 command.supportedTypes = ('gecko', 'chrome', 'safari') |
467 | 462 |
468 with addCommand(runAutoInstall, 'autoinstall') as command: | 463 with addCommand(runAutoInstall, 'autoinstall') as command: |
469 command.shortDescription = 'Install extension automatically' | 464 command.shortDescription = 'Install extension automatically' |
470 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.' | 465 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.' |
471 command.params = '[<host>:]<port>' | 466 command.params = '[<host>:]<port>' |
472 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment') | 467 command.addOption('Create a build for leak testing', short='m', long='multi-co
mpartment') |
473 command.supportedTypes = ('gecko') | 468 command.supportedTypes = ('gecko') |
474 | 469 |
475 with addCommand(createDevEnv, 'devenv') as command: | 470 with addCommand(createDevEnv, 'devenv') as command: |
(...skipping 119 matching lines...) Expand 10 before | Expand all | Expand 10 after Loading... |
595 if option in ('-h', '--help'): | 590 if option in ('-h', '--help'): |
596 usage(scriptName, type, command) | 591 usage(scriptName, type, command) |
597 sys.exit() | 592 sys.exit() |
598 commands[command](baseDir, scriptName, opts, args, type) | 593 commands[command](baseDir, scriptName, opts, args, type) |
599 else: | 594 else: |
600 print 'Command %s is not supported for this application type' % command | 595 print 'Command %s is not supported for this application type' % command |
601 usage(scriptName, type) | 596 usage(scriptName, type) |
602 else: | 597 else: |
603 print 'Command %s is unrecognized' % command | 598 print 'Command %s is unrecognized' % command |
604 usage(scriptName, type) | 599 usage(scriptName, type) |
OLD | NEW |