示例#1
0
 def execute(self, targets):
     runjava(
         jvmargs=self.jvm_args,
         classpath=self.classpath(profile_classpath(self.profile), confs=self.confs),
         main=self.main,
         args=self.args,
     )
示例#2
0
 def execute(self, targets):
   runjava(
     jvmargs=self.jvm_args,
     classpath=self.classpath(profile_classpath(self.profile), confs=self.confs),
     main=self.main,
     args=self.args
   )
示例#3
0
 def execute(self, targets):
     self.context.lock.release()
     runjava(jvmargs=self.jvm_args,
             classpath=self.classpath(profile_classpath(self.profile),
                                      confs=self.confs),
             main=self.main,
             args=self.args)
示例#4
0
 def execute(self, targets):
   self.context.lock.release()
   runjava(
     jvmargs=self.jvm_args,
     classpath=self.classpath(profile_classpath(self.profile), confs=self.confs),
     main=self.main,
     args=self.args
   )
示例#5
0
  def runjava(self, main, classpath=None, args=None, jvmargs=None):
    """
      Runs the java main using the given classpath and args.  If --no-ng-daemons is specified then
      the java main is run in a freshly spawned subprocess, otherwise a persistent nailgun server
      dedicated to this Task subclass is used to speed up amortized run times.
    """

    cp = (self._classpath or []) + (classpath or [])
    if self._daemon:
      nailgun = self._get_nailgun_client()

      def call_nailgun(main_class, *args):
        if self.dry_run:
          print('********** NailgunClient dry run: %s %s' % (main_class, ' '.join(args)))
          return 0
        else:
          return nailgun(main_class, *args)

      try:
        if cp:
          call_nailgun('ng-cp', *[os.path.relpath(jar, get_buildroot()) for jar in cp])
        return call_nailgun(main, *args)
      except NailgunError as e:
        self._ng_shutdown()
        raise e
    else:
      only_write_cmd_line_to = StringIO.StringIO() if self.dry_run else None
      ret = binary_utils.runjava(main=main, classpath=cp, args=args, jvmargs=jvmargs,
        only_write_cmd_line_to=only_write_cmd_line_to)
      if only_write_cmd_line_to:
        print('********** Direct Java dry run: %s' % only_write_cmd_line_to.getvalue())
        only_write_cmd_line_to.close()
      return ret
示例#6
0
  def execute(self, targets):
    if not self.skip:
      args = []
      if self.tests:
        args.append('--classes')
        args.append(','.join(self.tests))
      else:
        tests = self.calculate_tests(targets)
        if tests:
          args.append('--specs-files=%s' % ','.join(tests))

      if args:
        if self.color:
          args.append('--color')

        classpath = profile_classpath(self.profile)
        classpath.extend(os.path.join(get_buildroot(), path)
                         for path in ('src/resources', 'tests/resources'))
        with self.context.state('classpath', []) as cp:
          classpath.extend(jar for conf, jar in cp if conf in self.confs)

        result = runjava(
          jvmargs=self.java_args,
          classpath=classpath,
          main='run' if self.tests else 'com.twitter.common.testing.ExplicitSpecsRunnerMain',
          args=args
        )
        if result != 0:
          raise TaskError()
示例#7
0
          def generate_reports():
            args = [
              'report',
              '-in', self.coverage_metadata_file,
              '-in', self.coverage_file,
              '-exit'
            ]
            source_bases = set(t.target_base for t in targets)
            for source_base in source_bases:
              args.extend(['-sp', source_base])

            sorting = ['-Dreport.sort', '+name,+class,+method,+block']
            if self.coverage_report_console:
              args.extend(['-r', 'txt',
                           '-Dreport.txt.out.file=%s' % self.coverage_console_file] + sorting)
            if self.coverage_report_xml:
              args.extend(['-r', 'xml','-Dreport.xml.out.file=%s' % self.coverage_xml_file])
            if self.coverage_report_html:
              args.extend(['-r', 'html',
                           '-Dreport.html.out.file=%s' % self.coverage_html_file,
                           '-Dreport.out.encoding=UTF-8'] + sorting)

            result = runjava(
              classpath=emma_classpath,
              main='emma',
              args=args
            )
            if result != 0:
              raise TaskError('Failed to emma generate code coverage reports: %d' % result)

            if self.coverage_report_console:
              with safe_open(self.coverage_console_file) as console_report:
                sys.stdout.write(console_report.read())
            if self.coverage_report_html_open:
              binary_utils.open(self.coverage_html_file)
示例#8
0
 def run_binary(only_write_cmd_line_to):
     result = runjava(jvmargs=self.jvm_args,
                      classpath=(self.classpath(confs=self.confs)),
                      main=main,
                      args=self.args,
                      only_write_cmd_line_to=only_write_cmd_line_to)
     if result != 0:
         raise TaskError()
示例#9
0
 def run_tests(classpath, main, jvmargs=None):
     with safe_args(tests) as all_tests:
         result = runjava(jvmargs=(jvmargs or []) +
                          self.java_args,
                          classpath=classpath,
                          main=main,
                          args=self.flags + all_tests)
         if result != 0:
             raise TaskError()
示例#10
0
 def run_tests(classpath, main, jvmargs=None):
   with safe_args(tests) as all_tests:
     result = runjava(
       jvmargs=(jvmargs or []) + self.java_args,
       classpath=classpath,
       main=main,
       args=self.flags + all_tests
     )
     if result != 0:
       raise TaskError()
示例#11
0
 def run_tests(classpath, main, jvmargs=None):
     if self.only_write_cmd_line is None:
         with safe_args(tests) as all_tests:
             result = runjava(
                 jvmargs=(jvmargs or []) + self.java_args,
                 classpath=classpath,
                 main=main,
                 args=self.flags + all_tests,
             )
     else:
         with safe_open(self.only_write_cmd_line, 'w') as fd:
             result = runjava(jvmargs=(jvmargs or []) +
                              self.java_args,
                              classpath=classpath,
                              main=main,
                              args=self.flags + tests,
                              only_write_cmd_line_to=fd)
     if result != 0:
         raise TaskError()
示例#12
0
      def run_tests(main, args):
        classpath = profile_classpath(self.profile)
        classpath.extend(os.path.join(get_buildroot(), path)
                         for path in ('src/resources', 'tests/resources'))
        with self.context.state('classpath', []) as cp:
          classpath.extend(jar for conf, jar in cp if conf in self.confs)

        result = runjava(jvmargs=self.java_args, classpath=classpath, main=main, args=args)
        if result != 0:
          raise TaskError()
示例#13
0
 def run_binary(only_write_cmd_line_to):
   result = runjava(
     jvmargs=self.jvm_args,
     classpath=(self.classpath(confs=self.confs)),
     main=main,
     args=self.args,
     only_write_cmd_line_to=only_write_cmd_line_to
   )
   if result != 0:
     raise TaskError()
示例#14
0
 def execute(self, targets):
     # Run the first target that is a binary.
     binaries = filter(is_binary, targets)
     if len(binaries) > 0:  # We only run the first one.
         main = binaries[0].main
         result = runjava(jvmargs=self.jvm_args,
                          classpath=(self.classpath(confs=self.confs)),
                          main=main,
                          args=self.args)
         if result != 0:
             raise TaskError()
示例#15
0
 def run_tests(classpath, main, jvmargs=None):
   if self.only_write_cmd_line is None:
     with safe_args(tests) as all_tests:
      result = runjava(
         jvmargs=(jvmargs or []) + self.java_args,
         classpath=classpath,
         main=main,
         args=self.flags + all_tests,
       )
   else:
     with safe_open(self.only_write_cmd_line, 'w') as fd:
       result = runjava(
         jvmargs=(jvmargs or []) + self.java_args,
         classpath=classpath,
         main=main,
         args=self.flags + tests,
         only_write_cmd_line_to=fd
       )
   if result != 0:
     raise TaskError()
示例#16
0
      def run_tests(tests):
        args = ['--color'] if self.color else []
        args.append('--specs=%s' % ','.join(tests))

        result = runjava(
          jvmargs=self.java_args,
          classpath=self.classpath(profile_classpath(self.profile), confs=self.confs),
          main='com.twitter.common.testing.ExplicitSpecsRunnerMain',
          args=args
        )
        if result != 0:
          raise TaskError()
示例#17
0
            def run_tests(tests):
                args = ["--color"] if self.color else []
                args.append("--specs=%s" % ",".join(tests))

                result = runjava(
                    jvmargs=self.java_args,
                    classpath=self.classpath(profile_classpath(self.profile), confs=self.confs),
                    main="com.twitter.common.testing.ExplicitSpecsRunnerMain",
                    args=args,
                )
                if result != 0:
                    raise TaskError()
示例#18
0
文件: jvm_run.py 项目: avadh/commons
 def execute(self, targets):
   # Run the first target that is a binary.
   binaries = filter(is_binary, targets)
   if len(binaries) > 0:  # We only run the first one.
     main = binaries[0].main
     result = runjava(
       jvmargs=self.jvm_args,
       classpath=(self.classpath(confs=self.confs)),
       main=main,
       args=self.args
     )
     if result != 0:
       raise TaskError()
示例#19
0
 def instrument_code():
   safe_mkdir(self.coverage_instrument_dir, clean=True)
   with safe_args(self.get_coverage_patterns(targets)) as patterns:
     args = [
       'instr',
       '-out', self.coverage_metadata_file,
       '-d', self.coverage_instrument_dir,
       '-cp', os.pathsep.join(junit_classpath),
       '-exit'
     ]
     for pattern in patterns:
       args.extend(['-filter', pattern])
     result = runjava(classpath=emma_classpath, main='emma', args=args)
     if result != 0:
       raise TaskError('Emma instrumentation failed with: %d' % result)
示例#20
0
                    def generate_reports():
                        args = [
                            'report', '-in', self.coverage_metadata_file,
                            '-in', self.coverage_file, '-exit'
                        ]
                        source_bases = set(t.target_base for t in targets)
                        for source_base in source_bases:
                            args.extend(['-sp', source_base])

                        sorting = [
                            '-Dreport.sort', '+name,+class,+method,+block'
                        ]
                        if self.coverage_report_console:
                            args.extend([
                                '-r', 'txt',
                                '-Dreport.txt.out.file=%s' %
                                self.coverage_console_file
                            ] + sorting)
                        if self.coverage_report_xml:
                            args.extend([
                                '-r', 'xml',
                                '-Dreport.xml.out.file=%s' %
                                self.coverage_xml_file
                            ])
                        if self.coverage_report_html:
                            args.extend([
                                '-r', 'html',
                                '-Dreport.html.out.file=%s' %
                                self.coverage_html_file,
                                '-Dreport.out.encoding=UTF-8'
                            ] + sorting)

                        result = runjava(classpath=emma_classpath,
                                         main='emma',
                                         args=args)
                        if result != 0:
                            raise TaskError(
                                'Failed to emma generate code coverage reports: %d'
                                % result)

                        if self.coverage_report_console:
                            with safe_open(self.coverage_console_file
                                           ) as console_report:
                                sys.stdout.write(console_report.read())
                        if self.coverage_report_html_open:
                            binary_utils.open(self.coverage_html_file)
示例#21
0
  def execute(self, targets):
    # Run the first target that is a binary.
    binaries = filter(is_binary, targets)
    if len(binaries) > 0:  # We only run the first one.
      main = binaries[0].main
      classpath = []
      with self.context.state('classpath', []) as cp:
        classpath.extend(jar for conf, jar in cp if conf in self.confs)

      result = runjava(
        jvmargs=self.jvm_args,
        classpath=classpath,
        main=main,
        args=self.args
      )
      if result != 0:
        raise TaskError()
示例#22
0
 def instrument_code():
     safe_mkdir(self.coverage_instrument_dir, clean=True)
     with safe_args(self.get_coverage_patterns(
             targets)) as patterns:
         args = [
             'instr', '-out', self.coverage_metadata_file,
             '-d', self.coverage_instrument_dir, '-cp',
             os.pathsep.join(junit_classpath), '-exit'
         ]
         for pattern in patterns:
             args.extend(['-filter', pattern])
         result = runjava(classpath=emma_classpath,
                          main='emma',
                          args=args)
         if result != 0:
             raise TaskError(
                 'Emma instrumentation failed with: %d' %
                 result)
示例#23
0
  def runjava(self, main, classpath=None, args=None, jvmargs=None):
    """
      Runs the java main using the given classpath and args.  If --no-ng-daemons is specified then
      the java main is run in a freshly spawned subprocess, otherwise a persistent nailgun server
      dedicated to this Task subclass is used to speed up amortized run times.
    """

    cp = (self._classpath or []) + (classpath or [])
    if self._daemon:
      nailgun = self._get_nailgun_client()
      try:
        if cp:
          nailgun('ng-cp', *[os.path.relpath(jar, get_buildroot()) for jar in cp])
        return nailgun(main, *args)
      except NailgunError as e:
        self._ng_shutdown()
        raise e
    else:
      return binary_utils.runjava(main=main, classpath=cp, args=args, jvmargs=jvmargs)
示例#24
0
  def execute(self, targets):
    if not self.context.options.junit_run_skip:
      tests = self.tests or self.calculate_tests(targets)
      if tests:
        classpath = profile_classpath(self.profile)

        # TODO(John Sirois): undo cheeseball! - derive src/resources from target attribute and then
        # later fix tests to declare their resources as well?
        classpath.extend(os.path.join(get_buildroot(), path)
                         for path in ('src/resources', 'tests/resources'))

        with self.context.state('classpath', []) as cp:
          classpath.extend(jar for conf, jar in cp if conf in self.confs)

        result = runjava(
          jvmargs=self.java_args,
          classpath=classpath,
          main='com.twitter.common.testing.runner.JUnitConsoleRunner',
          args=self.flags + list(tests)
        )
        if result != 0:
          raise TaskError()
示例#25
0
    def runjava(self, main, classpath=None, args=None, jvmargs=None):
        """
      Runs the java main using the given classpath and args.  If --no-ng-daemons is specified then
      the java main is run in a freshly spawned subprocess, otherwise a persistent nailgun server
      dedicated to this Task subclass is used to speed up amortized run times.
    """

        cp = (self._classpath or []) + (classpath or [])
        if self._daemon:
            nailgun = self._get_nailgun_client()
            try:
                if cp:
                    nailgun(
                        'ng-cp',
                        *[os.path.relpath(jar, get_buildroot()) for jar in cp])
                return nailgun(main, *args)
            except NailgunError as e:
                self._ng_shutdown()
                raise e
        else:
            return binary_utils.runjava(main=main,
                                        classpath=cp,
                                        args=args,
                                        jvmargs=jvmargs)
示例#26
0
    def execute(self, targets):
        classpath = profile_classpath(self.profile)
        with self.context.state("classpath", []) as cp:
            classpath.extend(jar for conf, jar in cp if conf in self.confs)

        result = runjava(jvmargs=self.jvm_args, classpath=classpath, main=self.main, args=[])
示例#27
0
  def execute(self, targets):
    self.check_clean_master()

    pushdbs = {}
    def get_db(target):
      if target.provides is None:
        raise TaskError('trying to publish target %r which does not provide an artifact' % target)
      dbfile = target.provides.repo.push_db
      result = pushdbs.get(dbfile)
      if not result:
        db = PushDb.load(dbfile)
        repo = self.repos[target.provides.repo.name]
        result = (db, dbfile, repo)
        pushdbs[dbfile] = result
      return result

    def fingerprint_internal(target):
      if not is_internal(target):
        raise ValueError('Expected an internal target for fingerprinting, got %s' % target)
      pushdb, _, _ = get_db(target)
      _, _, _, fingerprint = pushdb.as_jar_with_version(target)
      return fingerprint or '0.0.0'

    def stage_artifacts(target, jar, version, changelog, confs=None):
      def artifact_path(name=None, suffix='', extension='jar'):
        return os.path.join(self.outdir, jar.org, jar.name,
                            '%s-%s%s.%s' % ((name or jar.name), version, suffix, extension))

      with safe_open(artifact_path(suffix='-CHANGELOG', extension='txt'), 'w') as changelog_file:
        changelog_file.write(changelog)

      def get_pushdb(target):
        return get_db(target)[0]

      PomWriter(get_pushdb).write(target, artifact_path(extension='pom'))

      ivyxml = artifact_path(name='ivy', extension='xml')
      IvyWriter(get_pushdb).write(target, ivyxml, confs)

      def copy(typename, suffix=''):
        genmap = self.context.products.get(typename)
        for basedir, jars in genmap.get(target).items():
          for artifact in jars:
            shutil.copy(os.path.join(basedir, artifact), artifact_path(suffix=suffix))

      copy('jars')
      if is_java(target):
        copy('javadoc_jars', '-javadoc')
      copy('source_jars', '-sources')

      return ivyxml

    if self.overrides:
      print('Publishing with revision overrides:\n  %s' % '\n  '.join(
        '%s=%s' % (coordinate(org, name), rev) for (org, name), rev in self.overrides.items()
      ))

    head_sha = self.check_output(['git', 'rev-parse', 'HEAD']).strip()

    safe_rmtree(self.outdir)
    published = []
    skip = (self.restart_at is not None)
    for target in self.exported_targets():
      pushdb, dbfile, repo = get_db(target)
      jar, semver, sha, fingerprint = pushdb.as_jar_with_version(target)

      published.append(jar)

      if skip and (jar.org, jar.name) == self.restart_at:
        skip = False

      newver = self.overrides.get((jar.org, jar.name)) or semver.bump()
      if self.snapshot:
        newver = newver.make_snapshot()

      if newver <= semver:
        raise TaskError('Requested version %s must be greater than the current version %s' % (
          newver.version(), semver.version()
        ))

      newfingerprint = self.fingerprint(target, fingerprint_internal)
      no_changes = newfingerprint == fingerprint

      if no_changes:
        changelog = 'No changes for %s - forced push.\n' % jar_coordinate(jar, semver.version())
      else:
        changelog = self.changelog(target, sha) or 'Direct dependencies changed.\n'

      if no_changes and not self.force:
        print('No changes for %s' % jar_coordinate(jar, semver.version()))
        stage_artifacts(target, jar, (newver if self.force else semver).version(), changelog)
      elif skip:
        print('Skipping %s to resume at %s' % (
          jar_coordinate(jar, (newver if self.force else semver).version()),
          coordinate(self.restart_at[0], self.restart_at[1])
        ))
        stage_artifacts(target, jar, semver.version(), changelog)
      else:
        if not self.dryrun:
          # Confirm push looks good
          if no_changes:
            print(changelog)
          else:
            print('\nChanges for %s since %s @ %s:\n\n%s' % (
              coordinate(jar.org, jar.name), semver.version(), sha, changelog
            ))
          push = raw_input('Publish %s with revision %s ? [y|N] ' % (
            coordinate(jar.org, jar.name), newver.version()
          ))
          print('\n')
          if push.strip().lower() != 'y':
            raise TaskError('User aborted push')

        pushdb.set_version(target, newver, head_sha, newfingerprint)
        ivyxml = stage_artifacts(target, jar, newver.version(), changelog, confs=repo['confs'])
        if self.dryrun:
          print('Skipping publish of %s in test mode.' % jar_coordinate(jar, newver.version()))
        else:
          resolver = repo['resolver']
          path = repo.get('path')

          # Get authentication for the publish repo if needed
          jvmargs = []
          auth = repo['auth']
          if auth:
            with ParseContext.temp():
              credentials = pants(auth).resolve().next()
              jvmargs.append(credentials.username())
              jvmargs.append(credentials.password())

          # Do the publish
          ivysettings = self.generate_ivysettings(published, publish_local=path)
          args = [
            '-settings', ivysettings,
            '-ivy', ivyxml,
            '-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.outdir,
            '-publish', resolver,
            '-publishpattern',
              '%s/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]' % self.outdir,
            '-revision', newver.version(),
            '-m2compatible',
          ]
          if self.snapshot:
            args.append('-overwrite')

          result = binary_utils.runjava(jvmargs=jvmargs, classpath=self.ivycp, args=args)
          if result != 0:
            raise TaskError('Failed to push %s - ivy failed with %d' % (
              jar_coordinate(jar, newver.version()), result)
            )

          if self.commit:
            pushdb.dump(dbfile)
            self.commit_push(jar.org, jar.name, newver.version(), head_sha)
示例#28
0
    def execute(self, targets):
        self.check_clean_master()

        pushdbs = {}

        def get_db(target):
            if target.provides is None:
                raise TaskError(
                    'trying to publish target %r which does not provide an artifact'
                    % target)
            dbfile = target.provides.repo.push_db
            result = pushdbs.get(dbfile)
            if not result:
                db = PushDb.load(dbfile)
                repo = self.repos[target.provides.repo.name]
                result = (db, dbfile, repo)
                pushdbs[dbfile] = result
            return result

        def fingerprint_internal(target):
            if not is_internal(target):
                raise ValueError(
                    'Expected an internal target for fingerprinting, got %s' %
                    target)
            pushdb, _, _ = get_db(target)
            _, _, _, fingerprint = pushdb.as_jar_with_version(target)
            return fingerprint or '0.0.0'

        def stage_artifacts(target, jar, version, changelog, confs=None):
            def artifact_path(name=None, suffix='', extension='jar'):
                return os.path.join(
                    self.outdir, jar.org, jar.name, '%s-%s%s.%s' %
                    ((name or jar.name), version, suffix, extension))

            with safe_open(artifact_path(suffix='-CHANGELOG', extension='txt'),
                           'w') as changelog_file:
                changelog_file.write(changelog)

            def get_pushdb(target):
                return get_db(target)[0]

            PomWriter(get_pushdb).write(target, artifact_path(extension='pom'))

            ivyxml = artifact_path(name='ivy', extension='xml')
            IvyWriter(get_pushdb).write(target, ivyxml, confs)

            def copy(typename, suffix=''):
                genmap = self.context.products.get(typename)
                for basedir, jars in genmap.get(target).items():
                    for artifact in jars:
                        shutil.copy(os.path.join(basedir, artifact),
                                    artifact_path(suffix=suffix))

            copy('jars')
            if is_java(target):
                copy('javadoc_jars', '-javadoc')
            copy('source_jars', '-sources')

            return ivyxml

        if self.overrides:
            print('Publishing with revision overrides:\n  %s' %
                  '\n  '.join('%s=%s' % (coordinate(org, name), rev)
                              for (org, name), rev in self.overrides.items()))

        head_sha = self.check_output(['git', 'rev-parse', 'HEAD']).strip()

        safe_rmtree(self.outdir)
        published = []
        skip = (self.restart_at is not None)
        for target in self.exported_targets():
            pushdb, dbfile, repo = get_db(target)
            jar, semver, sha, fingerprint = pushdb.as_jar_with_version(target)

            published.append(jar)

            if skip and (jar.org, jar.name) == self.restart_at:
                skip = False

            newver = self.overrides.get((jar.org, jar.name)) or semver.bump()
            if self.snapshot:
                newver = newver.make_snapshot()

            if newver <= semver:
                raise TaskError(
                    'Requested version %s must be greater than the current version %s'
                    % (newver.version(), semver.version()))

            newfingerprint = self.fingerprint(target, fingerprint_internal)
            no_changes = newfingerprint == fingerprint

            if no_changes:
                changelog = 'No changes for %s - forced push.\n' % jar_coordinate(
                    jar, semver.version())
            else:
                changelog = self.changelog(
                    target, sha) or 'Direct dependencies changed.\n'

            if no_changes and not self.force:
                print('No changes for %s' %
                      jar_coordinate(jar, semver.version()))
                stage_artifacts(target, jar,
                                (newver if self.force else semver).version(),
                                changelog)
            elif skip:
                print('Skipping %s to resume at %s' %
                      (jar_coordinate(
                          jar, (newver if self.force else semver).version()),
                       coordinate(self.restart_at[0], self.restart_at[1])))
                stage_artifacts(target, jar, semver.version(), changelog)
            else:
                if not self.dryrun:
                    # Confirm push looks good
                    if no_changes:
                        print(changelog)
                    else:
                        print('\nChanges for %s since %s @ %s:\n\n%s' %
                              (coordinate(jar.org, jar.name), semver.version(),
                               sha, changelog))
                    push = raw_input(
                        'Publish %s with revision %s ? [y|N] ' %
                        (coordinate(jar.org, jar.name), newver.version()))
                    print('\n')
                    if push.strip().lower() != 'y':
                        raise TaskError('User aborted push')

                pushdb.set_version(target, newver, head_sha, newfingerprint)
                ivyxml = stage_artifacts(target,
                                         jar,
                                         newver.version(),
                                         changelog,
                                         confs=repo['confs'])
                if self.dryrun:
                    print('Skipping publish of %s in test mode.' %
                          jar_coordinate(jar, newver.version()))
                else:
                    resolver = repo['resolver']
                    path = repo.get('path')

                    # Get authentication for the publish repo if needed
                    jvmargs = []
                    auth = repo['auth']
                    if auth:
                        with ParseContext.temp():
                            credentials = pants(auth).resolve().next()
                            jvmargs.append(credentials.username())
                            jvmargs.append(credentials.password())

                    # Do the publish
                    ivysettings = self.generate_ivysettings(published,
                                                            publish_local=path)
                    args = [
                        '-settings',
                        ivysettings,
                        '-ivy',
                        ivyxml,
                        '-deliverto',
                        '%s/[organisation]/[module]/ivy-[revision].xml' %
                        self.outdir,
                        '-publish',
                        resolver,
                        '-publishpattern',
                        '%s/[organisation]/[module]/[artifact]-[revision](-[classifier]).[ext]'
                        % self.outdir,
                        '-revision',
                        newver.version(),
                        '-m2compatible',
                    ]
                    if self.snapshot:
                        args.append('-overwrite')

                    result = binary_utils.runjava(jvmargs=jvmargs,
                                                  classpath=self.ivycp,
                                                  args=args)
                    if result != 0:
                        raise TaskError(
                            'Failed to push %s - ivy failed with %d' %
                            (jar_coordinate(jar, newver.version()), result))

                    if self.commit:
                        pushdb.dump(dbfile)
                        self.commit_push(jar.org, jar.name, newver.version(),
                                         head_sha)