Skip to content

Commit

Permalink
Fix a broken 3rdparty example. (pantsbuild#5797)
Browse files Browse the repository at this point in the history
Fix an example that was using a broken include, and use explicit comments to ensure it doesn't break again.
  • Loading branch information
Stu Hood authored May 9, 2018
1 parent d0f9118 commit 0c5790f
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 4 deletions.
2 changes: 2 additions & 0 deletions 3rdparty/jvm/com/google/auto/value/BUILD
Original file line number Diff line number Diff line change
@@ -1,10 +1,12 @@
# Copyright 2015 Pants project contributors (see CONTRIBUTORS.md).
# Licensed under the Apache License, Version 2.0 (see LICENSE).

# DOCSTART: This target is included in documentation.
jar_library(
jars=[
jar(org='com.google.auto.value', name='auto-value', rev='1.1'),
],
# Is used as an annotation processor.
scope='compile',
)
# DOCEND
7 changes: 4 additions & 3 deletions examples/src/java/org/pantsbuild/example/3rdparty_jvm.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ may make sense to organize them in multiple subdirectories, say by category or b
In the appropriate `BUILD` file, you create a <a pantsref="bdict_jar_library">`jar_library`</a>
referencing the <a pantsref="bdict_jar">`jar`</a>s you want:

!inc[start-at=junit&end-before=scalatest](../../../../../../3rdparty/BUILD)
!inc[start-after=DOCSTART&end-before=DOCEND](../../../../../../3rdparty/jvm/com/google/auto/value/BUILD)

Here, the <a pantsref="bdict_jar_library">`jar_library`</a>'s name
defines a target address that other build targets can refer to. The
Expand All @@ -37,12 +37,13 @@ statements in your Java code.

For example, your `BUILD` file might have

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

And your Java code might have:

:::java
import org.junit.Test;
import com.google.auto.value.AutoValue;


"Round Trip" Dependencies
-------------------------
Expand Down
3 changes: 2 additions & 1 deletion examples/src/java/org/pantsbuild/example/autovalue/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,10 @@ jvm_binary(
],
)

# DOCSTART: This target is included in documentation.
java_library(name='autovalue-lib',
sources = globs('*'),
dependencies = [
'3rdparty/jvm/com/google/auto/value',
],
)
# DOCEND

0 comments on commit 0c5790f

Please sign in to comment.