示例#1
0
    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._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',
                                                     default=[])
        self.setup_artifact_cache(artifact_cache_spec)

        # 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()
示例#2
0
    def __init__(self, context, workdir=None):
        NailgunTask.__init__(self,
                             context,
                             workdir=context.config.get(
                                 'scala-compile', 'nailgun_dir'))

        # Set up the zinc utils.
        # Command line switch overrides color setting set in pants.ini
        color = context.options.scala_compile_color if context.options.scala_compile_color is not None else \
                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)