Skip to content

Commit

Permalink
Leverage default sources where possible.
Browse files Browse the repository at this point in the history
Testing Done:
Used the following (on a modern linux distro) to ~autoconvert:
```
for t in java_library scala_library junit_tests python_library python_tests
do
  ./pants filter --type=$t :: \
  | cut -d: -f1 | sort -u | sed -e '/^$/d' -e 's|$|/BUILD|' \
  | while read f; do ls $f* || echo $f >2; done \
  | xargs sed -r -i "/\bsources\s*=\s*globs(['\"]*.[a-z]+['\"])\s*,?/d"
done
```

And then fixed up some failing tests by comparing the results of the
following when run on master and this branch - then fixing targets that
owned no files in the branch only:
```
./pants list {examples,testprojects}:: | {
  while read t; do
    [ -z "$(./pants filemap $t)" ] && echo "No files owned by $t"
  done
}
```

CI went green here:
  https://travis-ci.org/pantsbuild/pants/builds/173760812

Bugs closed: 4033

Reviewed at https://rbcommons.com/s/twitter/r/4358/
  • Loading branch information
jsirois committed Nov 7, 2016
1 parent 40c214a commit 5813a2d
Show file tree
Hide file tree
Showing 93 changed files with 24 additions and 112 deletions.
1 change: 0 additions & 1 deletion contrib/go/src/python/pants/contrib/go/subsystems/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'3rdparty/python:requests',
'3rdparty/python:six',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

python_library(
name='python',
sources=globs('*.py'),
resource_targets=[
':resources'
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_tests(
sources=globs('*.py'),
dependencies=[
'contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle:all',
'src/python/pants/util:dirutil',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ python_library(
'src/python/pants/subsystem',
'src/python/pants/util:dirutil',
],
sources = globs('*.py'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,4 @@ python_library(
'src/python/pants/base:payload_field',
'src/python/pants/build_graph',
],
sources = globs('*.py'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -10,5 +10,4 @@ python_library(
'src/python/pants/task',
'src/python/pants/util:memo',
],
sources = globs('*.py'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -8,5 +8,4 @@ junit_tests(
'3rdparty:scalatest',
'contrib/scalajs/examples/src/scala/org/pantsbuild/scalajs/example/factfinder',
],
sources=globs('*.scala'),
)
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/3rdparty_jvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ statements in your Java code.

For example, your `BUILD` file might have

!inc[start-after=sources&end-before=src/java](../../../../../tests/java/org/pantsbuild/example/hello/greet/BUILD)
!inc[start-after=junit_tests&end-before=src/java](../../../../../tests/java/org/pantsbuild/example/hello/greet/BUILD)

And your Java code might have:

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(
sources = globs('*.java'),
dependencies = [
'examples/src/scala/org/pantsbuild/example/scala_with_java_sources',
],
Expand Down
6 changes: 3 additions & 3 deletions examples/src/python/example/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -137,9 +137,9 @@ Use `test` to run the tests. This uses `pytest`:
============== test session starts ===============
platform darwin -- Python 2.6.8 -- py-1.4.20 -- pytest-2.5.2
plugins: cov, timeout
collected 1 items
collected 2 items

examples/tests/python/example_test/hello/greet/greet.py .
examples/tests/python/example_test/hello/greet/test_greet.py ..

============ 1 passed in 0.02 seconds ============

Expand Down Expand Up @@ -310,7 +310,7 @@ parameters:
plugins: cov, timeout
collected 2 items

examples/tests/python/example_test/hello/greet/greet.py .
examples/tests/python/example_test/hello/greet/test_greet.py .

========= 1 tests deselected by '-kreq' ==========
===== 1 passed, 1 deselected in 0.05 seconds =====
Expand Down
1 change: 0 additions & 1 deletion examples/src/python/example/pants_publish_plugin/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

python_library(
name='pants-publish-plugin',
sources=globs('*.py'),
dependencies=[
'src/python/pants/backend/jvm/targets:java',
'src/python/pants/backend/jvm/tasks:jar_task',
Expand Down
4 changes: 1 addition & 3 deletions examples/src/scala/org/pantsbuild/example/fact/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

# A pure scala library, with no Java or 3rdparty dependencies.
scala_library(
sources=globs('*.scala'),
)
scala_library()
scala_js_library(name='fact-js',
sources=globs('*.scala'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@ scala_library(
dependencies=[
'examples/src/java/org/pantsbuild/example/hello/greet:greet',
],
sources=globs('*.scala'),
resources = [
'examples/src/resources/org/pantsbuild/example/hello',
],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@
# Test the Hello World example's "greet" library

junit_tests(
sources=globs('*.java'),
dependencies=[
'examples/src/java/org/pantsbuild/example/hello/greet',
],
Expand Down
1 change: 0 additions & 1 deletion examples/tests/python/example_test/hello/greet/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ python_tests(
'examples/src/python/example/hello/greet:greet',
':prep',
],
sources=globs('*.py'),
)

# Prepare for the 'greet' test. Realistically, you wouldn't set up a
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,4 @@ junit_tests(
'3rdparty:junit',
'3rdparty:scalatest',
],
sources=globs('*.scala'),
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_tests(
sources=globs('*.py'),
dependencies=[
'pants-plugins/src/python/internal_backend/utilities:plugin',
'src/python/pants/base:revision',
Expand Down
1 change: 0 additions & 1 deletion src/java/com/sun/tools/javac/api/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


java_library(
sources=globs('*.java'),
dependencies=[
],
platform='java7',
Expand Down
1 change: 0 additions & 1 deletion src/java/org/pantsbuild/args4j/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(
sources=globs('*.java'),
dependencies=[
'3rdparty:args4j',
'3rdparty:guava',
Expand Down
1 change: 0 additions & 1 deletion src/java/org/pantsbuild/junit/annotations/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,5 @@ java_library(
Annotations for use with org.pantsbuild#junit-runner that support running tests in parallel.
""")
),
sources=globs('*.java'),
platform='java7',
)
1 change: 1 addition & 0 deletions src/java/org/pantsbuild/testing/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(
# We have to use explicit sources here to grab `EasyMockTest.java` which otherwise gets excluded.
sources=globs('*.java'),
dependencies=[
'3rdparty:easymock',
Expand Down
1 change: 0 additions & 1 deletion src/java/org/pantsbuild/tools/jar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(
sources=globs('*.java'),
dependencies=[
'3rdparty:args4j',
'3rdparty:guava',
Expand Down
1 change: 0 additions & 1 deletion src/java/org/pantsbuild/tools/junit/withretry/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,5 @@ java_library(
dependencies=[
'3rdparty:junit',
],
sources=globs('*.java'),
platform='java7',
)
1 change: 0 additions & 1 deletion src/java/org/pantsbuild/tools/runner/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ java_library(
dependencies=[
'3rdparty:guava',
],
sources=globs('*.java'),
platform='java7',
)

Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/docgen/targets/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/base:payload',
'src/python/pants/base:payload_field',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/docgen/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
resource_targets = [
':resources',
],
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/graph_info/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/base:build_environment',
'src/python/pants/base:cmd_line_spec_parser',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/jvm/zinc/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python:six',
],
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/backend/python/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@

python_library(
name='python',
sources=globs('*.py'),
dependencies=[
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/build_graph/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python:six',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/cache/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python:requests',
'3rdparty/python:six',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/core_tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
resource_targets=[':templates',],
dependencies=[
'3rdparty/python:ansicolors',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/fs/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/util:contextutil',
'src/python/pants/util:meta',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/help/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'src/python/pants/base:build_environment',
'src/python/pants/base:exceptions',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/invalidation/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/base:hash_utils',
'src/python/pants/build_graph',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/ivy/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python/twitter/commons:twitter.common.collections',
'3rdparty/python:six',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/java/junit/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/util:objects',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/logging/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'src/python/pants/util:dirutil',
],
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/option/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'3rdparty/python:ansicolors',
'3rdparty/python:six',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/process/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python:fasteners',
'3rdparty/python:psutil',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/source/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources=globs('*.py'),
dependencies=[
'3rdparty/python:six',
'3rdparty/python/twitter/commons:twitter.common.dirutil',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/stats/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/subsystem',
'src/python/pants/util:dirutil',
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/subsystem/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
sources = globs('*.py'),
dependencies = [
'3rdparty/python/twitter/commons:twitter.common.collections',
'src/python/pants/option'
Expand Down
1 change: 0 additions & 1 deletion src/python/pants/task/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@


python_library(
sources = globs('*.py'),
dependencies = [
'src/python/pants/base:build_environment',
'src/python/pants/base:exceptions',
Expand Down
1 change: 0 additions & 1 deletion src/scala/org/pantsbuild/zinc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,6 @@ scala_library(
'src/scala/sbt/compiler/javac',
'src/scala/sbt/inc',
],
sources=globs('*.scala'),
strict_deps=True,
platform='java7',
)
1 change: 0 additions & 1 deletion src/scala/org/pantsbuild/zinc/cache/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,6 @@ scala_library(
'3rdparty:guava',
'3rdparty:jsr305',
],
sources=globs('*.scala'),
strict_deps=True,
platform='java7',
)
1 change: 0 additions & 1 deletion src/scala/org/pantsbuild/zinc/logging/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,6 @@ scala_library(
dependencies=[
'3rdparty/jvm/com/typesafe/sbt:incremental-compiler',
],
sources=globs('*.scala'),
strict_deps=True,
platform='java7',
)
1 change: 0 additions & 1 deletion src/scala/sbt/compiler/javac/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ scala_library(
dependencies=[
'3rdparty/jvm/com/typesafe/sbt:incremental-compiler',
],
sources=globs('*.scala'),
platform='java7',
)
1 change: 0 additions & 1 deletion src/scala/sbt/inc/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,5 @@ scala_library(
dependencies=[
'3rdparty/jvm/com/typesafe/sbt:incremental-compiler',
],
sources=globs('*.scala'),
platform='java7',
)
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,5 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(
sources = globs('*.java'),
dependencies = [],
)
Loading

0 comments on commit 5813a2d

Please sign in to comment.