Skip to content

Commit

Permalink
Move the Java tools deploy jars refrences to checked-in deploy jars
Browse files Browse the repository at this point in the history
instead of embedding the deploy jars built at the same time with the bazel binary.

This comes in preparation for moving the Java tools to remote repositories (see #6316).

Moving the tools happens in two phases:
1. Using checked-in deploy jars/binaries instead of those built when bazel was built
2. Moving the checked-in jars/binaries to a remote repository and make bazel reference them from there. This step can only happen under an incompatible flag.

This PR addresses the first point. Doing the move incrementally this way is safer and allows finding bugs earlier. It also allows moving the Java tools code base out of the bazel repository.

We are making this change gradually for each java tool defined in JAVA_TOOLS (found in src/BUILD).

Closes #7114.

PiperOrigin-RevId: 229524951
  • Loading branch information
iirina authored and Copybara-Service committed Jan 16, 2019
1 parent 6c0707a commit f4604ba
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 52 deletions.
48 changes: 22 additions & 26 deletions src/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -115,43 +115,46 @@ py_binary(
deps = [":create_embedded_tools_lib"],
)

# The tools Bazel uses to compile Java.
# TODO(#6316): Gradually remove the targets here.
JAVA_TOOLS = [
"//third_party/jarjar:embedded_tools_srcs",
"//third_party/java/jdk/langtools:test-srcs",
"//third_party/java/proguard:embedded_tools",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper:srcs",
"//src/tools/singlejar:embedded_tools",
"//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:embedded_tools",
"//third_party/ijar",
"//third_party/ijar:zipper",
"//third_party/ijar:embedded_tools",
"//third_party/java/jacoco:srcs",
] + select({
"//src/conditions:arm": [],
"//conditions:default": [
"//src/tools/singlejar:singlejar_local",
],
})

# TODO(philwo): Clean this up, once a Bazel that can run py_binary and sh_binary
# in Skylark rules on Windows has been released.
[filegroup(
name = "embedded_tools" + suffix + "_srcs",
srcs = [
srcs = JAVA_TOOLS + [
"BUILD.tools",
"//tools:embedded_tools_srcs",
"//third_party:gpl-srcs",
"//third_party/java/java_tools:java_tools",
"//third_party/java/j2objc:embedded_tools_srcs",
"//third_party/jarjar:embedded_tools_srcs",
"//third_party/java/jdk/langtools:test-srcs",
"//third_party/java/proguard:embedded_tools",
"//third_party/py/concurrent:srcs",
"//third_party/py/gflags:srcs",
"//third_party/py/six:srcs",
"//src/conditions:embedded_tools",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/jarhelper:srcs",
"//src/tools/android/java/com/google/devtools/build/android:embedded_tools",
"//src/tools/launcher:srcs",
"//src/tools/singlejar:embedded_tools",
"//src/main/cpp/util:embedded_tools",
"//src/main/native:embedded_tools",
"//src/main/protobuf:srcs",
"//src/java_tools/buildjar:JavaBuilderDeploy",
"//src/java_tools/buildjar:VanillaJavaBuilder_deploy.jar",
"//src/java_tools/buildjar/java/com/google/devtools/build/buildjar/genclass:GenClass_deploy.jar",
"//src/java_tools/import_deps_checker/java/com/google/devtools/build/importdeps:embedded_tools",
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner:Runner_deploy.jar",
"//src/java_tools/junitrunner/java/com/google/testing/junit/runner:ExperimentalRunner_deploy.jar",
"//src/java_tools/junitrunner/java/com/google/testing/coverage:embedded_tools",
"//third_party/def_parser:srcs",
"//third_party/ijar",
"//third_party/ijar:zipper",
"//third_party/ijar:embedded_tools",
"//src/java_tools/buildjar/java/com/google/devtools/build/java/turbine:turbine_direct",
"//src/java_tools/buildjar/java/com/google/devtools/build/java/turbine/javac:turbine_deploy.jar",
"//third_party/java/jacoco:srcs",
"//third_party/zlib:embedded_tools",
] + select({
"//src/conditions:darwin": [
Expand All @@ -169,13 +172,6 @@ py_binary(
"//third_party/def_parser:def_parser",
],
"//conditions:default": [],
}) + select({
"//src/conditions:arm": [
"//src/java_tools/singlejar:SingleJar_deploy.jar",
],
"//conditions:default": [
"//src/tools/singlejar:singlejar_local",
],
}) +
jdk,
visibility = [
Expand Down
10 changes: 0 additions & 10 deletions src/java_tools/buildjar/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -37,16 +37,6 @@ java_binary(
runtime_deps = ["//src/java_tools/buildjar/java/com/google/devtools/build/buildjar:vanilla_java_builder"],
)

filegroup(
name = "JavaBuilderDeploy",
srcs = [":JavaBuilder_deploy.jar"],
tags = ["manual"],
visibility = [
":buildjar_package_group",
"//src:__pkg__",
],
)

filegroup(
name = "bootstrap_VanillaJavaBuilder_deploy.jar",
srcs = ["//src/java_tools/buildjar/java/com/google/devtools/build/buildjar:bootstrap_VanillaJavaBuilder_deploy.jar"],
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,6 @@ java_binary(
],
)

filegroup(
name = "turbine_direct",
srcs = ["turbine_direct_binary_deploy.jar"],
visibility = [
"//:__subpackages__",
],
)

filegroup(
name = "srcs",
srcs = glob(["**/*.java"]) + [
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,14 +7,6 @@ filegroup(
srcs = glob(["**"]),
)

filegroup(
name = "embedded_tools",
srcs = [
"JacocoCoverage_jarjar_deploy.jar",
],
tags = ["manual"],
)

# Bazel custom Jacoco runner used to provide proper initialization and lcov
# report generation when using offline Jacoco instrumentation.
# This target should not be used as a dependency (except when writing tests for
Expand Down

0 comments on commit f4604ba

Please sign in to comment.