本文整理汇总了Python中twitter.pants.tasks.nailgun_task.NailgunTask类的典型用法代码示例。如果您正苦于以下问题:Python NailgunTask类的具体用法?Python NailgunTask怎么用?Python NailgunTask使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了NailgunTask类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: __init__
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)
示例2: __init__
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)
示例3: __init__
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__
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__
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)
示例6: __init__
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')
示例7: setup_parser
def setup_parser(cls, option_group, args, mkflag):
NailgunTask.setup_parser(option_group, args, mkflag)
option_group.add_option(
mkflag("warnings"),
mkflag("warnings", negate=True),
dest="scala_compile_warnings",
default=True,
action="callback",
callback=mkflag.set_bool,
help="[%default] Compile scala code with all configured warnings " "enabled.",
)
option_group.add_option(
mkflag("plugins"),
dest="plugins",
default=None,
action="append",
help="Use these scalac plugins. Default is set in pants.ini.",
)
option_group.add_option(
mkflag("partition-size-hint"),
dest="scala_compile_partition_size_hint",
action="store",
type="int",
default=-1,
help="Roughly how many source files to attempt to compile together. Set to a large number "
"to compile all sources together. Set this to 0 to compile target-by-target. "
"Default is set in pants.ini.",
)
JvmDependencyCache.setup_parser(option_group, args, mkflag)
示例8: __init__
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)
示例9: __init__
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')
示例10: setup_parser
def setup_parser(cls, option_group, args, mkflag):
NailgunTask.setup_parser(option_group, args, mkflag)
flag = mkflag('override')
option_group.add_option(flag, action='append', dest='ivy_resolve_overrides',
help='''Specifies a jar dependency override in the form:
[org]#[name]=(revision|url)
For example, to specify 2 overrides:
%(flag)s=com.foo#bar=0.1.2 \\
%(flag)s=com.baz#spam=file:///tmp/spam.jar
''' % dict(flag=flag))
report = mkflag("report")
option_group.add_option(report, mkflag("report", negate=True), dest = "ivy_resolve_report",
action="callback", callback=mkflag.set_bool, default=False,
help = "[%default] Generate an ivy resolve html report")
option_group.add_option(mkflag("open"), mkflag("open", negate=True),
dest="ivy_resolve_open", default=False,
action="callback", callback=mkflag.set_bool,
help="[%%default] Attempt to open the generated ivy resolve report "
"in a browser (implies %s)." % report)
option_group.add_option(mkflag("outdir"), dest="ivy_resolve_outdir",
help="Emit ivy report outputs in to this directory.")
option_group.add_option(mkflag("cache"), dest="ivy_resolve_cache",
help="Use this directory as the ivy cache, instead of the " \
"default specified in pants.ini.")
示例11: setup_parser
def setup_parser(cls, option_group, args, mkflag):
NailgunTask.setup_parser(option_group, args, mkflag)
option_group.add_option(mkflag("skip"), mkflag("skip", negate=True),
dest="checkstyle_skip", default=False,
action="callback", callback=mkflag.set_bool,
help="[%default] Skip checkstyle.")
示例12: __init__
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)
示例13: setup_parser
def setup_parser(cls, option_group, args, mkflag):
NailgunTask.setup_parser(option_group, args, mkflag)
option_group.add_option(mkflag("warnings"), mkflag("warnings", negate=True),
dest="scala_compile_warnings", default=True,
action="callback", callback=mkflag.set_bool,
help="[%default] Compile scala code with all configured warnings "
"enabled.")
示例14: _run
def _run():
version = get_version()
if len(sys.argv) == 2 and sys.argv[1] == _VERSION_OPTION:
_do_exit(version)
root_dir = get_buildroot()
if not os.path.exists(root_dir):
_exit_and_fail('PANTS_BUILD_ROOT does not point to a valid path: %s' % root_dir)
if len(sys.argv) < 2 or (len(sys.argv) == 2 and sys.argv[1] in _HELP_ALIASES):
_help(version, root_dir)
command_class, command_args = _parse_command(root_dir, sys.argv[1:])
parser = optparse.OptionParser(version=version)
RcFile.install_disable_rc_option(parser)
parser.add_option(_LOG_EXIT_OPTION,
action='store_true',
default=False,
dest='log_exit',
help = 'Log an exit message on success or failure.')
config = Config.load()
run_tracker = RunTracker(config)
report = initial_reporting(config, run_tracker)
run_tracker.start(report)
url = run_tracker.run_info.get_info('report_url')
if url:
run_tracker.log(Report.INFO, 'See a report at: %s' % url)
else:
run_tracker.log(Report.INFO, '(To run a reporting server: ./pants server)')
command = command_class(run_tracker, root_dir, parser, command_args)
try:
if command.serialized():
def onwait(pid):
print('Waiting on pants process %s to complete' % _process_info(pid), file=sys.stderr)
return True
runfile = os.path.join(root_dir, '.pants.run')
lock = Lock.acquire(runfile, onwait=onwait)
else:
lock = Lock.unlocked()
try:
result = command.run(lock)
_do_exit(result)
except KeyboardInterrupt:
command.cleanup()
raise
finally:
lock.release()
finally:
run_tracker.end()
# Must kill nailguns only after run_tracker.end() is called, because there may still
# be pending background work that needs a nailgun.
if (hasattr(command.options, 'cleanup_nailguns') and command.options.cleanup_nailguns) \
or config.get('nailgun', 'autokill', default=False):
NailgunTask.killall(None)
示例15: __init__
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