Skip to content

Commit

Permalink
Leverage default targets throughout pants BUILDs.
Browse files Browse the repository at this point in the history
Add support for the default name protocol to managed_jar_dependencies to
support this cleanup sweep.

Testing Done:
Brought to you almost completely by sed and bash:
```
find . -name "BUILD*" | \
xargs grep -E "name\s*=" | \
sed -r -e "s|((.*/)?([^/]+)/BUILD[^:]*):.*name\s*=\s*['\"]([^'\"]+)['\"].*|\1 \3 \4|" | \
while read file dir name
do
  [ "$dir" == "$name" ] && echo "$file $name"
done | \
sort -u | \
while read file name
do
  sed -ri \
    -e "s|(\s*name\s*=\s*['\"]$name['\"]\s*,\s*|(|" \
    -e "/name\s*=\s*['\"]$name['\"]/d" $file
done
```

For posterity, the 1 code (non-BUILD) change is here:
  https://rbcommons.com/s/twitter/r/4287/diff/1?page=5#98

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

Bugs closed: 3936

Reviewed at https://rbcommons.com/s/twitter/r/4287/
  • Loading branch information
jsirois committed Oct 8, 2016
1 parent 5271d80 commit cace0c4
Show file tree
Hide file tree
Showing 251 changed files with 151 additions and 269 deletions.
2 changes: 1 addition & 1 deletion 3rdparty/jvm/com/google/auto/value/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jar_library(name='value',
jar_library(
jars=[
jar(org='com.google.auto.value', name='auto-value', rev='1.1'),
],
Expand Down
1 change: 0 additions & 1 deletion 3rdparty/jvm/commons-io/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
jar_library(
name='commons-io',
jars=[
jar(org='commons-io', name='commons-io', rev='2.4'),
],
Expand Down
1 change: 0 additions & 1 deletion contrib/android/examples/src/android/example_library/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

android_library(
name='example_library',
manifest='AndroidManifest.xml',
libraries=['contrib/android/examples/3rdparty/android:android-support-v4'],
include_patterns=[
Expand Down
1 change: 0 additions & 1 deletion contrib/android/examples/src/android/hello/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

android_binary(
name='hello',
sources=rglobs('src/*.java'),
manifest='AndroidManifest.xml',
dependencies = [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

android_binary(
name='hello_with_library',
sources=rglobs('main/src/*.java'),
manifest='main/AndroidManifest.xml',
dependencies = [
Expand Down
1 change: 0 additions & 1 deletion contrib/cpp/examples/src/cpp/calcsqrt/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

cpp_binary(
name='calcsqrt',
sources=['main.cc'],
libraries=['m'],
)
Expand Down
1 change: 0 additions & 1 deletion contrib/cpp/examples/src/cpp/example/hello/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

cpp_library(
name='hello',
sources=[
'hello.cc',
'hello.h',
Expand Down
1 change: 0 additions & 1 deletion contrib/cpp/src/python/pants/contrib/cpp/targets/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
name='targets',
sources=[
'cpp_binary.py',
'cpp_library.py',
Expand Down
1 change: 0 additions & 1 deletion contrib/cpp/src/python/pants/contrib/cpp/tasks/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
name='tasks',
sources=[
'cpp_compile.py',
'cpp_binary_create.py',
Expand Down
1 change: 0 additions & 1 deletion contrib/cpp/src/python/pants/contrib/cpp/toolchain/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# Licensed under the Apache License, Version 2.0 (see LICENSE).

python_library(
name='toolchain',
sources=[
'cpp_toolchain.py',
],
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_library(
name='tasks',
sources=[
'findbugs.py',
],
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(
name='tasks',
sources=['test_findbugs.py'],
dependencies=[
'contrib/findbugs/src/python/pants/contrib/findbugs/tasks:tasks',
Expand Down
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(
name='subsystems',
sources=globs('*.py'),
dependencies=[
'3rdparty/python:requests',
Expand Down
1 change: 0 additions & 1 deletion contrib/go/src/python/pants/contrib/go/targets/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
target(
name='targets',
dependencies=[
':go_binary',
':go_library',
Expand Down
1 change: 0 additions & 1 deletion contrib/go/src/python/pants/contrib/go/tasks/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
target(
name='tasks',
dependencies=[
':go_binary_create',
':go_buildgen',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/babel-loader/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='babel-loader',
version='5.3.2'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/babel/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='babel',
version='5.8.23'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/css-loader/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='css-loader',
version='0.17.0'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/mocha/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='mocha',
version='2.3.0'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/null-loader/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='null-loader',
version='0.1.1'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/react/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='react',
version='0.13.3'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/style-loader/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='style-loader',
version='0.12.3'
)
1 change: 0 additions & 1 deletion contrib/node/examples/3rdparty/node/webpack/BUILD
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@
node_remote_module(
name='webpack',
version='1.12.0'
)
1 change: 0 additions & 1 deletion contrib/node/examples/src/node/preinstalled-project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@
# an alternative Node module resolver.

node_preinstalled_module(
name='preinstalled-project',
sources=globs('package.json', 'src/*.js', 'test/*.js'),
dependencies_archive_url=
'https://dl.bintray.com/pantsbuild/node-preinstalled-modules/node_modules.tar.gz'
Expand Down
1 change: 0 additions & 1 deletion contrib/node/examples/src/node/server-project/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
# package.json enough to get this benefit without any duplication.

node_module(
name='server-project',
sources=globs('package.json', 'checkarg', 'src/*.js', 'test/*.js'),
dependencies=[
'contrib/node/examples/3rdparty/node/babel',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/examples/src/node/web-build-tool/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_module(
name='web-build-tool',
sources=globs('package.json','web-build-tool','webpack.config.base.js'),
dependencies=[
'contrib/node/examples/3rdparty/node/babel-loader',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/examples/src/node/web-component-button/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_module(
name='web-component-button',
sources=globs('package.json', 'webpack.config.js', 'src/*', 'test/*'),
dependencies=[
'contrib/node/examples/3rdparty/node/mocha',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/examples/src/node/web-project/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
node_module(
name='web-project',
sources=globs('package.json', 'webpack.config.js', 'src/*', 'test/*'),
dependencies=[
'contrib/node/examples/3rdparty/node/mocha',
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).

target(
name='resolvers',
dependencies=[
':npm_resolver',
':node_preinstalled_module_resolver',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/src/python/pants/contrib/node/targets/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).

target(
name='targets',
dependencies=[
':node_module',
':node_preinstalled_module',
Expand Down
1 change: 0 additions & 1 deletion contrib/node/src/python/pants/contrib/node/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).

target(
name='tasks',
dependencies=[
':node_repl',
':node_resolve',
Expand Down
1 change: 0 additions & 1 deletion contrib/python/src/python/pants/contrib/python/isort/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
python_binary(
name='isort',
source='isort.py',
dependencies=[
'3rdparty/python:isort',
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(
name='checkstyle',
sources=globs('*.py'),
dependencies=[
'contrib/python/src/python/pants/contrib/python/checks/tasks/checkstyle:all',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

scala_js_binary(name='factfinder',
scala_js_binary(
dependencies=[
'examples/src/scala/org/pantsbuild/example/fact:fact-js',
],
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_library(
name = 'subsystems',
dependencies = [
'contrib/node/src/python/pants/contrib/node/subsystems/resolvers:node_resolver_base',
'src/python/pants/option',
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_library(
name = 'targets',
dependencies = [
'contrib/node/src/python/pants/contrib/node/targets:node_module',
'contrib/scalajs/src/python/pants/contrib/scalajs/subsystems',
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_library(
name = 'tasks',
dependencies = [
'contrib/scalajs/src/python/pants/contrib/scalajs/targets',
'src/python/pants/backend/jvm/tasks/jvm_compile:zinc',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

junit_tests(name='factfinder',
junit_tests(
dependencies=[
'3rdparty:guava',
'3rdparty:junit',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
java_thrift_library(
name='android_generator',
sources=['struct.thrift'],
compiler='scrooge',
language='android',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
java_thrift_library(
name='dummy_generator',
sources=['dummy.thrift'],
compiler='scrooge',
language='android',
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_library(
name='tasks',
dependencies=[
':scrooge_gen',
':thrift_linter',
Expand Down
2 changes: 1 addition & 1 deletion examples/src/antlr/org/pantsbuild/example/exp/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

target(name='exp',
target(
dependencies=[
':exp_antlr3',
':exp_antlr4',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Example of annotation_processor() target

java_library(name='example',
java_library(
sources=['Example.java'],
# Is used by an annotation processor.
scope='compile',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Example for annotation_processor() target

jvm_binary(name='main',
jvm_binary(
source='Main.java',
main='org.pantsbuild.example.annotation.main.Main',
basename = 'annotation-example',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
#
# Example of annotation_processor() target

annotation_processor(name='processor',
annotation_processor(
sources=['ExampleProcessor.java'],
processors=['org.pantsbuild.example.annotation.processor.ExampleProcessor'],
dependencies=[
Expand Down
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/antlr3/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jvm_binary(name='antlr3',
jvm_binary(
source='ExampleAntlr3.java',
main='org.pantsbuild.example.antlr3.ExampleAntlr3',
dependencies=[
Expand Down
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/antlr4/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jvm_binary(name='antlr4',
jvm_binary(
source='ExampleAntlr4.java',
main='org.pantsbuild.example.antlr4.ExampleAntlr4',
dependencies=[
Expand Down
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/autovalue/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jvm_binary(name='autovalue',
jvm_binary(
main = 'org.pantsbuild.example.autovalue.AutoValueMain',
dependencies = [
':autovalue-lib',
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jvm_binary(name = 'simple',
jvm_binary(
source = 'HelloWorld.java',
main = 'org.pantsbuild.example.hello.simple.HelloWorld',
)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(name = 'java_sources',
java_library(
sources = globs('*.java'),
dependencies = [
'examples/src/scala/org/pantsbuild/example/scala_with_java_sources',
Expand Down
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/jaxb/main/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

jvm_binary(name='main',
jvm_binary(
basename='jaxb-example',
dependencies=[
'examples/src/java/org/pantsbuild/example/jaxb/reader',
Expand Down
2 changes: 1 addition & 1 deletion examples/src/java/org/pantsbuild/example/jaxb/reader/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(name='reader',
java_library(
dependencies=[
'examples/src/resources/org/pantsbuild/example/jaxb',
],
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_library(name='make_it_rain',
java_library(
sources=['MakeItRain.java',],
dependencies=[
'3rdparty:thrift-0.9.2',
Expand Down
Loading

0 comments on commit cace0c4

Please sign in to comment.