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

Side by Side Diff: build.py

Issue 29501558: Issue 5383 - Add tests for the Chrome and Firefox packagers (Closed)
Patch Set: Addressing comments, handling Edge devenv Created Oct. 18, 2017, 11:19 a.m.
Left:
Right:
Use n/p to move between diff chunks; N/P to move between comments.
Jump to:
View unified diff | Download patch
OLDNEW
1 # This Source Code Form is subject to the terms of the Mozilla Public 1 # This Source Code Form is subject to the terms of the Mozilla Public
2 # License, v. 2.0. If a copy of the MPL was not distributed with this 2 # License, v. 2.0. If a copy of the MPL was not distributed with this
3 # file, You can obtain one at http://mozilla.org/MPL/2.0/. 3 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
4 4
5 import os 5 import os
6 import sys 6 import sys
7 import re 7 import re
8 import subprocess 8 import subprocess
9 import shutil 9 import shutil
10 from getopt import getopt, GetoptError 10 from getopt import getopt, GetoptError
(...skipping 179 matching lines...) Expand 10 before | Expand all | Expand 10 after
190 190
191 if type in {'chrome', 'gecko'}: 191 if type in {'chrome', 'gecko'}:
192 import buildtools.packagerChrome as packager 192 import buildtools.packagerChrome as packager
193 elif type == 'edge': 193 elif type == 'edge':
194 import buildtools.packagerEdge as packager 194 import buildtools.packagerEdge as packager
195 195
196 packager.createBuild(baseDir, type=type, **kwargs) 196 packager.createBuild(baseDir, type=type, **kwargs)
197 197
198 198
199 def createDevEnv(baseDir, scriptName, opts, args, type): 199 def createDevEnv(baseDir, scriptName, opts, args, type):
200 import buildtools.packagerChrome as packager 200 if type == 'edge':
201 import buildtools.packagerEdge as packager
202 else:
203 import buildtools.packagerChrome as packager
201 204
202 file = StringIO() 205 file = StringIO()
203 packager.createBuild(baseDir, type=type, outFile=file, devenv=True, releaseB uild=True) 206 packager.createBuild(baseDir, type=type, outFile=file, devenv=True, releaseB uild=True)
204 207
205 from buildtools.packager import getDevEnvPath 208 from buildtools.packager import getDevEnvPath
206 devenv_dir = getDevEnvPath(baseDir, type) 209 devenv_dir = getDevEnvPath(baseDir, type)
207 210
208 shutil.rmtree(devenv_dir, ignore_errors=True) 211 shutil.rmtree(devenv_dir, ignore_errors=True)
209 212
210 file.seek(0) 213 file.seek(0)
(...skipping 176 matching lines...) Expand 10 before | Expand all | Expand 10 after
387 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.' 390 command.description = 'Creates an extension build with given file name. If o utput_file is missing a default name will be chosen.'
388 command.params = '[options] [output_file]' 391 command.params = '[options] [output_file]'
389 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num') 392 command.addOption('Use given build number (if omitted the build number will be retrieved from Mercurial)', short='b', long='build', value='num')
390 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types={'chrome'}) 393 command.addOption('File containing private key and certificates required to sign the package', short='k', long='key', value='file', types={'chrome'})
391 command.addOption('Create a release build', short='r', long='release') 394 command.addOption('Create a release build', short='r', long='release')
392 command.supportedTypes = {'gecko', 'chrome', 'edge'} 395 command.supportedTypes = {'gecko', 'chrome', 'edge'}
393 396
394 with addCommand(createDevEnv, 'devenv') as command: 397 with addCommand(createDevEnv, 'devenv') as command:
395 command.shortDescription = 'Set up a development environment' 398 command.shortDescription = 'Set up a development environment'
396 command.description = 'Will set up or update the devenv folder as an unpacke d extension folder for development.' 399 command.description = 'Will set up or update the devenv folder as an unpacke d extension folder for development.'
397 command.supportedTypes = {'gecko', 'chrome'} 400 command.supportedTypes = {'gecko', 'chrome', 'edge'}
398 401
399 with addCommand(setupTranslations, 'setuptrans') as command: 402 with addCommand(setupTranslations, 'setuptrans') as command:
400 command.shortDescription = 'Sets up translation languages' 403 command.shortDescription = 'Sets up translation languages'
401 command.description = 'Sets up translation languages for the project on crow din.net.' 404 command.description = 'Sets up translation languages for the project on crow din.net.'
402 command.params = '[options] project-key' 405 command.params = '[options] project-key'
403 406
404 with addCommand(updateTranslationMaster, 'translate') as command: 407 with addCommand(updateTranslationMaster, 'translate') as command:
405 command.shortDescription = 'Updates translation master files' 408 command.shortDescription = 'Updates translation master files'
406 command.description = 'Updates the translation master files in the project o n crowdin.net.' 409 command.description = 'Updates the translation master files in the project o n crowdin.net.'
407 command.params = '[options] project-key' 410 command.params = '[options] project-key'
(...skipping 95 matching lines...) Expand 10 before | Expand all | Expand 10 after
503 if option in {'-h', '--help'}: 506 if option in {'-h', '--help'}:
504 usage(scriptName, type, command) 507 usage(scriptName, type, command)
505 sys.exit() 508 sys.exit()
506 commands[command](baseDir, scriptName, opts, args, type) 509 commands[command](baseDir, scriptName, opts, args, type)
507 else: 510 else:
508 print 'Command %s is not supported for this application type' % comm and 511 print 'Command %s is not supported for this application type' % comm and
509 usage(scriptName, type) 512 usage(scriptName, type)
510 else: 513 else:
511 print 'Command %s is unrecognized' % command 514 print 'Command %s is unrecognized' % command
512 usage(scriptName, type) 515 usage(scriptName, type)
OLDNEW
« no previous file with comments | « README.md ('k') | package.json » ('j') | tests/test_packagerWebExt.py » ('J')

Powered by Google App Engine
This is Rietveld