当前位置: 首页>>代码示例>>Python>>正文


Python Bootstrapper.default_ivy方法代码示例

本文整理汇总了Python中pants.ivy.bootstrapper.Bootstrapper.default_ivy方法的典型用法代码示例。如果您正苦于以下问题:Python Bootstrapper.default_ivy方法的具体用法?Python Bootstrapper.default_ivy怎么用?Python Bootstrapper.default_ivy使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在pants.ivy.bootstrapper.Bootstrapper的用法示例。


在下文中一共展示了Bootstrapper.default_ivy方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: test_fresh_bootstrap

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
 def test_fresh_bootstrap(self):
   with temporary_dir() as fresh_bootstrap_dir:
     self.set_bootstrap_options(pants_bootstrapdir=fresh_bootstrap_dir)
     # Initialize the Ivy subsystem
     self.context()
     Bootstrapper.default_ivy()
     bootstrap_jar_path = os.path.join(fresh_bootstrap_dir,
                                       'tools', 'jvm', 'ivy', 'bootstrap.jar')
     self.assertTrue(os.path.exists(bootstrap_jar_path))
开发者ID:pombreda,项目名称:pants,代码行数:11,代码来源:test_bootstrapper.py

示例2: publish

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
          def publish(ivyxml_path):
            try:
              ivy = Bootstrapper.default_ivy()
            except Bootstrapper.Error as e:
              raise TaskError('Failed to push %s! %s' % (jar_coordinate(jar, newver.version()), e))

            ivysettings = self.generate_ivysettings(ivy, published, publish_local=path)
            args = [
              '-settings', ivysettings,
              '-ivy', ivyxml_path,
              '-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.workdir,
              '-publish', resolver,
              '-publishpattern', '%s/[organisation]/[module]/'
                                 '[artifact]-[revision](-[classifier]).[ext]' % self.workdir,
              '-revision', newver.version(),
              '-m2compatible',
            ]

            if LogOptions.stderr_log_level() == logging.DEBUG:
              args.append('-verbose')

            if self.snapshot:
              args.append('-overwrite')

            try:
              ivy.execute(jvm_options=jvm_args, args=args,
                          workunit_factory=self.context.new_workunit, workunit_name='jar-publish')
            except Ivy.Error as e:
              raise TaskError('Failed to push %s! %s' % (jar_coordinate(jar, newver.version()), e))
开发者ID:slackhappy,项目名称:pants,代码行数:31,代码来源:jar_publish.py

示例3: publish

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def publish(self, ivyxml_path, jar, entry, repo, published):
    """Run ivy to publish a jar.  ivyxml_path is the path to the ivy file; published
    is a list of jars published so far (including this one). entry is a pushdb entry."""
    jvm_args = self._ivy_jvm_args(repo)
    resolver = repo['resolver']
    path = repo.get('path')

    try:
      ivy = Bootstrapper.default_ivy()
    except Bootstrapper.Error as e:
      raise TaskError('Failed to push {0}! {1}'.format(pushdb_coordinate(jar, entry), e))

    ivysettings = self.generate_ivysettings(ivy, published, publish_local=path)
    args = [
      '-settings', ivysettings,
      '-ivy', ivyxml_path,
      '-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.workdir,
      '-publish', resolver,
      '-publishpattern', '%s/[organisation]/[module]/'
                         '[artifact]-[revision](-[classifier]).[ext]' % self.workdir,
      '-revision', entry.version().version(),
      '-m2compatible',
    ]

    if LogOptions.stderr_log_level() == logging.DEBUG:
      args.append('-verbose')

    if self.local_snapshot:
      args.append('-overwrite')

    try:
      ivy.execute(jvm_options=jvm_args, args=args,
                  workunit_factory=self.context.new_workunit, workunit_name='jar-publish')
    except Ivy.Error as e:
      raise TaskError('Failed to push {0}! {1}'.format(pushdb_coordinate(jar, entry), e))
开发者ID:amedina,项目名称:pants,代码行数:37,代码来源:jar_publish.py

示例4: exec_ivy

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def exec_ivy(cls, ivy, confs, ivyxml, args,
               jvm_options,
               executor,
               workunit_name,
               workunit_factory):
    """
    :API: public
    """
    ivy = ivy or Bootstrapper.default_ivy()

    ivy_args = ['-ivy', ivyxml]
    ivy_args.append('-confs')
    ivy_args.extend(confs)
    ivy_args.extend(args)

    ivy_jvm_options = list(jvm_options)
    # Disable cache in File.getCanonicalPath(), makes Ivy work with -symlink option properly on ng.
    ivy_jvm_options.append('-Dsun.io.useCanonCaches=false')

    runner = ivy.runner(jvm_options=ivy_jvm_options, args=ivy_args, executor=executor)
    try:
      with ivy.resolution_lock:
        result = execute_runner(runner, workunit_factory=workunit_factory,
                                workunit_name=workunit_name)
      if result != 0:
        raise IvyUtils.IvyError('Ivy returned {result}. cmd={cmd}'.format(result=result, cmd=runner.cmd))
    except runner.executor.Error as e:
      raise IvyUtils.IvyError(e)
开发者ID:ahamilton55,项目名称:pants,代码行数:30,代码来源:ivy_utils.py

示例5: exec_ivy

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def exec_ivy(self,
               target_workdir,
               targets,
               args,
               confs=None,
               ivy=None,
               workunit_name='ivy',
               workunit_factory=None,
               symlink_ivyxml=False,
               jars=None):

    ivy = ivy or Bootstrapper.default_ivy()
    if not isinstance(ivy, Ivy):
      raise ValueError('The ivy argument supplied must be an Ivy instance, given %s of type %s'
                       % (ivy, type(ivy)))

    ivyxml = os.path.join(target_workdir, 'ivy.xml')

    if not jars:
      jars, excludes = self._calculate_classpath(targets)
    else:
      excludes = set()

    ivy_args = ['-ivy', ivyxml]

    confs_to_resolve = confs or ['default']
    ivy_args.append('-confs')
    ivy_args.extend(confs_to_resolve)

    ivy_args.extend(args)
    if not self._transitive:
      ivy_args.append('-notransitive')
    ivy_args.extend(self._args)

    def safe_link(src, dest):
      try:
        os.unlink(dest)
      except OSError as e:
        if e.errno != errno.ENOENT:
          raise
      os.symlink(src, dest)

    with IvyUtils.ivy_lock:
      self._generate_ivy(targets, jars, excludes, ivyxml, confs_to_resolve)
      runner = ivy.runner(jvm_options=self._jvm_options, args=ivy_args)
      try:
        result = util.execute_runner(runner,
                                     workunit_factory=workunit_factory,
                                     workunit_name=workunit_name)

        # Symlink to the current ivy.xml file (useful for IDEs that read it).
        if symlink_ivyxml:
          ivyxml_symlink = os.path.join(self._workdir, 'ivy.xml')
          safe_link(ivyxml, ivyxml_symlink)

        if result != 0:
          raise TaskError('Ivy returned %d' % result)
      except runner.executor.Error as e:
        raise TaskError(e)
开发者ID:hythloday,项目名称:pants,代码行数:61,代码来源:ivy_utils.py

示例6: execute_junit_runner

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def execute_junit_runner(self, content):

    # Create the temporary base test directory
    test_rel_path = 'tests/java/org/pantsbuild/foo'
    test_abs_path = os.path.join(self.build_root, test_rel_path)
    self.create_dir(test_rel_path)

    # Generate the temporary java test source code.
    test_java_file_rel_path = os.path.join(test_rel_path, 'FooTest.java')
    test_java_file_abs_path = os.path.join(self.build_root, test_java_file_rel_path)
    self.create_file(test_java_file_rel_path, content)

    # Invoke ivy to resolve classpath for junit.
    distribution = Distribution.cached(jdk=True)
    executor = SubprocessExecutor(distribution=distribution)
    classpath_file_abs_path = os.path.join(test_abs_path, 'junit.classpath')
    ivy = Bootstrapper.default_ivy()
    ivy.execute(args=['-cachepath', classpath_file_abs_path,
                      '-dependency', 'junit', 'junit-dep', '4.10'], executor=executor)
    with open(classpath_file_abs_path) as fp:
      classpath = fp.read()

    # Now directly invoking javac to compile the test java code into java class
    # so later we can inject the class into products mapping for JUnitRun to execute
    # the test on.
    javac = distribution.binary('javac')
    subprocess.check_call(
      [javac, '-d', test_abs_path, '-cp', classpath, test_java_file_abs_path])

    # Create a java_tests target and a synthetic resource target.
    java_tests = self.create_library(test_rel_path, 'java_tests', 'foo_test', ['FooTest.java'])
    resources = self.make_target('some_resources', Resources)

    # Set the context with the two targets, one java_tests target and
    # one synthetic resources target.
    # The synthetic resources target is to make sure we won't regress
    # in the future with bug like https://github.com/pantsbuild/pants/issues/508. Note
    # in that bug, the resources target must be the first one in the list.
    context = self.context(target_roots=[resources, java_tests])

    # Before we run the task, we need to inject the "classes_by_target" with
    # the compiled test java classes that JUnitRun will know which test
    # classes to execute. In a normal run, this "classes_by_target" will be
    # populated by java compiling step.
    class_products = context.products.get_data(
      'classes_by_target', lambda: defaultdict(MultipleRootedProducts))
    java_tests_products = MultipleRootedProducts()
    java_tests_products.add_rel_paths(test_abs_path, ['FooTest.class'])
    class_products[java_tests] = java_tests_products

    # Also we need to add the FooTest.class's classpath to the compile_classpath
    # products data mapping so JUnitRun will be able to add that into the final
    # classpath under which the junit will be executed.
    self.populate_compile_classpath(
      context=context,
      classpath=[test_abs_path])

    # Finally execute the task.
    self.execute(context)
开发者ID:WamBamBoozle,项目名称:pants,代码行数:61,代码来源:test_junit_run.py

示例7: publish

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
    def publish(self, publications, jar, entry, repo, published):
        """Run ivy to publish a jar.  ivyxml_path is the path to the ivy file; published
    is a list of jars published so far (including this one). entry is a pushdb entry."""

        try:
            ivy = Bootstrapper.default_ivy()
        except Bootstrapper.Error as e:
            raise TaskError("Failed to push {0}! {1}".format(pushdb_coordinate(jar, entry), e))

        path = repo.get("path")
        ivysettings = self.generate_ivysettings(ivy, published, publish_local=path)

        version = entry.version().version()
        ivyxml = self.generate_ivy(jar, version, publications)

        resolver = repo["resolver"]
        args = [
            "-settings",
            ivysettings,
            "-ivy",
            ivyxml,
            # Without this setting, the ivy.xml is delivered to the CWD, littering the workspace.  We
            # don't need the ivy.xml, so just give it path under the workdir we won't use.
            "-deliverto",
            ivyxml + ".unused",
            "-publish",
            resolver,
            "-publishpattern",
            "{}/[organisation]/[module]/" "[artifact]-[revision](-[classifier]).[ext]".format(self.workdir),
            "-revision",
            version,
            "-m2compatible",
        ]

        # TODO(John Sirois): global logging options should be hidden behind some sort of log manager
        # that we can:
        # a.) obtain a handle to (dependency injection or manual plumbing)
        # b.) query for log detail, ie: `if log_manager.is_verbose:`
        if self.get_options().level == "debug":
            args.append("-verbose")

        if self.local_snapshot:
            args.append("-overwrite")

        try:
            jvm_options = self._ivy_jvm_options(repo)
            ivy.execute(
                jvm_options=jvm_options,
                args=args,
                workunit_factory=self.context.new_workunit,
                workunit_name="ivy-publish",
            )
        except Ivy.Error as e:
            raise TaskError("Failed to push {0}! {1}".format(pushdb_coordinate(jar, entry), e))
开发者ID:cburroughs,项目名称:pants,代码行数:56,代码来源:jar_publish.py

示例8: publish

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def publish(self, publications, jar, version, repo, published):
    """Run ivy to publish a jar.

    :param str ivyxml_path: The path to the ivy file.
    :param list published: A list of jars published so far (including this one).
    """

    try:
      ivy = Bootstrapper.default_ivy()
    except Bootstrapper.Error as e:
      raise TaskError('Failed to push {0}! {1}'.format(jar, e))

    if ivy.ivy_settings is None:
      raise TaskError('An ivysettings.xml with writeable resolvers is required for publishing, '
                      'but none was configured.')

    path = repo.get('path')

    ivysettings = self.generate_ivysettings(self.fetch_ivysettings(ivy), published, publish_local=path)
    ivyxml = self.generate_ivy(jar, version, publications)
    resolver = repo['resolver']
    args = [
      '-settings', ivysettings,
      '-ivy', ivyxml,

      # Without this setting, the ivy.xml is delivered to the CWD, littering the workspace.  We
      # don't need the ivy.xml, so just give it path under the workdir we won't use.
      '-deliverto', ivyxml + '.unused',

      '-publish', resolver,
      '-publishpattern', '{}/[organisation]/[module]/'
                         '[artifact]-[revision](-[classifier]).[ext]'.format(self.workdir),
      '-revision', version,
      '-m2compatible',
    ]

    if self.get_options().level == 'debug':
      args.append('-verbose')

    if self.get_options().local:
      args.append('-overwrite')

    if not self.get_options().dryrun:
      try:
        ivy.execute(jvm_options=self._ivy_jvm_options(repo), args=args,
                    workunit_factory=self.context.new_workunit, workunit_name='ivy-publish')
      except Ivy.Error as e:
        raise TaskError('Failed to push {0}! {1}'.format(jar, e))
    else:
      print("\nDRYRUN- would have pushed:{} using {} resolver.".format(self.jar_coordinate(jar, version), resolver))
开发者ID:boriskozak,项目名称:fsqio,代码行数:52,代码来源:pom_publish.py

示例9: run_antlrs

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def run_antlrs(self, output_dir):
    # TODO(John Sirois): graduate to a JvmToolTask and/or merge with the java code gen AntlrGen
    # task.
    args = [
      '-dependency', 'org.antlr', 'antlr', self.target.antlr_version,
      '-types', 'jar',
      '-main', 'org.antlr.Tool',
      '--', '-fo', output_dir
    ]
    for source in self.target.sources_relative_to_buildroot():
      abs_path = os.path.join(get_buildroot(), source)
      args.append(abs_path)

    try:
      ivy = Bootstrapper.default_ivy()
      ivy.execute(args=args)  # TODO: Needs a workunit, when we have a context here.
    except (Bootstrapper.Error, Ivy.Error) as e:
      raise TaskError('ANTLR generation failed! {0}'.format(e))
开发者ID:godwinpinto,项目名称:pants,代码行数:20,代码来源:antlr_builder.py

示例10: _exec_ivy

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
    def _exec_ivy(
        self,
        target_workdir,
        targets,
        args,
        executor=None,
        confs=None,
        ivy=None,
        workunit_name="ivy",
        use_soft_excludes=False,
        resolve_hash_name=None,
    ):
        ivy_jvm_options = self.get_options().jvm_options[:]
        # Disable cache in File.getCanonicalPath(), makes Ivy work with -symlink option properly on ng.
        ivy_jvm_options.append("-Dsun.io.useCanonCaches=false")

        ivy = ivy or Bootstrapper.default_ivy()
        ivyxml = os.path.join(target_workdir, "ivy.xml")

        ivy_args = ["-ivy", ivyxml]

        confs_to_resolve = confs or ("default",)
        ivy_args.append("-confs")
        ivy_args.extend(confs_to_resolve)
        ivy_args.extend(args)

        # TODO(John Sirois): merge the code below into IvyUtils or up here; either way, better
        # diagnostics can be had in `IvyUtils.generate_ivy` if this is done.
        # See: https://github.com/pantsbuild/pants/issues/2239
        try:
            jars, excludes = IvyUtils.calculate_classpath(targets, gather_excludes=not use_soft_excludes)
            with IvyUtils.ivy_lock:
                IvyUtils.generate_ivy(targets, jars, excludes, ivyxml, confs_to_resolve, resolve_hash_name)
                runner = ivy.runner(jvm_options=ivy_jvm_options, args=ivy_args, executor=executor)
                try:
                    result = execute_runner(
                        runner, workunit_factory=self.context.new_workunit, workunit_name=workunit_name
                    )
                    if result != 0:
                        raise self.Error("Ivy returned {result}. cmd={cmd}".format(result=result, cmd=runner.cmd))
                except runner.executor.Error as e:
                    raise self.Error(e)
        except IvyUtils.IvyError as e:
            raise self.Error("Failed to prepare ivy resolve: {}".format(e))
开发者ID:jduan,项目名称:pants,代码行数:46,代码来源:ivy_task_mixin.py

示例11: mapjars

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def mapjars(self, genmap, target, executor, jars=None):
    """Resolves jars for the target and stores their locations in genmap.

    :param genmap: The jar_dependencies ProductMapping entry for the required products.
    :param target: The target whose jar dependencies are being retrieved.
    :param jars: If specified, resolves the given jars rather than
    :type jars: List of :class:`pants.backend.jvm.targets.jar_dependency.JarDependency` (jar())
      objects.
    """
    mapdir = os.path.join(self.workdir, 'mapped-jars', target.id)
    safe_mkdir(mapdir, clean=True)
    ivyargs = [
      '-retrieve', '%s/[organisation]/[artifact]/[conf]/'
                   '[organisation]-[artifact]-[revision](-[classifier]).[ext]' % mapdir,
      '-symlink',
    ]
    confs = maybe_list(target.payload.get_field_value('configurations') or [])
    self.exec_ivy(mapdir,
                  [target],
                  executor=executor,
                  args=ivyargs,
                  confs=confs,
                  ivy=Bootstrapper.default_ivy(),
                  workunit_name='map-jars',
                  jars=jars)

    for org in os.listdir(mapdir):
      orgdir = os.path.join(mapdir, org)
      if os.path.isdir(orgdir):
        for name in os.listdir(orgdir):
          artifactdir = os.path.join(orgdir, name)
          if os.path.isdir(artifactdir):
            for conf in os.listdir(artifactdir):
              confdir = os.path.join(artifactdir, conf)
              for f in os.listdir(confdir):
                # TODO(John Sirois): kill the org and (org, name) exclude mappings in favor of a
                # conf whitelist
                genmap.add(org, confdir).append(f)
                genmap.add((org, name), confdir).append(f)

                genmap.add(target, confdir).append(f)
                genmap.add((target, conf), confdir).append(f)
                genmap.add((org, name, conf), confdir).append(f)
开发者ID:arloherrine,项目名称:pants,代码行数:45,代码来源:ivy_task_mixin.py

示例12: do_resolve

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def do_resolve(cls, executor, extra_args, ivyxml, jvm_options, workdir_report_paths_by_conf,
                 confs, ivy_cache_dir, ivy_cache_classpath_filename, resolve_hash_name,
                 workunit_factory, workunit_name):
    """Execute Ivy with the given ivy.xml and copies all relevant files into the workdir.

    This method does an Ivy resolve, which may be either a Pants resolve or a Pants fetch depending
    on whether there is an existing frozen resolution.

    After it is run, the Ivy reports are copied into the workdir at the paths specified by
    workdir_report_paths_by_conf along with a file containing a list of all the requested artifacts
    and their transitive dependencies.

    :param executor: A JVM executor to use to invoke ivy.
    :param extra_args: Extra arguments to pass to ivy.
    :param ivyxml: The input ivy.xml containing the dependencies to resolve.
    :param jvm_options: A list of jvm option strings to use for the ivy invoke, or None.
    :param workdir_report_paths_by_conf: A dict mapping confs to report paths in the workdir.
    :param confs: The confs used in the resolve.
    :param resolve_hash_name: The hash to use as the module name for finding the ivy report file.
    :param workunit_factory: A workunit factory for the ivy invoke, or None.
    :param workunit_name: A workunit name for the ivy invoke, or None.
    """
    ivy = Bootstrapper.default_ivy(bootstrap_workunit_factory=workunit_factory)

    with safe_concurrent_creation(ivy_cache_classpath_filename) as raw_target_classpath_file_tmp:
      extra_args = extra_args or []
      args = ['-cachepath', raw_target_classpath_file_tmp] + extra_args

      with cls._ivy_lock:
        cls._exec_ivy(ivy, confs, ivyxml, args,
                      jvm_options=jvm_options,
                      executor=executor,
                      workunit_name=workunit_name,
                      workunit_factory=workunit_factory)

      if not os.path.exists(raw_target_classpath_file_tmp):
        raise cls.IvyError('Ivy failed to create classpath file at {}'
                           .format(raw_target_classpath_file_tmp))

      cls._copy_ivy_reports(workdir_report_paths_by_conf, confs, ivy_cache_dir, resolve_hash_name)

    logger.debug('Moved ivy classfile file to {dest}'
                 .format(dest=ivy_cache_classpath_filename))
开发者ID:aaronmitchell,项目名称:pants,代码行数:45,代码来源:ivy_utils.py

示例13: exec_ivy

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def exec_ivy(self,
               target_workdir,
               targets,
               args,
               executor=None,
               confs=None,
               ivy=None,
               workunit_name='ivy',
               jars=None,
               use_soft_excludes=False,
               resolve_hash_name=None):
    ivy_jvm_options = copy.copy(self.get_options().jvm_options)
    # Disable cache in File.getCanonicalPath(), makes Ivy work with -symlink option properly on ng.
    ivy_jvm_options.append('-Dsun.io.useCanonCaches=false')

    ivy = ivy or Bootstrapper.default_ivy()
    ivyxml = os.path.join(target_workdir, 'ivy.xml')

    if not jars:
      automatic_excludes = self.get_options().automatic_excludes
      jars, excludes = IvyUtils.calculate_classpath(targets,
                                                    gather_excludes=not use_soft_excludes,
                                                    automatic_excludes=automatic_excludes)
    else:
      excludes = set()

    ivy_args = ['-ivy', ivyxml]

    confs_to_resolve = confs or ['default']
    ivy_args.append('-confs')
    ivy_args.extend(confs_to_resolve)
    ivy_args.extend(args)

    with IvyUtils.ivy_lock:
      IvyUtils.generate_ivy(targets, jars, excludes, ivyxml, confs_to_resolve, resolve_hash_name)
      runner = ivy.runner(jvm_options=ivy_jvm_options, args=ivy_args, executor=executor)
      try:
        result = execute_runner(runner, workunit_factory=self.context.new_workunit,
                                workunit_name=workunit_name)
        if result != 0:
          raise TaskError('Ivy returned {result}. cmd={cmd}'.format(result=result, cmd=runner.cmd))
      except runner.executor.Error as e:
        raise TaskError(e)
开发者ID:digwanderlust,项目名称:pants,代码行数:45,代码来源:ivy_task_mixin.py

示例14: publish

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def publish(self, ivyxml_path, jar, entry, repo, published):
    """Run ivy to publish a jar.  ivyxml_path is the path to the ivy file; published
    is a list of jars published so far (including this one). entry is a pushdb entry."""
    jvm_options = self._ivy_jvm_options(repo)
    resolver = repo['resolver']
    path = repo.get('path')

    try:
      ivy = Bootstrapper.default_ivy()
    except Bootstrapper.Error as e:
      raise TaskError('Failed to push {0}! {1}'.format(pushdb_coordinate(jar, entry), e))

    ivysettings = self.generate_ivysettings(ivy, published, publish_local=path)
    args = [
      '-settings', ivysettings,
      '-ivy', ivyxml_path,
      '-deliverto', '%s/[organisation]/[module]/ivy-[revision].xml' % self.workdir,
      '-publish', resolver,
      '-publishpattern', '%s/[organisation]/[module]/'
                         '[artifact]-[revision](-[classifier]).[ext]' % self.workdir,
      '-revision', entry.version().version(),
      '-m2compatible',
    ]

    # TODO(John Sirois): global logging options should be hidden behind some sort of log manager
    # that we can:
    # a.) obtain a handle to (dependency injection or manual plumbing)
    # b.) query for log detail, ie: `if log_manager.is_verbose:`
    if self.get_options().level == 'debug':
      args.append('-verbose')

    if self.local_snapshot:
      args.append('-overwrite')

    try:
      ivy.execute(jvm_options=jvm_options, args=args,
                  workunit_factory=self.context.new_workunit, workunit_name='jar-publish')
    except Ivy.Error as e:
      raise TaskError('Failed to push {0}! {1}'.format(pushdb_coordinate(jar, entry), e))
开发者ID:dominichamon,项目名称:pants,代码行数:41,代码来源:jar_publish.py

示例15: _do_resolve

# 需要导入模块: from pants.ivy.bootstrapper import Bootstrapper [as 别名]
# 或者: from pants.ivy.bootstrapper.Bootstrapper import default_ivy [as 别名]
  def _do_resolve(self, confs, executor, extra_args, global_vts, pinned_artifacts,
                       raw_target_classpath_file, resolve_hash_name, resolve_workdir,
                       workunit_name):
    safe_mkdir(resolve_workdir)
    ivy = Bootstrapper.default_ivy(bootstrap_workunit_factory=self.context.new_workunit)

    with safe_concurrent_creation(raw_target_classpath_file) as raw_target_classpath_file_tmp:
      args = ['-cachepath', raw_target_classpath_file_tmp] + extra_args

      targets = global_vts.targets
      # TODO(John Sirois): merge the code below into IvyUtils or up here; either way, better
      # diagnostics can be had in `IvyUtils.generate_ivy` if this is done.
      # See: https://github.com/pantsbuild/pants/issues/2239
      jars, global_excludes = IvyUtils.calculate_classpath(targets)

      # Don't pass global excludes to ivy when using soft excludes.
      if self.get_options().soft_excludes:
        global_excludes = []

      ivyxml = self._ivy_xml_path(resolve_workdir)
      with IvyUtils.ivy_lock:
        try:
          IvyUtils.generate_ivy(targets, jars, global_excludes, ivyxml, confs,
                                resolve_hash_name, pinned_artifacts)
        except IvyUtils.IvyError as e:
          raise self.Error('Failed to prepare ivy resolve: {}'.format(e))

        self._exec_ivy(ivy, executor, confs, ivyxml, args, workunit_name)

        # Copy ivy resolve file into resolve workdir.
        for conf in confs:
          atomic_copy(IvyUtils.xml_report_path(self.ivy_cache_dir, resolve_hash_name, conf),
                      self._resolve_report_path(resolve_workdir, conf))

      if not os.path.exists(raw_target_classpath_file_tmp):
        raise self.Error('Ivy failed to create classpath file at {}'
                         .format(raw_target_classpath_file_tmp))

    logger.debug('Moved ivy classfile file to {dest}'.format(dest=raw_target_classpath_file))
开发者ID:ahamilton55,项目名称:pants,代码行数:41,代码来源:ivy_task_mixin.py


注:本文中的pants.ivy.bootstrapper.Bootstrapper.default_ivy方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。