def create_target(category, target_name, target_index, targets): def name(name): return "%s-%s-%d" % (target_name, name, target_index) # TODO(John Sirois): JavaLibrary and ScalaLibrary can float here between src/ and tests/ - add # ant build support to allow the same treatment for JavaThriftLibrary and JavaProtobufLibrary # so that tests can house test IDL in tests/ target_type, base = category if target_type == JavaProtobufLibrary: return JavaProtobufLibrary._aggregate(name('protobuf'), provides, buildflags, targets) elif target_type == JavaThriftLibrary: return JavaThriftLibrary._aggregate(name('thrift'), provides, buildflags, targets) elif target_type == AnnotationProcessor: return AnnotationProcessor._aggregate(name('apt'), provides, targets) elif target_type == JavaLibrary: return JavaLibrary._aggregate(name('java'), provides, deployjar, buildflags, targets, base) elif target_type == ScalaLibrary: return ScalaLibrary._aggregate(name('scala'), provides, deployjar, buildflags, targets, base) elif target_type == JavaTests: return JavaTests._aggregate(name('java-tests'), buildflags, targets) elif target_type == ScalaTests: return ScalaTests._aggregate(name('scala-tests'), buildflags, targets) else: raise Exception("Cannot aggregate targets of type: %s" % target_type)
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)
def create_meta_target(): return JavaLibrary('pants.doc.deps', all_sources, provides=None, dependencies=all_deps, excludes=None, resources=None, binary_resources=None, deployjar=False, buildflags=None, is_meta=True)
def create_target(target_type, target_name, target_index, targets): def name(name): return "%s-%s-%d" % (target_name, name, target_index) if target_type == JavaProtobufLibrary: return JavaProtobufLibrary._aggregate(name('protobuf'), provides, buildflags, targets) elif target_type == JavaThriftLibrary: return JavaThriftLibrary._aggregate(name('thrift'), provides, buildflags, targets) elif target_type == JavaLibrary: return JavaLibrary._aggregate(name('java'), provides, deployjar, buildflags, targets) elif target_type == ScalaLibrary: return ScalaLibrary._aggregate(name('scala'), provides, deployjar, buildflags, targets) elif target_type == JavaTests: return JavaTests._aggregate(name('java-tests'), buildflags, targets) elif target_type == ScalaTests: return ScalaTests._aggregate(name('scala-tests'), buildflags, targets) else: raise Exception("Cannot aggregate targets of type: %s" % target_type)
def create_meta_target(): return JavaLibrary(target.name + '.deps', all_sources, dependencies = all_deps, is_meta = True)
def create_meta_target(): return JavaLibrary('pants.doc.deps', all_sources, dependencies = all_deps, is_meta = True)