def setUp(self): super(MavenLayoutTest, self).setUp() init_subsystems([SourceRootConfig, JUnit]) self.add_to_build_file('projectB/src/test/scala', 'junit_tests(name="test", sources=["a/source"])') self.add_to_build_file('projectA/subproject/src/main/java', 'java_library(name="test", sources=[])')
def setUp(self): super(MavenLayoutTest, self).setUp() init_subsystems([SourceRootConfig, JUnit]) self.add_to_build_file( 'projectB/src/test/scala', 'junit_tests(name="test", sources=["a/source"])') self.add_to_build_file('projectA/subproject/src/main/java', 'java_library(name="test", sources=[])')
def setUp(self): init_subsystems([LibcDev], options={ 'libc': { 'enable_libc_search': False, 'libc_dir': '/does/not/exist', }, }) self.libc = global_subsystem_instance(LibcDev) self.platform = Platform.current
def setUp(self): init_subsystems([LibcDev], options={ 'libc': { 'enable_libc_search': True, 'host_compiler': 'this_executable_does_not_exist', }, }) self.libc = global_subsystem_instance(LibcDev) self.platform = Platform.current
def setUp(self): super(TestNativeToolchain, self).setUp() init_subsystems([LibcDev, NativeToolchain], options={ 'libc': { 'enable_libc_search': True, }, }) self.platform = Platform.create() self.toolchain = global_subsystem_instance(NativeToolchain) self.rules = native_backend_rules()
def setUp(self): super(TestNativeToolchain, self).setUp() init_subsystems([LibcDev, NativeToolchain], options={ 'libc': { 'enable_libc_search': True, }, }) self.platform = Platform.create() self.toolchain = global_subsystem_instance(NativeToolchain) self.rules = native_backend_rules() gcc_subsystem = global_subsystem_instance(GCC) self.gcc_version = gcc_subsystem.version() llvm_subsystem = global_subsystem_instance(LLVM) self.llvm_version = llvm_subsystem.version()
def setUp(self): super().setUp() init_subsystems([LibcDev, NativeToolchain], options={ 'libc': { 'enable_libc_search': True, }, }) self.platform = Platform.current self.toolchain = global_subsystem_instance(NativeToolchain) self.rules = native_backend_rules() gcc_subsystem = global_subsystem_instance(GCC) self.gcc_version = gcc_subsystem.version() llvm_subsystem = global_subsystem_instance(LLVM) self.llvm_version = llvm_subsystem.version()
def _init_target_subsystem(self): if not self._inited_target: subsystem_util.init_subsystems(Target.subsystems()) self._inited_target = True
def setUp(self): super().setUp() init_subsystems([PythonSetup, PythonNativeCode])
def _init_target_subsystem(self): if not self._inited_target: subsystem_util.init_subsystems(self.subsystems) self._inited_target = True
def setUp(self): super().setUp() init_subsystems([PythonSetup, PythonNativeCode, SubprocessEnvironment])
def setUp(self): super(ExportTest, self).setUp() # We need an initialized ScalaPlatform in order to make ScalaLibrary targets below. scala_options = {ScalaPlatform.options_scope: {"version": "custom"}} init_subsystems([JUnit, ScalaPlatform], scala_options) self.make_target( ":scala-library", JarLibrary, jars=[JarDependency("org.scala-lang", "scala-library", "2.10.5")] ) self.make_target("project_info:first", target_type=Target) jar_lib = self.make_target( "project_info:jar_lib", target_type=JarLibrary, jars=[JarDependency("org.apache", "apache-jar", "12.12.2012")], ) self.make_target( "java/project_info:java_lib", target_type=JavaLibrary, sources=["com/foo/Bar.java", "com/foo/Baz.java"] ) self.make_target( "project_info:third", target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=["java/project_info:java_lib"], sources=["com/foo/Bar.scala", "com/foo/Baz.scala"], ) self.make_target( "project_info:globular", target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=["java/project_info:java_lib"], sources=["com/foo/*.scala"], ) self.make_target("project_info:jvm_app", target_type=JvmApp, dependencies=[jar_lib]) self.make_target( "project_info:jvm_target", target_type=ScalaLibrary, dependencies=[jar_lib], sources=["this/is/a/source/Foo.scala", "this/is/a/source/Bar.scala"], ) test_resource = self.make_target( "project_info:test_resource", target_type=Resources, sources=["y_resource", "z_resource"] ) self.make_target( "project_info:java_test", target_type=JavaTests, dependencies=[jar_lib], sources=["this/is/a/test/source/FooTest.scala"], resources=[test_resource.address.spec], ) jvm_binary = self.make_target("project_info:jvm_binary", target_type=JvmBinary, dependencies=[jar_lib]) self.make_target("project_info:top_dependency", target_type=Target, dependencies=[jvm_binary]) src_resource = self.make_target( "project_info:resource", target_type=Resources, sources=["a_resource", "b_resource"] ) self.make_target( "project_info:target_type", target_type=ScalaLibrary, dependencies=[jvm_binary], resources=[src_resource.address.spec], ) self.make_target("project_info:unrecognized_target_type", target_type=JvmTarget) self.add_to_build_file( "src/python/x/BUILD", """ python_library(name="x", sources=globs("*.py")) """.strip(), ) self.add_to_build_file( "src/python/y/BUILD", dedent( """ python_library(name="y", sources=rglobs("*.py")) python_library(name="y2", sources=rglobs("subdir/*.py")) python_library(name="y3", sources=rglobs("Test*.py")) """ ), ) self.add_to_build_file( "src/python/z/BUILD", """ python_library(name="z", sources=zglobs("**/*.py")) """.strip(), ) self.add_to_build_file( "src/python/exclude/BUILD", """ python_library(name="exclude", sources=globs("*.py", exclude=[['foo.py']])) """.strip(), ) self.add_to_build_file( "src/BUILD", """ target(name="alias") """.strip(), )
def setUp(self): super(ExportTest, self).setUp() # We need an initialized ScalaPlatform in order to make ScalaLibrary targets below. scala_options = { ScalaPlatform.options_scope: { 'version': 'custom' } } init_subsystems([JUnit, ScalaPlatform], scala_options) self.make_target(':scala-library', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-library', '2.10.5')]) self.make_target( 'project_info:first', target_type=Target, ) jar_lib = self.make_target( 'project_info:jar_lib', target_type=JarLibrary, jars=[JarDependency('org.apache', 'apache-jar', '12.12.2012')], ) self.make_target( 'java/project_info:java_lib', target_type=JavaLibrary, sources=['com/foo/Bar.java', 'com/foo/Baz.java'], ) self.make_target( 'project_info:third', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/Bar.scala', 'com/foo/Baz.scala'], ) self.make_target( 'project_info:globular', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/*.scala'], ) self.make_target( 'project_info:jvm_app', target_type=JvmApp, dependencies=[jar_lib], ) self.make_target( 'project_info:jvm_target', target_type=ScalaLibrary, dependencies=[jar_lib], sources=['this/is/a/source/Foo.scala', 'this/is/a/source/Bar.scala'], ) test_resource = self.make_target( 'project_info:test_resource', target_type=Resources, sources=['y_resource', 'z_resource'], ) self.make_target( 'project_info:java_test', target_type=JUnitTests, dependencies=[jar_lib], sources=['this/is/a/test/source/FooTest.scala'], resources=[test_resource.address.spec], ) jvm_binary = self.make_target( 'project_info:jvm_binary', target_type=JvmBinary, dependencies=[jar_lib], ) self.make_target( 'project_info:top_dependency', target_type=Target, dependencies=[jvm_binary], ) src_resource = self.make_target( 'project_info:resource', target_type=Resources, sources=['a_resource', 'b_resource'], ) self.make_target( 'project_info:target_type', target_type=ScalaLibrary, dependencies=[jvm_binary], sources=[], resources=[src_resource.address.spec], ) self.make_target( 'project_info:unrecognized_target_type', target_type=JvmTarget, ) self.add_to_build_file('src/python/x/BUILD', """ python_library(name="x", sources=globs("*.py")) """.strip()) self.add_to_build_file('src/python/y/BUILD', dedent(""" python_library(name="y", sources=rglobs("*.py")) python_library(name="y2", sources=rglobs("subdir/*.py")) python_library(name="y3", sources=rglobs("Test*.py")) """)) self.add_to_build_file('src/python/z/BUILD', """ python_library(name="z", sources=zglobs("**/*.py")) """.strip()) self.add_to_build_file('src/python/exclude/BUILD', """ python_library(name="exclude", sources=globs("*.py", exclude=[['foo.py']])) """.strip()) self.add_to_build_file('src/BUILD', """ target(name="alias") """.strip())
def setUp(self): super().setUp() # We need an initialized ScalaPlatform in order to make ScalaLibrary targets below. scala_options = { ScalaPlatform.options_scope: { 'version': 'custom' } } init_subsystems([JUnit, ScalaPlatform, ScoveragePlatform], scala_options) self.make_target( ':jar-tool', JarLibrary, jars=[JarDependency('org.pantsbuild', 'jar-tool', '0.0.10')] ) # NB: `test_has_python_requirements` will attempt to inject every possible scala compiler target # spec, for versions 2.10, 2.11, 2.12, and custom, and will error out if they are not # available. This isn't a problem when running pants on the command line, but in unit testing # there's probably some task or subsystem that needs to be initialized to avoid this. for empty_target in ['scalac', 'scala-repl', 'scala-library', 'scala-reflect', 'scalastyle']: for unused_scala_version in ['2_10', '2_11']: self.make_target( f':{empty_target}_{unused_scala_version}', Target, ) self.make_target( ':scalac-plugin-dep', Target, ) self.make_target( ':jarjar', JarLibrary, jars=[JarDependency(org='org.pantsbuild', name='jarjar', rev='1.7.2')] ) self.make_target( ':scala-library', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-library', self._scala_toolchain_version)] ) self.make_target( ':scalac', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-compiler', self._scala_toolchain_version)] ) self.make_target( ':scalac_2_12', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-compiler', '2.12.8')] ) self.make_target( ':scala-library_2_12', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-library', '2.12.8')] ) self.make_target( ':scala-reflect_2_12', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-reflect', '2.12.8')] ) self.make_target( ':scala-repl_2_12', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-repl', '2.12.8')] ) self.make_target( ':scalastyle_2_12', Target, ) self.make_target( ':scalastyle', Target, ) self.make_target( ':scala-reflect', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-reflect', self._scala_toolchain_version)] ) self.make_target( ':scala-repl', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-repl', self._scala_toolchain_version)] ) self.make_target( ':nailgun-server', JarLibrary, jars=[JarDependency(org='com.martiansoftware', name='nailgun-server', rev='0.9.1'),] ) self.make_target( 'project_info:first', target_type=Target, ) jar_lib = self.make_target( 'project_info:jar_lib', target_type=JarLibrary, jars=[JarDependency('org.apache', 'apache-jar', '12.12.2012')], ) self.make_target( 'java/project_info:java_lib', target_type=JavaLibrary, sources=['com/foo/Bar.java', 'com/foo/Baz.java'], ) self.make_target( 'project_info:third', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/Bar.scala', 'com/foo/Baz.scala'], ) self.make_target( 'project_info:globular', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/*.scala'], ) self.make_target( 'project_info:jvm_app', target_type=JvmApp, dependencies=[jar_lib], ) self.make_target( 'project_info:jvm_target', target_type=ScalaLibrary, dependencies=[jar_lib], sources=['this/is/a/source/Foo.scala', 'this/is/a/source/Bar.scala'], ) test_resource = self.make_target( 'project_info:test_resource', target_type=Resources, sources=['y_resource', 'z_resource'], ) self.make_target( 'project_info:java_test', target_type=JUnitTests, dependencies=[jar_lib, test_resource], sources=['this/is/a/test/source/FooTest.scala'], ) jvm_binary = self.make_target( 'project_info:jvm_binary', target_type=JvmBinary, dependencies=[jar_lib], ) self.make_target( 'project_info:top_dependency', target_type=Target, dependencies=[jvm_binary], ) src_resource = self.make_target( 'project_info:resource', target_type=Resources, sources=['a_resource', 'b_resource'], ) self.make_target( 'project_info:target_type', target_type=ScalaLibrary, dependencies=[jvm_binary, src_resource], sources=[], ) self.make_target( 'project_info:unrecognized_target_type', target_type=JvmTarget, ) self.add_to_build_file('src/python/x/BUILD', """ python_library(name="x", sources=globs("*.py")) """.strip()) self.add_to_build_file('src/python/y/BUILD', dedent(""" python_library(name="y", sources=rglobs("*.py")) python_library(name="y2", sources=rglobs("subdir/*.py")) python_library(name="y3", sources=rglobs("Test*.py")) """)) self.add_to_build_file('src/python/z/BUILD', """ python_library(name="z", sources=zglobs("**/*.py")) """.strip()) self.add_to_build_file('src/python/exclude/BUILD', """ python_library(name="exclude", sources=globs("*.py", exclude=[['foo.py']])) """.strip()) self.add_to_build_file('src/BUILD', """ target(name="alias") """.strip()) self.add_to_build_file('src/python/has_reqs/BUILD', textwrap.dedent(""" python_library(name="has_reqs", sources=globs("*.py"), dependencies=[':six']) python_requirement_library( name='six', requirements=[ python_requirement('six==1.9.0') ] ) """))
def setUp(self): super(ExportTest, self).setUp() # We need an initialized ScalaPlatform in order to make ScalaLibrary targets below. scala_options = { ScalaPlatform.options_scope: { 'version': 'custom' } } init_subsystems([JUnit, ScalaPlatform], scala_options) self.make_target(':scala-library', JarLibrary, jars=[JarDependency('org.scala-lang', 'scala-library', '2.10.5')]) self.make_target( 'project_info:first', target_type=Target, ) jar_lib = self.make_target( 'project_info:jar_lib', target_type=JarLibrary, jars=[JarDependency('org.apache', 'apache-jar', '12.12.2012')], ) self.make_target( 'java/project_info:java_lib', target_type=JavaLibrary, sources=['com/foo/Bar.java', 'com/foo/Baz.java'], ) self.make_target( 'project_info:third', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/Bar.scala', 'com/foo/Baz.scala'], ) self.make_target( 'project_info:globular', target_type=ScalaLibrary, dependencies=[jar_lib], java_sources=['java/project_info:java_lib'], sources=['com/foo/*.scala'], ) self.make_target( 'project_info:jvm_app', target_type=JvmApp, dependencies=[jar_lib], ) self.make_target( 'project_info:jvm_target', target_type=ScalaLibrary, dependencies=[jar_lib], sources=['this/is/a/source/Foo.scala', 'this/is/a/source/Bar.scala'], ) test_resource = self.make_target( 'project_info:test_resource', target_type=Resources, sources=['y_resource', 'z_resource'], ) self.make_target( 'project_info:java_test', target_type=JUnitTests, dependencies=[jar_lib, test_resource], sources=['this/is/a/test/source/FooTest.scala'], ) jvm_binary = self.make_target( 'project_info:jvm_binary', target_type=JvmBinary, dependencies=[jar_lib], ) self.make_target( 'project_info:top_dependency', target_type=Target, dependencies=[jvm_binary], ) src_resource = self.make_target( 'project_info:resource', target_type=Resources, sources=['a_resource', 'b_resource'], ) self.make_target( 'project_info:target_type', target_type=ScalaLibrary, dependencies=[jvm_binary, src_resource], sources=[], ) self.make_target( 'project_info:unrecognized_target_type', target_type=JvmTarget, ) self.add_to_build_file('src/python/x/BUILD', """ python_library(name="x", sources=globs("*.py")) """.strip()) self.add_to_build_file('src/python/y/BUILD', dedent(""" python_library(name="y", sources=rglobs("*.py")) python_library(name="y2", sources=rglobs("subdir/*.py")) python_library(name="y3", sources=rglobs("Test*.py")) """)) self.add_to_build_file('src/python/z/BUILD', """ python_library(name="z", sources=zglobs("**/*.py")) """.strip()) self.add_to_build_file('src/python/exclude/BUILD', """ python_library(name="exclude", sources=globs("*.py", exclude=[['foo.py']])) """.strip()) self.add_to_build_file('src/BUILD', """ target(name="alias") """.strip())
def setUp(self): super(TestResolveRequirements, self).setUp() init_subsystems([PythonSetup, PythonNativeCode])