本文整理汇总了Python中twitter.pants.tasks.nailgun_task.NailgunTask.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python NailgunTask.__init__方法的具体用法?Python NailgunTask.__init__怎么用?Python NailgunTask.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类twitter.pants.tasks.nailgun_task.NailgunTask
的用法示例。
在下文中一共展示了NailgunTask.__init__方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, workdir=None):
NailgunTask.__init__(self, context, workdir=context.config.get('scala-compile', 'nailgun_dir'))
# Set up the zinc utils.
color = context.options.scala_compile_color or \
context.config.getbool('scala-compile', 'color', default=True)
self._zinc_utils = ZincUtils(context=context, java_runner=self.runjava, color=color)
# The rough number of source files to build in each compiler pass.
self._partition_size_hint = \
context.options.scala_compile_partition_size_hint \
if context.options.scala_compile_partition_size_hint != -1 else \
context.config.getint('scala-compile', 'partition_size_hint')
# Set up dep checking if needed.
if context.options.scala_check_missing_deps:
JvmDependencyCache.init_product_requirements(self)
# Various output directories.
self._buildroot = get_buildroot()
workdir = context.config.get('scala-compile', 'workdir') if workdir is None else workdir
self._resources_dir = os.path.join(workdir, 'resources')
self._artifact_factory = ZincArtifactFactory(workdir, self.context, self._zinc_utils)
# The ivy confs for which we're building.
self._confs = context.config.getlist('scala-compile', 'confs')
# The artifact cache to read from/write to.
artifact_cache_spec = context.config.getlist('scala-compile', 'artifact_caches')
self.setup_artifact_cache(artifact_cache_spec)
示例2: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
NailgunTask.__init__(self, context, workdir=context.config.get('java-compile', 'nailgun_dir'))
self._partition_size_hint = \
context.options.java_compile_partition_size_hint \
if context.options.java_compile_partition_size_hint != -1 \
else context.config.getint('java-compile', 'partition_size_hint')
workdir = context.config.get('java-compile', 'workdir')
self._classes_dir = os.path.join(workdir, 'classes')
self._resources_dir = os.path.join(workdir, 'resources')
self._depfile_dir = os.path.join(workdir, 'depfiles')
self._deps = Dependencies(self._classes_dir)
self._jmake_profile = context.config.get('java-compile', 'jmake-profile')
self._compiler_profile = context.config.get('java-compile', 'compiler-profile')
self._args = context.config.getlist('java-compile', 'args')
self._jvm_args = context.config.getlist('java-compile', 'jvm_args')
if context.options.java_compile_warnings:
self._args.extend(context.config.getlist('java-compile', 'warning_args'))
else:
self._args.extend(context.config.getlist('java-compile', 'no_warning_args'))
self._confs = context.config.getlist('java-compile', 'confs')
# The artifact cache to read from/write to.
artifact_cache_spec = context.config.getlist('java-compile', 'artifact_caches')
self.setup_artifact_cache(artifact_cache_spec)
示例3: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
NailgunTask.__init__(self, context, workdir=context.config.get('scala-compile', 'nailgun_dir'))
self._compile_profile = context.config.get('scala-compile', 'compile-profile')
self._depemitter_profile = context.config.get('scala-compile', 'dependencies-plugin-profile')
# All scala targets implicitly depend on the selected scala runtime.
scaladeps = []
for spec in context.config.getlist('scala-compile', 'scaladeps'):
scaladeps.extend(context.resolve(spec))
for target in context.targets(is_scala):
target.update_dependencies(scaladeps)
workdir = context.config.get('scala-compile', 'workdir')
self._classes_dir = os.path.join(workdir, 'classes')
self._resources_dir = os.path.join(workdir, 'resources')
self._main = context.config.get('scala-compile', 'main')
self._args = context.config.getlist('scala-compile', 'args')
if context.options.scala_compile_warnings:
self._args.extend(context.config.getlist('scala-compile', 'warning_args'))
else:
self._args.extend(context.config.getlist('scala-compile', 'no_warning_args'))
self._confs = context.config.getlist('scala-compile', 'confs')
self._depfile = os.path.join(workdir, 'dependencies')
示例4: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
NailgunTask.__init__(self, context, workdir=context.config.get("java-compile", "nailgun_dir"))
self._partition_size_hint = (
context.options.java_compile_partition_size_hint
if context.options.java_compile_partition_size_hint != -1
else context.config.getint("java-compile", "partition_size_hint")
)
workdir = context.config.get("java-compile", "workdir")
self._classes_dir = os.path.join(workdir, "classes")
self._resources_dir = os.path.join(workdir, "resources")
self._depfile_dir = os.path.join(workdir, "depfiles")
self._deps = Dependencies(self._classes_dir)
self._jmake_profile = context.config.get("java-compile", "jmake-profile")
self._compiler_profile = context.config.get("java-compile", "compiler-profile")
self._args = context.config.getlist("java-compile", "args")
self._jvm_args = context.config.getlist("java-compile", "jvm_args")
if context.options.java_compile_warnings:
self._args.extend(context.config.getlist("java-compile", "warning_args"))
else:
self._args.extend(context.config.getlist("java-compile", "no_warning_args"))
self._confs = context.config.getlist("java-compile", "confs")
# The artifact cache to read from/write to.
artifact_cache_spec = context.config.getlist("java-compile", "artifact_caches")
self.setup_artifact_cache(artifact_cache_spec)
示例5: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, output_dir=None, classpath=None, main=None, args=None, confs=None):
workdir = context.config.get('scala-compile', 'nailgun_dir')
NailgunTask.__init__(self, context, workdir=workdir)
self._compile_profile = context.config.get('scala-compile', 'compile-profile')
# All scala targets implicitly depend on the selected scala runtime.
scaladeps = []
for spec in context.config.getlist('scala-compile', 'scaladeps'):
scaladeps.extend(context.resolve(spec))
for target in context.targets(is_scala):
target.update_dependencies(scaladeps)
self._compiler_classpath = classpath
self._output_dir = output_dir or context.config.get('scala-compile', 'workdir')
self._main = main or context.config.get('scala-compile', 'main')
self._args = args or context.config.getlist('scala-compile', 'args')
if context.options.scala_compile_warnings:
self._args.extend(context.config.getlist('scala-compile', 'warning_args'))
else:
self._args.extend(context.config.getlist('scala-compile', 'no_warning_args'))
self._confs = confs or context.config.getlist('scala-compile', 'confs')
self._depfile = os.path.join(self._output_dir, 'dependencies')
示例6: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, workdir=None):
NailgunTask.__init__(self, context, workdir=context.config.get('scala-compile', 'nailgun_dir'))
color = context.options.scala_compile_color or \
context.config.getbool('scala-compile', 'color', default=True)
self._zinc_utils = ZincUtils(context=context, java_runner=self.runjava, color=color)
self._partition_size_hint = \
context.options.scala_compile_partition_size_hint \
if context.options.scala_compile_partition_size_hint != -1 else \
context.config.getint('scala-compile', 'partition_size_hint')
self.check_missing_deps = context.options.scala_check_missing_deps
self.check_intransitive_deps = context.options.scala_check_intransitive_deps
self.check_unnecessary_deps = context.options.scala_check_unnecessary_deps
if self.check_missing_deps:
JvmDependencyCache.init_product_requirements(self)
# for dependency analysis, we need to record the list of analysis cache files generated by splitting
self.generated_caches = set()
workdir = context.config.get('scala-compile', 'workdir') if workdir is None else workdir
self._classes_dir = os.path.join(workdir, 'classes')
self._analysis_cache_dir = os.path.join(workdir, 'analysis_cache')
self._resources_dir = os.path.join(workdir, 'resources')
self._depfile_dir = os.path.join(workdir, 'depfiles')
self._confs = context.config.getlist('scala-compile', 'confs')
artifact_cache_spec = context.config.getlist('scala-compile', 'artifact_caches')
self.setup_artifact_cache(artifact_cache_spec)
示例7: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, confs=None):
classpath = context.config.getlist('ivy', 'classpath')
nailgun_dir = context.config.get('ivy-resolve', 'nailgun_dir')
NailgunTask.__init__(self, context, classpath=classpath, workdir=nailgun_dir)
self._cachedir = context.options.ivy_resolve_cache or context.config.get('ivy', 'cache_dir')
self._confs = confs or context.config.getlist('ivy-resolve', 'confs')
self._work_dir = context.config.get('ivy-resolve', 'workdir')
self._classpath_dir = os.path.join(self._work_dir, 'mapped')
self._outdir = context.options.ivy_resolve_outdir or os.path.join(self._work_dir, '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._bootstrap_utils.register_jvm_build_tools(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.
artifact_cache_spec = context.config.getlist('ivy-resolve', 'artifact_caches', default=[])
self.setup_artifact_cache(artifact_cache_spec)
示例8: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
NailgunTask.__init__(self, context, workdir=context.config.get('java-compile', 'nailgun_dir'))
self._flatten = \
context.options.java_compile_flatten if context.options.java_compile_flatten is not None else \
context.config.getbool('java-compile', 'default_to_flatten')
workdir = context.config.get('java-compile', 'workdir')
self._classes_dir = os.path.join(workdir, 'classes')
self._resources_dir = os.path.join(workdir, 'resources')
self._depfile_dir = os.path.join(workdir, 'depfiles')
self._deps = Dependencies(self._classes_dir)
self._jmake_profile = context.config.get('java-compile', 'jmake-profile')
self._compiler_profile = context.config.get('java-compile', 'compiler-profile')
self._args = context.config.getlist('java-compile', 'args')
self._jvm_args = context.config.getlist('java-compile', 'jvm_args')
if context.options.java_compile_warnings:
self._args.extend(context.config.getlist('java-compile', 'warning_args'))
else:
self._args.extend(context.config.getlist('java-compile', 'no_warning_args'))
self._confs = context.config.getlist('java-compile', 'confs')
示例9: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, workdir):
NailgunTask.__init__(self, context, workdir=workdir)
concrete_class = self.__class__
config_section = concrete_class._config_section
def get_lang_specific_option(opt):
full_opt_name = self.language() + '_' + opt
return getattr(context.options, full_opt_name, None)
# Various working directories.
workdir = context.config.get(config_section, 'workdir')
self._classes_dir = os.path.join(workdir, 'classes')
self._resources_dir = os.path.join(workdir, 'resources')
self._analysis_dir = os.path.join(workdir, 'analysis')
safe_mkdir(self._classes_dir)
safe_mkdir(self._analysis_dir)
# A temporary, but well-known, dir to munge analysis/dependency files in before caching.
# It must be well-known so we know where to find the files when we retrieve them from the cache.
self._analysis_tmpdir = os.path.join(self._analysis_dir, 'artifact_cache_tmpdir')
# Compiler options.
self._opts = context.config.getlist(config_section, 'args')
if get_lang_specific_option('compile_warnings'):
self._opts.extend(context.config.getlist(config_section, 'warning_args'))
else:
self._opts.extend(context.config.getlist(config_section, 'no_warning_args'))
# The rough number of source files to build in each compiler pass.
self._partition_size_hint = get_lang_specific_option('partition_size_hint')
if self._partition_size_hint == -1:
self._partition_size_hint = \
context.config.getint(config_section, 'partition_size_hint', default=1000)
# JVM args for running the compiler.
self._jvm_args = context.config.getlist(config_section, 'jvm_args')
# The ivy confs for which we're building.
self._confs = context.config.getlist(config_section, 'confs')
# Set up dep checking if needed.
def munge_flag(flag):
return None if flag == 'off' else flag
check_missing_deps = munge_flag(get_lang_specific_option('missing_deps'))
check_missing_direct_deps = munge_flag(get_lang_specific_option('missing_direct_deps'))
check_unnecessary_deps = munge_flag(get_lang_specific_option('unnecessary_deps'))
if check_missing_deps or check_missing_direct_deps or check_unnecessary_deps:
# Must init it here, so it can set requirements on the context.
self._dep_analyzer = JvmDependencyAnalyzer(self.context,
check_missing_deps,
check_missing_direct_deps,
check_unnecessary_deps)
else:
self._dep_analyzer = None
self.context.products.require_data('exclusives_groups')
self.setup_artifact_cache_from_config(config_section=config_section)
示例10: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
NailgunTask.__init__(self, context, workdir=context.config.get('scala-compile', 'nailgun_dir'))
# Set up the zinc utils.
color = not context.options.no_color
self._zinc_utils = ZincUtils(context=context, nailgun_task=self, color=color)
# The rough number of source files to build in each compiler pass.
self._partition_size_hint = (context.options.scala_compile_partition_size_hint
if context.options.scala_compile_partition_size_hint != -1
else context.config.getint('scala-compile', 'partition_size_hint',
default=1000))
# Set up dep checking if needed.
if context.options.scala_check_missing_deps:
JvmDependencyCache.init_product_requirements(self)
self._opts = context.config.getlist('scala-compile', 'args')
if context.options.scala_compile_warnings:
self._opts.extend(context.config.getlist('scala-compile', 'warning_args'))
else:
self._opts.extend(context.config.getlist('scala-compile', 'no_warning_args'))
# Various output directories.
workdir = context.config.get('scala-compile', 'workdir')
self._classes_dir = os.path.join(workdir, 'classes')
self._analysis_dir = os.path.join(workdir, 'analysis')
safe_mkdir(self._classes_dir)
safe_mkdir(self._analysis_dir)
self._analysis_file = os.path.join(self._analysis_dir, 'global_analysis.valid')
self._invalid_analysis_file = os.path.join(self._analysis_dir, 'global_analysis.invalid')
self._resources_dir = os.path.join(workdir, 'resources')
# The ivy confs for which we're building.
self._confs = context.config.getlist('scala-compile', 'confs')
self.context.products.require_data('exclusives_groups')
self._local_artifact_cache_spec = \
context.config.getlist('scala-compile', 'local_artifact_caches2', default=[])
self._remote_artifact_cache_spec = \
context.config.getlist('scala-compile', 'remote_artifact_caches2', default=[])
# A temporary, but well-known, dir to munge analysis files in before caching. It must be
# well-known so we know where to find the files when we retrieve them from the cache.
self._analysis_tmpdir = os.path.join(self._analysis_dir, 'artifact_cache_tmpdir')
# If we are compiling scala libraries with circular deps on java libraries we need to make sure
# those cycle deps are present.
self._inject_java_cycles()
# Sources present in the last analysis that have since been deleted.
# Generated lazily, so do not access directly. Call self._get_deleted_sources().
self._deleted_sources = None
示例11: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
self._profile = context.config.get('checkstyle', 'profile')
workdir = context.config.get('checkstyle', 'nailgun_dir')
NailgunTask.__init__(self, context, workdir=workdir)
self._configuration_file = context.config.get('checkstyle', 'configuration')
self._work_dir = context.config.get('checkstyle', 'workdir')
self._properties = context.config.getdict('checkstyle', 'properties')
self._confs = context.config.getlist('checkstyle', 'confs')
示例12: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context, strict=False, verbose=True):
NailgunTask.__init__(self, context)
self.strict = strict
self.verbose = verbose
for info in INFO_FOR_COMPILER.values():
config = info['config']
bootstrap_tools = context.config.getlist(config, 'bootstrap-tools',
default=[':%s' % config])
self._jvm_tool_bootstrapper.register_jvm_tool(config, bootstrap_tools)
示例13: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
CodeGen.__init__(self, context)
NailgunTask.__init__(self, context)
# TODO(John Sirois): kill if not needed by prepare_gen
self._classpath_by_compiler = {}
active_compilers = set(map(lambda t: t.compiler, context.targets(predicate=self.is_gentarget)))
for compiler, tools in self._all_possible_antlr_bootstrap_tools():
if compiler in active_compilers:
self._jvm_tool_bootstrapper.register_jvm_tool(compiler, tools)
示例14: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
self._profile = context.config.get('checkstyle', 'profile')
workdir = context.config.get('checkstyle', 'nailgun_dir')
NailgunTask.__init__(self, context, workdir=workdir)
self._configuration_file = context.config.get('checkstyle', 'configuration')
self._work_dir = context.config.get('checkstyle', 'workdir')
self._properties = context.config.getdict('checkstyle', 'properties')
self._confs = context.config.getlist('checkstyle', 'confs')
self.context.products.require_data('exclusives_groups')
示例15: __init__
# 需要导入模块: from twitter.pants.tasks.nailgun_task import NailgunTask [as 别名]
# 或者: from twitter.pants.tasks.nailgun_task.NailgunTask import __init__ [as 别名]
def __init__(self, context):
classpath = context.config.getlist('ivy', 'classpath')
nailgun_dir = context.config.get('ivy-resolve', 'nailgun_dir')
NailgunTask.__init__(self, context, classpath=classpath, workdir=nailgun_dir)
self._ivy_settings = context.config.get('ivy', 'ivy_settings')
self._cachedir = context.options.ivy_resolve_cache or context.config.get('ivy', 'cache_dir')
self._confs = context.config.getlist('ivy-resolve', 'confs')
self._transitive = context.config.getbool('ivy-resolve', 'transitive')
self._args = context.config.getlist('ivy-resolve', 'args')
self._profile = context.config.get('ivy-resolve', 'profile')
self._template_path = os.path.join('ivy_resolve', 'ivy.mustache')
self._work_dir = context.config.get('ivy-resolve', 'workdir')
self._classpath_file = os.path.join(self._work_dir, 'classpath')
self._classpath_dir = os.path.join(self._work_dir, 'mapped')
self._outdir = context.options.ivy_resolve_outdir or os.path.join(self._work_dir, 'reports')
self._open = context.options.ivy_resolve_open
self._report = self._open or context.options.ivy_resolve_report
self._ivy_utils = IvyUtils(context, self._cachedir)
def parse_override(override):
match = re.match(r'^([^#]+)#([^=]+)=([^\s]+)$', override)
if not match:
raise TaskError('Invalid dependency override: %s' % override)
org, name, rev_or_url = match.groups()
def fmt_message(message, template):
return message % dict(
overridden='%s#%s;%s' % (template.org, template.module, template.version),
rev=rev_or_url,
url=rev_or_url
)
def replace_rev(template):
context.log.info(fmt_message('Overrode %(overridden)s with rev %(rev)s', template))
return template.extend(version=rev_or_url, url=None, force=True)
def replace_url(template):
context.log.info(fmt_message('Overrode %(overridden)s with snapshot at %(url)s', template))
return template.extend(version='SNAPSHOT', url=rev_or_url, force=True)
replace = replace_url if re.match(r'^\w+://.+', rev_or_url) else replace_rev
return (org, name), replace
self._overrides = {}
if context.options.ivy_resolve_overrides:
self._overrides.update(parse_override(o) for o in context.options.ivy_resolve_overrides)