本文整理汇总了Python中pants.backend.jvm.subsystems.java.Java.global_instance方法的典型用法代码示例。如果您正苦于以下问题:Python Java.global_instance方法的具体用法?Python Java.global_instance怎么用?Python Java.global_instance使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类pants.backend.jvm.subsystems.java.Java
的用法示例。
在下文中一共展示了Java.global_instance方法的7个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: compute_dependency_specs
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def compute_dependency_specs(cls, kwargs=None, payload=None):
for spec in super(JavacPlugin, cls).compute_dependency_specs(kwargs, payload):
yield spec
yield (
Java.global_instance().injectables_spec_for_key('javac') or
Java.global_instance().injectables_spec_for_key('tools.jar')
)
示例2: javac_compiler_plugins_src
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def javac_compiler_plugins_src(self, zinc_compile_instance=None):
"""Returns an instance of JvmToolMixin that should provide javac compiler plugins.
TODO: Remove this method once the deprecation of `(scalac|javac)_plugins` on Zinc has
completed in `1.9.0.dev0`.
"""
return Zinc._select_jvm_tool_mixin(zinc_compile_instance,
Java.global_instance(),
['javac_plugins', 'javac_plugin_args', 'javac_plugin_dep'])
示例3: _compiler_plugins_cp_entries
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def _compiler_plugins_cp_entries(self):
"""Any additional global compiletime classpath entries for compiler plugins."""
java_options_src = Java.global_instance()
scala_options_src = ScalaPlatform.global_instance()
def cp(instance, toolname):
scope = instance.options_scope
return instance.tool_classpath_from_products(self._products, toolname, scope=scope)
classpaths = (cp(java_options_src, 'javac-plugin-dep') +
cp(scala_options_src, 'scalac-plugin-dep'))
return [(conf, ClasspathEntry(jar)) for conf in self.DEFAULT_CONFS for jar in classpaths]
示例4: _compile_vts
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def _compile_vts(self, vts, ctx, upstream_analysis, classpath, progress_message, settings,
compiler_option_sets, zinc_file_manager, counter):
"""Compiles sources for the given vts into the given output dir.
:param vts: VersionedTargetSet with one entry for the target.
:param ctx: - A CompileContext instance for the target.
:param classpath: A list of classpath entries
May be invoked concurrently on independent target sets.
Postcondition: The individual targets in vts are up-to-date, as if each were
compiled individually.
"""
if not ctx.sources:
self.context.log.warn('Skipping {} compile for targets with no sources:\n {}'
.format(self.name(), vts.targets))
else:
counter_val = str(counter()).rjust(counter.format_length(), b' ')
counter_str = '[{}/{}] '.format(counter_val, counter.size)
# Do some reporting.
self.context.log.info(
counter_str,
'Compiling ',
items_to_report_element(ctx.sources, '{} source'.format(self.name())),
' in ',
items_to_report_element([t.address.reference() for t in vts.targets], 'target'),
' (',
progress_message,
').')
with self.context.new_workunit('compile', labels=[WorkUnitLabel.COMPILER]) as compile_workunit:
if self.get_options().capture_classpath:
self._record_compile_classpath(classpath, vts.targets, ctx.classes_dir)
try:
self.compile(
ctx,
self._args,
classpath,
upstream_analysis,
settings,
compiler_option_sets,
zinc_file_manager,
self._get_plugin_map('javac', Java.global_instance(), ctx.target),
self._get_plugin_map('scalac', ScalaPlatform.global_instance(), ctx.target),
)
self._capture_logs(compile_workunit, ctx.log_dir)
except TaskError:
if self.get_options().suggest_missing_deps:
logs = [path
for _, name, _, path in self._find_logs(compile_workunit)
if name == self.name()]
if logs:
self._find_missing_deps(logs, ctx.target)
raise
示例5: defaulted_property
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def defaulted_property(self, target, option_name):
"""Computes a language property setting for the given JvmTarget.
:param selector A function that takes a target or platform and returns the boolean value of the
property for that target or platform, or None if that target or platform does
not directly define the property.
If the target does not override the language property, returns true iff the property
is true for any of the matched languages for the target.
"""
if target.has_sources('.java'):
matching_subsystem = Java.global_instance()
elif target.has_sources('.scala'):
matching_subsystem = ScalaPlatform.global_instance()
else:
return getattr(target, option_name)
return matching_subsystem.get_scalar_mirrored_target_option(option_name, target)
示例6: defaulted_property
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def defaulted_property(self, target, selector):
"""Computes a language property setting for the given JvmTarget.
:param selector A function that takes a target or platform and returns the boolean value of the
property for that target or platform, or None if that target or platform does
not directly define the property.
If the target does not override the language property, returns true iff the property
is true for any of the matched languages for the target.
"""
if selector(target) is not None:
return selector(target)
prop = False
if target.has_sources('.java'):
prop |= selector(Java.global_instance())
if target.has_sources('.scala'):
prop |= selector(ScalaPlatform.global_instance())
return prop
示例7: _compute_language_property
# 需要导入模块: from pants.backend.jvm.subsystems.java import Java [as 别名]
# 或者: from pants.backend.jvm.subsystems.java.Java import global_instance [as 别名]
def _compute_language_property(self, target, selector):
"""Computes the a language property setting for the given target sources.
:param target The target whose language property will be calculated.
:param selector A function that takes a target or platform and returns the boolean value of the
property for that target or platform, or None if that target or platform does
not directly define the property.
If the target does not override the language property, returns true iff the property
is true for any of the matched languages for the target.
"""
if selector(target) is not None:
return selector(target)
property = False
if target.has_sources(".java"):
property |= selector(Java.global_instance())
if target.has_sources(".scala"):
property |= selector(ScalaPlatform.global_instance())
return property