Skip to content

Commit

Permalink
Have Bazel use the the prebuilt guava jars from the 21.0-20161101 dai…
Browse files Browse the repository at this point in the history
…ly build. See https://bazel-review.googlesource.com/#/c/7270/ for details.

--
MOS_MIGRATED_REVID=139580987
  • Loading branch information
haxorz authored and dslomov committed Nov 21, 2016
1 parent fa1ee08 commit b4c4bce
Show file tree
Hide file tree
Showing 3 changed files with 37 additions and 9 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -125,8 +125,7 @@ bootstrap_java_library(
name = "skylark-deps",
jars = [
"//third_party:auto_value-jars",
"//third_party:error_prone-jars",
"//third_party:guava-jars",
"//third_party:bootstrap_guava_and_error_prone-jars",
"//third_party:jsr305-jars",
"//third_party/protobuf:protobuf-jars",
],
Expand Down Expand Up @@ -166,7 +165,7 @@ bootstrap_java_library(
jars = [
"//third_party:jsr305-jars",
"//third_party:auto_value-jars",
"//third_party:guava-jars",
"//third_party:bootstrap_guava_and_error_prone-jars",
],
)

Expand Down
2 changes: 1 addition & 1 deletion src/main/java/com/google/devtools/build/lib/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -1186,7 +1186,7 @@ load("//tools/build_rules:java_rules_skylark.bzl", "bootstrap_java_library")
bootstrap_java_library(
name = "shell-skylark",
srcs = glob(["shell/*.java"]),
jars = ["//third_party:guava-jars"],
jars = ["//third_party:bootstrap_guava_and_error_prone-jars"],
)

########################################################################
Expand Down
39 changes: 34 additions & 5 deletions third_party/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -314,14 +314,37 @@ java_import(
],
)

filegroup(
name = "guava_and_error_prone-jars",
srcs = [
"guava/guava-21.0-20161101.jar",
"error_prone/error_prone_annotation-2.0.13.jar",
"error_prone/error_prone_annotations-2.0.13.jar",
# error_prone_core contains a copy of an earlier version of guava, so
# it's very important that it occur *after* the guava jar in the
# -classpath arg for both 'javac' and 'java'. The latter is especially
# important when dealing with pre-built jars that themselves assume
# they'll be provided guava classes at runtime via -classpath (e.g.
# guava-testlib uses stuff from guava).
"error_prone/error_prone_core-2.0.13.jar",
"jcip_annotations/jcip-annotations-1.0-1.jar",
"jsr305/jsr-305.jar",
"pcollections/pcollections-2.1.2.jar",
"//third_party/checker_framework_dataflow",
"//third_party/jformatstring",
],
)

# For bootstrapping JavaBuilder
filegroup(
name = "error_prone-jars",
name = "bootstrap_guava_and_error_prone-jars",
srcs = [
"guava/guava-21.0-20161101.jar",
"error_prone/error_prone_annotation-2.0.13.jar",
"error_prone/error_prone_annotations-2.0.13.jar",
# See the comment about error_prone_core in 'guava_and_error_prone-jars'
# above.
"error_prone/error_prone_core-2.0.13.jar",
"guava/guava-19.0.jar",
"jcip_annotations/jcip-annotations-1.0-1.jar",
"jsr305/jsr-305.jar",
"pcollections/pcollections-2.1.2.jar",
Expand All @@ -330,15 +353,21 @@ filegroup(
],
)

# As of Guava 20.0, Guava code uses Error Prone annotations. This isn't a
# problem when compiling with java 8, but is a problem when compiling Bazel
# with java 7 (the Error Prone jars need to be on the javac classpath). So,
# until we drop support for compiling Bazel with java 7, we unfortunately need
# to ensure that the Error Prone jars are always used together with the Guava
# jars.
java_import(
name = "guava",
jars = ["guava/guava-19.0.jar"],
jars = [":guava_and_error_prone-jars"],
)

# For bootstrapping JavaBuilder
filegroup(
name = "guava-jars",
srcs = ["guava/guava-19.0.jar"],
srcs = ["guava/guava-21.0-20161101.jar"],
)

java_import(
Expand Down Expand Up @@ -429,7 +458,7 @@ java_import(

java_import(
name = "guava-testlib",
jars = ["guava/guava-testlib.jar"],
jars = ["guava/guava-testlib-21.0-20161101.jar"],
)

java_import(
Expand Down

0 comments on commit b4c4bce

Please sign in to comment.