예제 #1
0
  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)
예제 #2
0
  def __init__(self, context):
    NailgunTask.__init__(self, context)
    self._scalastyle_config = self.context.config.get_required(
      Scalastyle._CONFIG_SECTION, 'config')
    if not os.path.exists(self._scalastyle_config):
      raise Config.ConfigError(
          'Scalastyle config file does not exist: %s' % self._scalastyle_config)

    excludes_file = self.context.config.get(Scalastyle._CONFIG_SECTION, 'excludes')
    self._excludes = set()
    if excludes_file:
      if not os.path.exists(excludes_file):
        raise Config.ConfigError('Scalastyle excludes file does not exist: %s' % excludes_file)
      self.context.log.debug('Using scalastyle excludes file %s' % excludes_file)
      with open(excludes_file) as fh:
        for pattern in fh.readlines():
          self._excludes.add(re.compile(pattern.strip()))

    self._scalastyle_bootstrap_key = 'scalastyle'
    self.register_jvm_tool(self._scalastyle_bootstrap_key, [':scalastyle'])