Example #1
0
def extract_target(java_targets, is_transitive, name = None):
  meta_target = bang.extract_target(java_targets, name)

  internal_deps, jar_deps = _extract_target(meta_target,
                                            is_transitive,
                                            lambda target: is_apt(target))

  # TODO(John Sirois): make an empty source set work in ant/compile.xml
  sources = [ '__no_source__' ]

  all_deps = OrderedSet()
  all_deps.update(internal_deps)
  all_deps.update(jar_deps)

  if is_java(meta_target):
    return JavaLibrary('ide',
                       sources,
                       dependencies = all_deps,
                       excludes = meta_target.excludes,
                       is_meta = True)
  elif is_scala(meta_target):
    return ScalaLibrary('ide',
                        sources,
                        dependencies = all_deps,
                        excludes = meta_target.excludes,
                        is_meta = True)
  else:
    raise TypeError("Cannot generate IDE configuration for targets: %s" % java_targets)
Example #2
0
    def _resolve_targets(self, targets, name=None):
        for target in targets:
            AntBuilder._check_target(target)

        foil = list(targets)[0]
        if self.is_ide:

            def is_transitive():
                if self.ide_transitivity == TRANSITIVITY_TESTS:
                    return is_test
                if self.ide_transitivity == TRANSITIVITY_ALL:
                    return lambda target: True
                if self.ide_transitivity == TRANSITIVITY_NONE:
                    return lambda target: False
                if self.ide_transitivity == TRANSITIVITY_SOURCES:
                    return lambda target: not is_test(target)

            is_transitive = is_transitive()
            return foil.do_in_context(
                lambda: ide.extract_target(targets, is_transitive, name))
        elif len(targets) > 1 or foil.address.is_meta:
            return foil.do_in_context(
                lambda: bang.extract_target(targets, name))
        else:
            return foil
Example #3
0
def extract_target(java_targets, is_transitive, is_classpath, name = None):
  meta_target = bang.extract_target(java_targets, name)

  internal_deps, jar_deps = _extract_target(meta_target, is_transitive, is_classpath)

  # TODO(John Sirois): make an empty source set work in ant/compile.xml
  sources = [ '__no_source__' ]

  all_deps = OrderedSet()
  all_deps.update(internal_deps)
  all_deps.update(jar_deps)

  if is_java(meta_target):
    return JavaLibrary('ide',
                       sources,
                       dependencies = all_deps,
                       excludes = meta_target.excludes,
                       is_meta = True)
  elif is_scala(meta_target):
    return ScalaLibrary('ide',
                        sources,
                        dependencies = all_deps,
                        excludes = meta_target.excludes,
                        is_meta = True)
  else:
    raise TypeError("Cannot generate IDE configuration for targets: %s" % java_targets)
Example #4
0
  def _resolve_targets(self, targets, name = None):
    for target in targets:
      AntBuilder._check_target(target)

    foil = list(targets)[0]
    if len(targets) > 1 or foil.address.is_meta:
      return bang.extract_target(targets, name)
    else:
      return foil
Example #5
0
  def _resolve_target(self, target, is_meta):
    AntBuilder._check_target(target)

    if self.is_ide:
      def is_transitive():
        if self.ide_transitivity == TRANSITIVITY_TESTS:
          return lambda target: type(target) in set([JavaTests, ScalaTests])
        if self.ide_transitivity == TRANSITIVITY_ALL:
          return lambda target: True
        if self.ide_transitivity == TRANSITIVITY_NONE:
          return lambda target: False
        if self.ide_transitivity == TRANSITIVITY_SOURCES:
          return lambda target: type(target) not in set([JavaTests, ScalaTests])

      is_transitive = is_transitive()
      return target.do_in_context(lambda: ide.extract_target(target, is_transitive))
    elif is_meta:
      return target.do_in_context(lambda: bang.extract_target(target))
    else:
      return target
Example #6
0
def extract_target(java_targets, is_transitive, name=None):
    meta_target = bang.extract_target(java_targets, name)

    internal_deps, jar_deps = _extract_target(meta_target, is_transitive)

    # TODO(John Sirois): make an empty source set work in ant/compile.xml
    sources = ['__no_source__']

    all_deps = OrderedSet()
    all_deps.update(internal_deps)
    all_deps.update(jar_deps)

    return JavaLibrary('ide',
                       sources,
                       provides=None,
                       dependencies=all_deps,
                       excludes=meta_target.excludes,
                       resources=None,
                       binary_resources=None,
                       deployjar=False,
                       buildflags=None,
                       is_meta=True)
Example #7
0
File: lib.py Project: crnt/commons
  def _resolve_targets(self, targets, name = None):
    for target in targets:
      AntBuilder._check_target(target)

    foil = list(targets)[0]
    if self.is_ide:
      def is_transitive():
        if self.ide_transitivity == TRANSITIVITY_TESTS:
          return is_test
        if self.ide_transitivity == TRANSITIVITY_ALL:
          return lambda target: True
        if self.ide_transitivity == TRANSITIVITY_NONE:
          return lambda target: False
        if self.ide_transitivity == TRANSITIVITY_SOURCES:
          return lambda target: not is_test(target)

      is_transitive = is_transitive()
      return foil.do_in_context(lambda: ide.extract_target(targets, is_transitive, name))
    elif len(targets) > 1 or foil.address.is_meta:
      return foil.do_in_context(lambda: bang.extract_target(targets, name))
    else:
      return foil
Example #8
0
def extract_target(java_target, is_transitive):
  meta_target = bang.extract_target(java_target)

  internal_deps, jar_deps = _extract_target(meta_target, is_transitive)

  # TODO(John Sirois): make an empty source set work in ant/compile.xml
  sources = [ '__no_source__' ]

  all_deps = OrderedSet()
  all_deps.update(internal_deps)
  all_deps.update(jar_deps)

  return JavaLibrary('ide',
                     sources,
                     provides = None,
                     dependencies = all_deps,
                     excludes = meta_target.excludes,
                     resources = None,
                     binary_resources = None,
                     deployjar = False,
                     buildflags = None,
                     is_meta = True)
Example #9
0
    def _resolve_target(self, target, is_meta):
        AntBuilder._check_target(target)

        if self.is_ide:

            def is_transitive():
                if self.ide_transitivity == TRANSITIVITY_TESTS:
                    return lambda target: type(target) in set(
                        [JavaTests, ScalaTests])
                if self.ide_transitivity == TRANSITIVITY_ALL:
                    return lambda target: True
                if self.ide_transitivity == TRANSITIVITY_NONE:
                    return lambda target: False
                if self.ide_transitivity == TRANSITIVITY_SOURCES:
                    return lambda target: type(target) not in set(
                        [JavaTests, ScalaTests])

            is_transitive = is_transitive()
            return target.do_in_context(
                lambda: ide.extract_target(target, is_transitive))
        elif is_meta:
            return target.do_in_context(lambda: bang.extract_target(target))
        else:
            return target