Skip to content

Commit

Permalink
Kill scala specs support.
Browse files Browse the repository at this point in the history
Scala specs has been long abandoned as a framework; all new development
is done in the Specs2 [1] projects.  No pants users reported [2] using
this feature so this change guts support.

[1] https://etorreborre.github.io/specs2/
[2] https://groups.google.com/d/topic/pants-devel/sc2jaZ9YZGU/discussion

Testing Done:
CI went green here:
  https://travis-ci.org/pantsbuild/pants/builds/62293330

Bugs closed: 1535

Reviewed at https://rbcommons.com/s/twitter/r/2208/
  • Loading branch information
jsirois committed May 12, 2015
1 parent ec72b09 commit f7a2359
Show file tree
Hide file tree
Showing 14 changed files with 17 additions and 153 deletions.
4 changes: 2 additions & 2 deletions BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ source_root('testprojects/src/thrift', java_thrift_library, page, python_thrift_
source_root('testprojects/tests/java', java_library, junit_tests, page, jar_library)
source_root('testprojects/tests/python', page, python_library, python_tests, python_test_suite, python_binary, resources)
source_root('testprojects/tests/resources', page, resources)
source_root('testprojects/tests/scala', page, junit_tests, scala_library, scala_specs)
source_root('testprojects/tests/scala', page, junit_tests, scala_library)

# Example code intended to demonstrate to end users how to use Pants BUILD configuration
source_root('examples/src/android', page, android_resources, android_binary)
Expand All @@ -45,7 +45,7 @@ source_root('examples/src/wire', java_wire_library, page)
source_root('examples/tests/java', java_library, junit_tests, page)
source_root('examples/tests/python', page, python_library, python_tests, python_test_suite, python_binary, resources)
source_root('examples/tests/resources', page, resources)
source_root('examples/tests/scala', page, junit_tests, scala_library, scala_specs)
source_root('examples/tests/scala', page, junit_tests, scala_library)


page(name="readme", source="README.md")
9 changes: 0 additions & 9 deletions BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -91,15 +91,6 @@ jar_library(name = 'scala-library',
jar(org = 'org.scala-lang', name = 'scala-library', rev = SCALA_REV),
])

jar_library(name = 'scala-specs',
jars = [
jar(org = 'org.scala-tools.testing', name = 'specs_2.10', rev = '1.6.9'),
jar(org = 'com.twitter.common', name = 'specs-testing', rev = '0.0.6')
],
dependencies = [
':scala-library',
])

jar_library(name = 'scala-repl',
jars = [
jar(org = 'org.scala-lang', name = 'jline', rev = SCALA_REV, intransitive = True),
Expand Down
8 changes: 4 additions & 4 deletions examples/src/java/org/pantsbuild/example/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -69,10 +69,10 @@ especially relevant.

> A `junit_tests` BUILD target holds source code for some JUnit tests;
> typically, it would have one or more `java_library` targets as
> dependencies and would import and test their code.
>
> A `scala_specs` target is similar, but has source code for Scala
> specs.
> dependencies and would import and test their code. Note that most
> popular scala test frameworks support running with JUnit via a base
> class/trait or via a `@RunWith` annotation; so you can use
> `junit_tests` for your scala tests as well.
>
> The Pants `test` goal runs tests.
Expand Down
6 changes: 2 additions & 4 deletions examples/src/scala/org/pantsbuild/example/readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,7 @@ There's a sample test in
[examples/tests/scala/org/pantsbuild/example/hello/welcome](https://github.com/pantsbuild/pants/tree/master/examples/tests/scala/org/pantsbuild/example/hello/welcome).
It's a <a xref="bdict_junit_tests">`junit_tests`</a> with `.scala` sources.
(You might have thought JUnit was only for Java testing, but it also works great
for Scala. Pants also has a
<a xref="bdict_scala_specs">`scala_specs`</a> target type for testing with
Specs.)
for Scala.)

!inc[start-at=junit_tests](../../../../../tests/scala/org/pantsbuild/example/hello/welcome/BUILD)

Expand Down Expand Up @@ -101,4 +99,4 @@ targets and their dependencies.
$

Pants' `repl` goal works with JVM targets. (It also works with Python targets, but that uses a
Python console instead.)
Python console instead.)
10 changes: 5 additions & 5 deletions src/docs/first_concepts.md
Original file line number Diff line number Diff line change
Expand Up @@ -83,11 +83,11 @@ Not everything's source code is in your repository. Your targets can
depend on `.jar`s or `.eggs`s from elsewhere.

**Test Targets**<br>
To define a collection of tests, you want a `junit_tests`,
`scala_specs`, `python_tests`, or `python_test_suite` target. The test
target depends upon the targets whose code it tests. This isn't just
logical, it's handy, too: you can compute dependencies to figure out
what tests to run if you change some target's code.
To define a collection of tests, you want a `junit_tests` or
`python_tests` target. The test target depends upon the targets whose
code it tests. This isn't just logical, it's handy, too: you can
compute dependencies to figure out what tests to run if you change some
target's code.

For a list of all Target types (and other things that can go in `BUILD`
files), see the <a href="build_dictionary.html">BUILD Dictionary</a>.
Expand Down
4 changes: 0 additions & 4 deletions src/python/pants/backend/core/tasks/reflect.py
Original file line number Diff line number Diff line change
Expand Up @@ -397,10 +397,6 @@ def entry_for_one(nom, sym):
' use `target`_',
'Deprecated way to group Python tests;'
' use <a href="#target">target</a>')},
'scala_tests': {'defn':
msg_entry('scala_tests',
'Old name for `scala_specs`_',
'Old name for <a href="#scala_specs">scala_specs</a>')},
}


Expand Down
5 changes: 0 additions & 5 deletions src/python/pants/backend/jvm/register.py
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@
from pants.backend.jvm.targets.jvm_app import Bundle, DirectoryReMapper, JvmApp
from pants.backend.jvm.targets.jvm_binary import Duplicate, JarRules, JvmBinary, Skip
from pants.backend.jvm.targets.scala_library import ScalaLibrary
from pants.backend.jvm.targets.scala_tests import ScalaTests
from pants.backend.jvm.targets.scalac_plugin import ScalacPlugin
from pants.backend.jvm.targets.unpacked_jars import UnpackedJars
from pants.backend.jvm.tasks.benchmark_run import BenchmarkRun
Expand All @@ -45,7 +44,6 @@
from pants.backend.jvm.tasks.nailgun_task import NailgunKillall
from pants.backend.jvm.tasks.scala_repl import ScalaRepl
from pants.backend.jvm.tasks.scaladoc_gen import ScaladocGen
from pants.backend.jvm.tasks.specs_run import SpecsRun
from pants.backend.jvm.tasks.unpack_jars import UnpackJars
from pants.base.build_file_aliases import BuildFileAliases
from pants.goal.goal import Goal
Expand All @@ -67,8 +65,6 @@ def build_file_aliases():
'jvm_app': JvmApp,
'jvm_binary': JvmBinary,
'scala_library': ScalaLibrary,
'scala_specs': ScalaTests,
'scala_tests': ScalaTests,
'scalac_plugin': ScalacPlugin,
},
objects={
Expand Down Expand Up @@ -167,7 +163,6 @@ def register_goals():

# Testing.
task(name='junit', action=JUnitRun).install('test').with_description('Test compiled code.')
task(name='specs', action=SpecsRun).install('test')
task(name='bench', action=BenchmarkRun).install('bench')

# Running.
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/jvm/targets/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,6 @@ python_library(
name = 'scala',
sources = [
'scala_library.py',
'scala_tests.py',
'scalac_plugin.py',
],
dependencies = [
Expand Down
16 changes: 0 additions & 16 deletions src/python/pants/backend/jvm/targets/scala_tests.py

This file was deleted.

17 changes: 1 addition & 16 deletions src/python/pants/backend/jvm/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,6 @@ python_library(
':scala_repl',
':scaladoc_gen',
':scalastyle',
':specs_run',
':unpack_jars',
],
)
Expand Down Expand Up @@ -366,26 +365,12 @@ python_library(
],
)

python_library(
name = 'specs_run',
sources = ['specs_run.py'],
dependencies = [
':common',
':jvm_task',
':jvm_tool_task_mixin',
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/base:workunit',
'src/python/pants:binary_util',
'src/python/pants/java:util',
],
)

python_library(
name = 'unpack_jars',
sources = ['unpack_jars.py'],
dependencies = [
':common',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
'src/python/pants/backend/jvm/targets:jvm',
]
]
)
82 changes: 0 additions & 82 deletions src/python/pants/backend/jvm/tasks/specs_run.py

This file was deleted.

3 changes: 1 addition & 2 deletions src/python/pants/backend/maven_layout/maven_layout.py
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
from pants.backend.jvm.targets.java_tests import JavaTests
from pants.backend.jvm.targets.jvm_binary import JvmBinary
from pants.backend.jvm.targets.scala_library import ScalaLibrary
from pants.backend.jvm.targets.scala_tests import ScalaTests
from pants.backend.python.targets.python_binary import PythonBinary
from pants.backend.python.targets.python_library import PythonLibrary
from pants.backend.python.targets.python_tests import PythonTests
Expand Down Expand Up @@ -53,4 +52,4 @@ def root(path, *types):
root('src/test/java', JavaLibrary, JavaTests, Page, Benchmark)
root('src/test/python', Page, PythonLibrary, PythonTests)
root('src/test/resources', Page, Resources)
root('src/test/scala', JavaTests, Page, ScalaLibrary, ScalaTests, Benchmark)
root('src/test/scala', JavaTests, Page, ScalaLibrary, Benchmark)
3 changes: 1 addition & 2 deletions src/python/pants/backend/project_info/tasks/idea_gen.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from xml.dom import minidom

from pants.backend.jvm.targets.java_tests import JavaTests
from pants.backend.jvm.targets.scala_tests import ScalaTests
from pants.backend.project_info.tasks.ide_gen import IdeGen, Project
from pants.backend.python.targets.python_tests import PythonTests
from pants.base.build_environment import get_buildroot
Expand Down Expand Up @@ -131,7 +130,7 @@ def _sibling_is_test(source_set):
def has_test_type(types):
for target_type in types:
# TODO(Eric Ayers) Find a way for a target to identify itself instead of a hard coded list
if target_type in [JavaTests, PythonTests, ScalaTests]:
if target_type in (JavaTests, PythonTests):
return True
return False

Expand Down
2 changes: 1 addition & 1 deletion src/python/pants/docs/internals.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ How Some Base Classes Interrelate
---------------------------------

**Target**<br>
An addressable thing, such as a `python_binary` or `scala_tests`. To add
An addressable thing, such as a `python_binary` or `junit_tests`. To add
support for a new language, you probably want to add new target types to
represent things you can build with that language. Most Target instances
can depend on other Target instances. As a rule of thumb, if code in
Expand Down

0 comments on commit f7a2359

Please sign in to comment.