def __init__(self, *args, **kwargs): super(IvyResolve, self).__init__(*args, **kwargs) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._confs = self.context.config.getlist(self._CONFIG_SECTION, 'confs', default=['default']) self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = self.get_options().outdir or os.path.join( self.workdir, 'reports') self._open = self.get_options().open self._report = self._open or self.get_options().report self._ivy_bootstrap_key = 'ivy' self.register_jvm_tool_from_config(self._ivy_bootstrap_key, self.context.config, ini_section=self._CONFIG_SECTION, ini_key='bootstrap-tools', default=['//:xalan']) self._ivy_utils = IvyUtils(config=self.context.config, log=self.context.log) # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache_from_config( config_section=self._CONFIG_SECTION)
def __init__(self, context, workdir, confs=None): super(IvyResolve, self).__init__(context, workdir) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._confs = confs or context.config.getlist( 'ivy-resolve', 'confs', default=['default']) self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = context.options.ivy_resolve_outdir or os.path.join( self.workdir, 'reports') self._open = context.options.ivy_resolve_open self._report = self._open or context.options.ivy_resolve_report self._ivy_bootstrap_key = 'ivy' ivy_bootstrap_tools = context.config.getlist('ivy-resolve', 'bootstrap-tools', ':xalan') self.register_jvm_tool(self._ivy_bootstrap_key, ivy_bootstrap_tools) self._ivy_utils = IvyUtils(config=context.config, options=context.options, log=context.log) context.products.require_data('exclusives_groups') # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache_from_config(config_section='ivy-resolve')
def test_depmap_jar_path(self): with temporary_dir(root_dir=self.workdir_root()) as workdir: test_target = 'examples/tests/java/com/pants/examples/usethrift:usethrift' json_data = self.run_depmap_project_info(test_target, workdir) ivy_cache_dir = Bootstrapper.instance().ivy_cache_dir self.assertEquals(json_data.get('libraries').get('commons-lang:commons-lang:2.5'), [os.path.join(ivy_cache_dir, 'commons-lang/commons-lang/jars/commons-lang-2.5.jar')])
def test_simple(self): bootstrapper = Bootstrapper.instance() ivy = bootstrapper.ivy() self.assertIsNotNone(ivy.ivy_cache_dir) self.assertIsNone(ivy.ivy_settings) bootstrap_jar_path = os.path.join(self.test_workdir, 'tools', 'jvm', 'ivy', 'bootstrap.jar') self.assertTrue(os.path.exists(bootstrap_jar_path))
def test_depmap_jar_path(self): with temporary_dir(root_dir=self.workdir_root()) as workdir: test_target = 'examples/tests/java/com/pants/examples/usethrift:usethrift' json_data = self.run_depmap_project_info(test_target, workdir) # Hack because Bootstrapper.instance() reads config from cache. Will go away after we plumb # options into IvyUtil properly. Config.cache(Config.load()) ivy_cache_dir = Bootstrapper.instance().ivy_cache_dir self.assertEquals(json_data.get('libraries').get('commons-lang:commons-lang:2.5'), [os.path.join(ivy_cache_dir, 'commons-lang/commons-lang/jars/commons-lang-2.5.jar')])
def test_depmap_jar_path(self): with temporary_dir(root_dir=self.workdir_root()) as workdir: test_target = 'examples/tests/java/com/pants/examples/usethrift:usethrift' json_data = self.run_depmap_project_info(test_target, workdir) # Hack because Bootstrapper.instance() reads config from cache. Will go away after we plumb # options into IvyUtil properly. Config.cache(Config.load()) ivy_cache_dir = Bootstrapper.instance().ivy_cache_dir self.assertEquals( json_data.get('libraries').get( 'commons-lang:commons-lang:2.5'), [ os.path.join( ivy_cache_dir, 'commons-lang/commons-lang/jars/commons-lang-2.5.jar') ])
def __init__(self, *args, **kwargs): super(IvyResolve, self).__init__(*args, **kwargs) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._confs = self.context.config.getlist(self._CONFIG_SECTION, 'confs', default=['default']) self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = self.get_options().outdir or os.path.join(self.workdir, 'reports') self._open = self.get_options().open self._report = self._open or self.get_options().report self._ivy_utils = IvyUtils(config=self.context.config, log=self.context.log) # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache_from_config(config_section=self._CONFIG_SECTION)
def __init__(self, *args, **kwargs): super(IvyResolve, self).__init__(*args, **kwargs) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = self.get_options().outdir or os.path.join(self.workdir, 'reports') self._open = self.get_options().open self._report = self._open or self.get_options().report self._confs = None self._args = [] for arg in self.get_options().args: self._args.extend(safe_shlex_split(arg)) # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache()
def __init__(self, *args, **kwargs): super(IvyResolve, self).__init__(*args, **kwargs) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = self.get_options().outdir or os.path.join( self.workdir, 'reports') self._open = self.get_options().open self._report = self._open or self.get_options().report self._confs = None self._args = [] for arg in self.get_options().args: self._args.extend(safe_shlex_split(arg)) # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache()
def test_export_jar_path(self): with temporary_dir(root_dir=self.workdir_root()) as workdir: test_target = 'examples/tests/java/org/pantsbuild/example/usethrift:usethrift' json_data = self.run_export(test_target, workdir, self._resolve_args) # Hack because Bootstrapper.instance() reads config from cache. Will go away after we plumb # options into IvyUtil properly. Config.cache(Config.load()) ivy_cache_dir = Bootstrapper.instance().ivy_cache_dir common_lang_lib_info = json_data.get('libraries').get('commons-lang:commons-lang:2.5') self.assertIsNotNone(common_lang_lib_info) self.assertEquals( common_lang_lib_info.get('default'), os.path.join(ivy_cache_dir, 'commons-lang/commons-lang/jars/commons-lang-2.5.jar') ) self.assertEquals( common_lang_lib_info.get('javadoc'), os.path.join(ivy_cache_dir, 'commons-lang/commons-lang/javadocs/commons-lang-2.5-javadoc.jar') ) self.assertEquals( common_lang_lib_info.get('sources'), os.path.join(ivy_cache_dir, 'commons-lang/commons-lang/sources/commons-lang-2.5-sources.jar') )
def __init__(self, context, workdir, confs=None): super(IvyResolve, self).__init__(context, workdir) self._ivy_bootstrapper = Bootstrapper.instance() self._cachedir = self._ivy_bootstrapper.ivy_cache_dir self._confs = confs or context.config.getlist('ivy-resolve', 'confs', default=['default']) self._classpath_dir = os.path.join(self.workdir, 'mapped') self._outdir = context.options.ivy_resolve_outdir or os.path.join(self.workdir, 'reports') self._open = context.options.ivy_resolve_open self._report = self._open or context.options.ivy_resolve_report self._ivy_bootstrap_key = 'ivy' ivy_bootstrap_tools = context.config.getlist('ivy-resolve', 'bootstrap-tools', ':xalan') self.register_jvm_tool(self._ivy_bootstrap_key, ivy_bootstrap_tools) self._ivy_utils = IvyUtils(config=context.config, options=context.options, log=context.log) context.products.require_data('exclusives_groups') # Typically this should be a local cache only, since classpaths aren't portable. self.setup_artifact_cache_from_config(config_section='ivy-resolve')
def xml_report_path(self, targets, conf): """The path to the xml report ivy creates after a retrieve.""" org, name = self.identify(targets) cachedir = Bootstrapper.instance().ivy_cache_dir return os.path.join(cachedir, '%s-%s-%s.xml' % (org, name, conf))
def test_reset(self): bootstrapper1 = Bootstrapper.instance() Bootstrapper.reset_instance() bootstrapper2 = Bootstrapper.instance() self.assertNotEqual(bootstrapper1, bootstrapper2)
def test_simple(self): bootstrapper = Bootstrapper.instance() ivy = bootstrapper.ivy() self.assertIsNotNone(ivy.ivy_cache_dir) self.assertIsNotNone(ivy.ivy_settings)
def test_reset(self): with subsystem_instance(IvySubsystem): bootstrapper1 = Bootstrapper.instance() Bootstrapper.reset_instance() bootstrapper2 = Bootstrapper.instance() self.assertIsNot(bootstrapper1, bootstrapper2)
def xml_report_path(cls, targets, conf): """The path to the xml report ivy creates after a retrieve.""" org, name = cls.identify(targets) cachedir = Bootstrapper.instance().ivy_cache_dir return os.path.join(cachedir, '{}-{}-{}.xml'.format(org, name, conf))