示例#1
0
 def release(self):
   java_dir = self._get_java_dir() # Run this first to fail-fast if we're not in the java repo.
   print('\nAdapted from manual release procedure:\n{}\n'.format(SQUARE_RELEASE_WIKI))
   with self._setup_pants_repo() as pants_git:
     release_name = self._run_release_script(java_dir)
     BinaryUtils.pause('You should check to see if BUILD.tools or pants.ini need updating now.')
     self._test_exemplar(pants_git, java_dir, release_name)
     self._print_closing_info(release_name)
示例#2
0
 def _test_exemplar(self, pants_git, java_dir, release_name):
   logger.info('\nTesting on exemplar:\n')
   env = os.environ.copy()
   env['SQPANTS_VERSION'] = release_name
   if 'PANTS_DEV' in env:
     env.pop('PANTS_DEV')
   env['PANTS_SRC'] = pants_git.cwd
   java_pants = Command('./pants', cwd=java_dir, env=env)
   success = True
   if not java_pants('binary', 'service/exemplar', pipe=False):
     BinaryUtils.pause('Building service/exemplar failed.')
     success = False
   elif not java_pants('test', 'service/exemplar', pipe=False):
     BinaryUtils.pause('Testing service/exemplar failed.')
     success = False
   return success
示例#3
0
  def _setup_pants_repo(self):
    """Cleans the pants repo and applies patches, yielding the Git command for the repo."""
    git = PantsGit()

    if self.use_dirty:
      yield git
      raise StopIteration

    if not git.is_clean():
        raise RunError('Pants source not clean: please stash or commit changes in {}.'
                       .format(git.cwd))
    self._assert_square_exists(git)
    pants_upstream = self._get_upstream_remote(git)
    git('checkout', 'master')
    git('fetch', pants_upstream)
    git('reset', '--hard', '{}/master'.format(pants_upstream))
    git('clean', '-fdx')
    with git.apply_patches(PANTS_PATCHES, on_branch=SQUARE_RELEASE_BRANCH, commit=True):
      git('push', '-f', 'square')
      BinaryUtils.pause('Patches applied. It is recommended that you run either:"\n'
                        '  full CI:                 {cwd}/build-support/bin/ci.sh\n'
                        '  or just the unit tests:  cd {cwd} ; ./pants test tests/python/pants_test:all\n'
                        'before continuing.'.format(cwd=git.cwd))
      yield git