def configure_target(target): if target not in analyzed: analyzed.add(target) self.has_scala = self.has_scala or is_scala(target) if isinstance(target, JavaLibrary) or isinstance( target, ScalaLibrary): # TODO(John Sirois): this does not handle test resources, make test resources 1st class # in ant build and punch this through to pants model resources = set() if target.resources: resources.update(target.resources) if target.binary_resources: resources.update(target.binary_resources) if resources: self.resource_extensions.update( Project.extract_resource_extensions(resources)) configure_source_sets(RESOURCES_BASE_DIR, resources, is_test=False) if target.sources: test = is_test(target) self.has_tests = self.has_tests or test configure_source_sets(target.target_base, target.sources, is_test=test) siblings = Target.get_all_addresses(target.address.buildfile) return filter( accept_target, [Target.get(a) for a in siblings if a != target.address])
def configure_target(target): if target not in analyzed: analyzed.add(target) self.has_scala = self.has_scala or is_scala(target) if isinstance(target, JavaLibrary) or isinstance(target, ScalaLibrary): # TODO(John Sirois): this does not handle test resources, make test resources 1st class # in ant build and punch this through to pants model resources = set() if target.resources: resources.update(target.resources) if target.binary_resources: resources.update(target.binary_resources) if resources: self.resource_extensions.update(Project.extract_resource_extensions(resources)) configure_source_sets(RESOURCES_BASE_DIR, resources, is_test = False) if target.sources: test = is_test(target) self.has_tests = self.has_tests or test configure_source_sets(target.target_base, target.sources, is_test = test) siblings = Target.get_all_addresses(target.address.buildfile) return filter(accept_target, [ Target.get(a) for a in siblings if a != target.address ])
def build(self, targets, args): for target in targets: assert is_python(target), "PythonBuilder can only build PythonTargets, given %s" % str(target) if not is_test(target): raise Exception("PythonBuilder cannot handle target: %s" % str(target)) return self._run_tests(targets, args)
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)