Skip to content

Commit

Permalink
Deprecate .intransitive() in favor of argument.
Browse files Browse the repository at this point in the history
I believe that this is the last of the BUILD file cleanups for
replacing methods with parameters.

Testing Done:
https://travis-ci.org/pantsbuild/pants/builds/51429047

Reviewed at https://rbcommons.com/s/twitter/r/1797/
  • Loading branch information
dturner-tw committed Feb 20, 2015
1 parent 0179636 commit 065b231
Show file tree
Hide file tree
Showing 4 changed files with 16 additions and 10 deletions.
13 changes: 7 additions & 6 deletions BUILD.tools
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ jar_library(name = 'cobertura-run',
jar(
org = 'net.sourceforge.cobertura',
name = 'cobertura',
rev = '2.1.0-twitter-05').intransitive()
])
rev = '2.1.0-twitter-05',
intransitive = True,
)])

# The reporting phase does not need asm.
jar_library(name = 'cobertura-report',
Expand All @@ -68,9 +69,9 @@ jar_library(name = 'benchmark-java-allocation-instrumenter-2.1',
jar(
org = 'com.google.code.java-allocation-instrumenter',
name = 'java-allocation-instrumenter',
rev = '2.1'
).intransitive()
])
rev = '2.1',
intransitive = True,
)])

jar_library(name = 'zinc',
jars = [
Expand Down Expand Up @@ -103,7 +104,7 @@ jar_library(name = 'scala-specs',

jar_library(name = 'scala-repl',
jars = [
jar(org = 'org.scala-lang', name = 'jline', rev = SCALA_REV).intransitive(),
jar(org = 'org.scala-lang', name = 'jline', rev = SCALA_REV, intransitive = True),
],
dependencies = [
':scala-compiler',
Expand Down
4 changes: 2 additions & 2 deletions examples/src/java/com/pants/examples/3rdparty_jvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -142,13 +142,13 @@ target, you can depend on a `jar` that specifies a version and sets

**If you notice that one "foreign" dependency pulls in mostly wrong
things,** tell Pants not to pull in its dependencies. In your
`3rdparty/.../BUILD` file, call the `jar`'s `intransitive` method; then
`3rdparty/.../BUILD` file, use `jar`'s `intransitive` argument; then
carefully add hand-picked versions:

:::python
jar_library(name="retro-naming-factory",
jars=[
jar(org='retro', name='retro-factory', rev='5.0.18').intransitive(),
jar(org='retro', name='retro-factory', rev='5.0.18', intransitive=True),
],
dependencies=[
# Don't use retro's expected (old, incompatible) common-logging
Expand Down
1 change: 1 addition & 0 deletions src/python/pants/backend/jvm/targets/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ python_library(
'src/python/pants/backend/core/targets:common',
'src/python/pants/base:build_environment',
'src/python/pants/base:build_manual',
'src/python/pants/base:deprecated',
'src/python/pants/base:exceptions',
'src/python/pants/base:payload',
'src/python/pants/base:payload_field',
Expand Down
8 changes: 6 additions & 2 deletions src/python/pants/backend/jvm/targets/jar_dependency.py
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@

from pants.backend.jvm.targets.exclude import Exclude
from pants.base.build_manual import manual
from pants.base.deprecated import deprecated
from pants.base.payload_field import PayloadField, stable_json_sha1


Expand Down Expand Up @@ -73,7 +74,7 @@ class JarDependency(object):
)

def __init__(self, org, name, rev=None, force=False, ext=None, url=None, apidocs=None,
type_=None, classifier=None, mutable=None, artifacts=None):
type_=None, classifier=None, mutable=None, artifacts=None, intransitive=False):
"""
:param string org: The Maven ``groupId`` of this dependency.
:param string name: The Maven ``artifactId`` of this dependency.
Expand All @@ -94,13 +95,15 @@ def __init__(self, org, name, rev=None, force=False, ext=None, url=None, apidocs
:param boolean mutable: Inhibit caching of this mutable artifact. A common use is for
Maven -SNAPSHOT style artifacts in an active development/integration cycle.
:param list artifacts: A list of additional IvyArtifacts
:param boolean intransitive: Declares this Dependency intransitive, indicating only the jar for
the dependency itself should be downloaded and placed on the classpath
"""
self.org = org
self.name = name
self.rev = rev
self.force = force
self.excludes = tuple()
self.transitive = True
self.transitive = not intransitive
self.apidocs = apidocs
self.mutable = mutable
self._classifier = classifier
Expand Down Expand Up @@ -146,6 +149,7 @@ def exclude(self, org, name=None):
return self

@manual.builddict()
@deprecated('0.0.30', hint_message='Use jar(..., intransitive=True) instead')
def intransitive(self):
"""Declares this Dependency intransitive, indicating only the jar for the dependency itself
should be downloaded and placed on the classpath"""
Expand Down

0 comments on commit 065b231

Please sign in to comment.