Example #1
0
def checkoutAll(finished=False):
  for repo in buildConfig['repos']:
    print('Checkout with:' + str(repo))
    uri = repo['uri']
    repoDir = repo['dir']
    branch = repo['branch']
    revision = repo['revision']
    targetDir = os.path.join(srcDir, repoDir)
    if isAppveyor():
      archivePath = '-'.join(repoDir.split('/')) + '.zip'
      if not os.path.exists(archivePath):
        fullURI = 'https://codeload.github.com/%s/zip' % (uri)
        cmd = 'curl -o %s %s/%s' % (archivePath, fullURI, revision)
        if run(cmd.split(' '), cwd=srcDir, stdout=subprocess.PIPE, stderr=subprocess.PIPE).returncode != 0:
          delFile(archivePath)
          return
        # Extract the downloaded file
      delDir(targetDir)
      extracDir = os.path.join(srcDir, uri.split('/')[-1] + '-' + revision)
      delDir(extracDir)
      cmd = '7z x %s' % (archivePath)
      if run(cmd.split(' '), cwd=srcDir, stdout=subprocess.PIPE).returncode != 0:
        delFile(archivePath)
        return
      print('Rename %s to %s' % (extracDir, targetDir))
      rename(extracDir, targetDir, True)
    else:
      checkoutGit('https://github.com/%s' % (uri), targetDir, branch, revision=revision)
  return
Example #2
0
def build():
  (args, other_args) = parser.parse_known_args()

  print('Start build at:' + srcDir)
  options = args
  options.variant = args.variant.lower()
  options.target = args.target.lower()
  options.arch = args.arch
  
  if args.mocha_help is True:
    other_args = other_args + ['--help']
  if len(other_args) == 0:
    other_args = ['build']
  if (options.target == 'xulrunner'):
    other_args = ['./mach'] + other_args
  else:
    other_args = ['./mozilla/mach'] + other_args

  env = os.environ
  if isWin32():
    print('Buiding on win32')
    is64 = (args.arch != 'x86') and (args.arch != 'i686')
    archBits = '64' if is64 else '32'
    setEnv(env, 'MOZ_MSVCBITS', archBits)
    setEnv(env, 'MOZ_MSVCVERSION', '12')
    setEnv(env, 'MOZ_MSVCYEAR', '2013')
    options.arch = 'x86_64' if is64 else 'i686'
    options.vendor = 'pc-mingw32'
  options.tripleName = '%s-%s' % (options.arch, options.vendor)
  homeDir = os.path.join(srcDir, 'build').replace('\\', '/')
  options.home = homeDir[0].lower() + homeDir[1:]

  buildHome = os.path.join(os.path.dirname(srcDir), 'bolt-building')
  buildHome = buildHome[0].lower() + buildHome[1:]
  buildDirName =  'Obj-%s-%s-%s' % (options.target, options.tripleName, options.variant)
  options.targetDir = os.path.join(buildHome, buildDirName).replace('\\', '/')
  passed_args = [quote(arg) for arg in other_args]

  setEnv(env, 'BUILD_VENDOR', options.vendor)
  setEnv(env, 'BUILD_TRIPLE', options.tripleName)
  setEnv(env, 'HOME', options.home)
  setEnv(env, 'BUILD_VARIANT', options.variant)
  setEnv(env, 'TARGET_NAME', options.target)
  setEnv(env, 'TARGET_DIR', options.targetDir)
  setEnv(env, 'MOCHA_SCRIPT', ' '.join(passed_args))

  if isAppveyor():
    jsonText = json.dumps(env.__dict__, indent=2)
    print('The building env info is:' + jsonText)
  if isWin32():
    scriptPath = os.path.join(srcDir, 'mozilla-build', 'start-shell.bat')
    run([scriptPath] + sys.argv[1:], env=env)
  else:
    print('Not support yet')