def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path).""" deprecated_conditional( lambda: JvmResolveSubsystem.global_instance().get_options( ).resolver == "ivy", removal_version="1.27.0.dev0", entity_description="Ivy Resolve", hint_message= "resolve.ivy as well as --resolver-resolver=ivy will be removed." "Please use --resolver-resolver=coursier instead and refer to " "https://www.pantsbuild.org/jvm_projects.html#coursier for setup.", ) if JvmResolveSubsystem.global_instance().get_options( ).resolver != "ivy": return compile_classpath = self.context.products.get_data( "compile_classpath", init_func=ClasspathProducts.init_func( self.get_options().pants_workdir), ) targets = self.context.targets() if all(not isinstance(target, JarLibrary) for target in targets): if self._report: self.context.log.info( "Not generating a report. No resolution performed.") return confs = self.get_options().confs if "sources" not in confs and self.context.products.is_required_data( "resolve_sources_signal"): confs.append("sources") if "javadoc" not in confs and self.context.products.is_required_data( "resolve_javadocs_signal"): confs.append("javadoc") executor = self.create_java_executor() results = self.resolve( executor=executor, targets=targets, classpath_products=compile_classpath, confs=confs, extra_args=self._args, ) if self._report: results_with_resolved_artifacts = [ r for r in results if r.has_resolved_artifacts ] if not results_with_resolved_artifacts: self.context.log.info( "Not generating a report. No resolution performed.") else: for result in results_with_resolved_artifacts: self._generate_ivy_report(result)
def resolve_jars(self, targets): # TODO: Why is this computed directly here instead of taking from the actual product # computed by the {Ivy,Coursier}Resolve task? executor = SubprocessExecutor(DistributionLocator.cached()) confs = [] if self.get_options().libraries: confs.append('default') if self.get_options().libraries_sources: confs.append('sources') if self.get_options().libraries_javadocs: confs.append('javadoc') compile_classpath = None if confs: compile_classpath = ClasspathProducts( self.get_options().pants_workdir) if JvmResolveSubsystem.global_instance().get_options( ).resolver == 'ivy': IvyTaskMixin.resolve(self, executor=executor, targets=targets, classpath_products=compile_classpath, confs=confs) else: CoursierMixin.resolve( self, targets, compile_classpath, sources=self.get_options().libraries_sources, javadoc=self.get_options().libraries_javadocs, executor=executor) return compile_classpath
def resolve_jars(self, targets): # TODO: Why is this computed directly here instead of taking from the actual product # computed by the {Ivy,Coursier}Resolve task? executor = SubprocessExecutor(DistributionLocator.cached()) confs = [] if self.get_options().libraries: confs.append('default') if self.get_options().libraries_sources: confs.append('sources') if self.get_options().libraries_javadocs: confs.append('javadoc') compile_classpath = None if confs: compile_classpath = ClasspathProducts(self.get_options().pants_workdir) if JvmResolveSubsystem.global_instance().get_options().resolver == 'ivy': IvyTaskMixin.resolve(self, executor=executor, targets=targets, classpath_products=compile_classpath, confs=confs) else: CoursierMixin.resolve(self, targets, compile_classpath, sources=self.get_options().libraries_sources, javadoc=self.get_options().libraries_javadocs, executor=executor) return compile_classpath
def resolve_jars(self, targets): executor = SubprocessExecutor(DistributionLocator.cached()) confs = [] if self.get_options().libraries: confs.append('default') if self.get_options().libraries_sources: confs.append('sources') if self.get_options().libraries_javadocs: confs.append('javadoc') compile_classpath = None if confs: compile_classpath = ClasspathProducts( self.get_options().pants_workdir) if JvmResolveSubsystem.global_instance().get_options( ).resolver == 'ivy': IvyTaskMixin.resolve(self, executor=executor, targets=targets, classpath_products=compile_classpath, confs=confs) else: CoursierMixin.resolve( self, targets, compile_classpath, sources=self.get_options().libraries_sources, javadoc=self.get_options().libraries_javadocs) return compile_classpath
def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path). """ if JvmResolveSubsystem.global_instance().get_options().resolver != 'ivy': return compile_classpath = self.context.products.get_data('compile_classpath', init_func=ClasspathProducts.init_func(self.get_options().pants_workdir)) targets = self.context.targets() if all(not isinstance(target, JarLibrary) for target in targets): if self._report: self.context.log.info("Not generating a report. No resolution performed.") return executor = self.create_java_executor() results = self.resolve(executor=executor, targets=targets, classpath_products=compile_classpath, confs=self.get_options().confs, extra_args=self._args) if self._report: results_with_resolved_artifacts = filter(lambda r: r.has_resolved_artifacts, results) if not results_with_resolved_artifacts: self.context.log.info("Not generating a report. No resolution performed.") else: for result in results_with_resolved_artifacts: self._generate_ivy_report(result)
def _bootstrap_classpath(self, jvm_tool, targets): self._check_underspecified_tools(jvm_tool, targets) workunit_name = 'bootstrap-{}'.format(jvm_tool.key) if JvmResolveSubsystem.global_instance().get_options().resolver == 'ivy': ivy_classpath = self.ivy_classpath(targets, silent=True, workunit_name=workunit_name) return ivy_classpath else: classpath_holder = ClasspathProducts(self.get_options().pants_workdir) CoursierMixin.resolve(self, targets, classpath_holder, sources=False, javadoc=False, executor=None) coursier_classpath = [cp_entry for _, cp_entry in classpath_holder.get_for_targets(targets)] return coursier_classpath
def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path). """ jvm_resolve_subsystem = JvmResolveSubsystem.global_instance() if jvm_resolve_subsystem.get_options().resolver != 'coursier': return # executor = self.create_java_executor() classpath_products = self.context.products.get_data('compile_classpath', init_func=ClasspathProducts.init_func( self.get_options().pants_workdir)) executor = self.create_java_executor() self.resolve(self.context.targets(), classpath_products, sources=False, javadoc=False, executor=executor)
def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path). """ jvm_resolve_subsystem = JvmResolveSubsystem.global_instance() if jvm_resolve_subsystem.get_options().resolver != 'coursier': return # executor = self.create_java_executor() classpath_products = self.context.products.get_data('compile_classpath', init_func=ClasspathProducts.init_func( self.get_options().pants_workdir)) self.resolve(self.context.targets(), classpath_products, sources=False, javadoc=False)
def _bootstrap_classpath(self, jvm_tool, targets): self._check_underspecified_tools(jvm_tool, targets) self.context.log.debug(f"Bootstrapping {jvm_tool.key}") classpath_holder = ClasspathProducts(self.get_options().pants_workdir) if JvmResolveSubsystem.global_instance().get_options( ).resolver == "ivy": self.resolve(executor=None, targets=targets, classpath_products=classpath_holder) else: CoursierMixin.resolve(self, targets, classpath_holder, sources=False, javadoc=False, executor=None) return [ cp_entry for _, cp_entry in classpath_holder.get_classpath_entries_for_targets(targets) ]
def _bootstrap_classpath(self, jvm_tool, targets): self._check_underspecified_tools(jvm_tool, targets) workunit_name = 'bootstrap-{}'.format(jvm_tool.key) if JvmResolveSubsystem.global_instance().get_options( ).resolver == 'ivy': ivy_classpath = self.ivy_classpath(targets, silent=True, workunit_name=workunit_name) return ivy_classpath else: classpath_holder = ClasspathProducts( self.get_options().pants_workdir) CoursierMixin.resolve(self, targets, classpath_holder, sources=False, javadoc=False, executor=None) coursier_classpath = [ cp_entry for _, cp_entry in classpath_holder.get_for_targets(targets) ] return coursier_classpath
def execute(self): """Resolves the specified confs for the configured targets and returns an iterator over tuples of (conf, jar path). """ if JvmResolveSubsystem.global_instance().get_options( ).resolver != 'ivy': return compile_classpath = self.context.products.get_data( 'compile_classpath', init_func=ClasspathProducts.init_func( self.get_options().pants_workdir)) targets = self.context.targets() if all(not isinstance(target, JarLibrary) for target in targets): if self._report: self.context.log.info( "Not generating a report. No resolution performed.") return executor = self.create_java_executor() results = self.resolve(executor=executor, targets=targets, classpath_products=compile_classpath, confs=self.get_options().confs, extra_args=self._args) if self._report: results_with_resolved_artifacts = [ r for r in results if r.has_resolved_artifacts ] if not results_with_resolved_artifacts: self.context.log.info( "Not generating a report. No resolution performed.") else: for result in results_with_resolved_artifacts: self._generate_ivy_report(result)