Skip to content

Commit

Permalink
Remove deprecated from_target usage in examples.
Browse files Browse the repository at this point in the history
This eliminates a deprecation warning that happens during full graph parse:

```
[illuminati pants (master)]$ ./pants dependees
WARN] While parsing BuildFile(examples/src/protobuf/org/pantsbuild/example/unpacked_jars/BUILD, FileSystemProjectTree(/Users/kwilson/dev/pants)):
    3:
    4: java_protobuf_library(name='unpacked_jars',
    5:   # This uses the legacy deferred sources mechanism.
*   6:   sources=from_target(':external-source'),
        DeprecationWarning: DEPRECATED: pants.build_graph.from_target.__call__ will be removed in version 1.3.0.
  Using sources = from_target() has been deprecated. Try using remote_sources() instead.

For example, instead of this:

  java_protobuf_library(name='proto',
    sources=from_target(':other-target'),
    platform='java7',
  )

Try this:

  remote_sources(name='proto',
    dest=java_protobuf_library,
    sources_target=':other-target',
    args=dict(
      platform='java7',
    )
  )

    7: )
    8:
    9: remote_sources(name='better-unpacked-jars',
   10:   # This uses the new deferred sources mechanism.

```

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

Bugs closed: 3900, 3901

Reviewed at https://rbcommons.com/s/twitter/r/4262/
  • Loading branch information
kwlzn committed Sep 26, 2016
1 parent b30acb6 commit 8f70d14
Showing 1 changed file with 1 addition and 7 deletions.
Original file line number Diff line number Diff line change
@@ -1,13 +1,7 @@
# Copyright 2014 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

java_protobuf_library(name='unpacked_jars',
# This uses the legacy deferred sources mechanism.
sources=from_target(':external-source'),
)

remote_sources(name='better-unpacked-jars',
# This uses the new deferred sources mechanism.
remote_sources(name='unpacked_jars',
dest=java_protobuf_library,
sources_target=':external-source',
)
Expand Down

0 comments on commit 8f70d14

Please sign in to comment.