Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Prepare for --incompatible_use_toolchain_providers_in_java_common #241

Merged
merged 1 commit into from
Mar 27, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
18 changes: 9 additions & 9 deletions WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -29,6 +29,7 @@ http_archive(
"//third_party/io_grpc_grpc_java:054def3c63.patch",
"//third_party/io_grpc_grpc_java:0959a846c8.patch",
"//third_party/io_grpc_grpc_java:952a767b9c.patch",
"//third_party/io_grpc_grpc_java:c63752789e.patch",
],
sha256 = "f5d0bdebc2a50d0e28f0d228d6c35081d3e973e6159f2695aa5c8c7f93d1e4d6",
strip_prefix = "grpc-java-1.19.0",
Expand All @@ -41,19 +42,19 @@ grpc_java_repositories()

http_archive(
name = "googleapis",
build_file = "@build_buildfarm//:BUILD.googleapis",
sha256 = "7b6ea252f0b8fb5cd722f45feb83e115b689909bbb6a393a873b6cbad4ceae1d",
url = "https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip",
strip_prefix = "googleapis-143084a2624b6591ee1f9d23e7f5241856642f4d",
build_file = "@build_buildfarm//:BUILD.googleapis",
url = "https://github.com/googleapis/googleapis/archive/143084a2624b6591ee1f9d23e7f5241856642f4d.zip",
)

# The API that we implement.
http_archive(
name = "remote_apis",
build_file = "@build_buildfarm//:BUILD.remote_apis",
sha256 = "6f22ba09356f8dbecb87ba03cacf147939f77fef1c9cfaffb3826691f3686e9b",
url = "https://github.com/bazelbuild/remote-apis/archive/cfe8e540cbb424e3ebc649ddcbc91190f70e23a6.zip",
strip_prefix = "remote-apis-cfe8e540cbb424e3ebc649ddcbc91190f70e23a6",
build_file = "@build_buildfarm//:BUILD.remote_apis",
url = "https://github.com/bazelbuild/remote-apis/archive/cfe8e540cbb424e3ebc649ddcbc91190f70e23a6.zip",
)

load("//3rdparty:workspace.bzl", "maven_dependencies")
Expand All @@ -75,7 +76,6 @@ http_archive(
)

load("@io_bazel_rules_docker//container:container.bzl", "container_pull")

load(
"@io_bazel_rules_docker//java:image.bzl",
_java_image_repos = "repositories",
Expand All @@ -84,8 +84,8 @@ load(
_java_image_repos()

container_pull(
name = "java_base",
registry = "gcr.io",
repository = "distroless/java",
digest = "sha256:8c1769cb253bdecc257470f7fba05446a55b70805fa686f227a11655a90dfe9e",
name = "java_base",
digest = "sha256:8c1769cb253bdecc257470f7fba05446a55b70805fa686f227a11655a90dfe9e",
registry = "gcr.io",
repository = "distroless/java",
)
38 changes: 38 additions & 0 deletions third_party/io_grpc_grpc_java/c63752789e.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From c63752789e61dd44120dbafcc59f6c12d72d652f Mon Sep 17 00:00:00 2001
From: Eric Anderson <ejona@google.com>
Date: Thu, 7 Mar 2019 16:22:54 -0800
Subject: [PATCH] java_grpc_library.bzl: Pre-migrate for Bazel
incompatible_use_toolchain_providers_in_java_common

This doesn't actually yet work with
--incompatible_use_toolchain_providers_in_java_common, as Bazel 0.23 didn't
include enough pieces. But this will work in 0.24 with the flag flipped. In
both cases it will continue working if the flag is not specified.

See https://github.com/grpc/grpc-java/issues/5383#issuecomment-470357965 and
https://github.com/bazelbuild/bazel/issues/7186
---
java_grpc_library.bzl | 6 ++++--
1 file changed, 4 insertions(+), 2 deletions(-)

diff --git a/java_grpc_library.bzl b/java_grpc_library.bzl
index 4601d4d78c..ff8abd422a 100644
--- a/java_grpc_library.bzl
+++ b/java_grpc_library.bzl
@@ -1,3 +1,5 @@
+load("@bazel_tools//tools/jdk:toolchain_utils.bzl", "find_java_runtime_toolchain", "find_java_toolchain")
+
# "repository" here is for Bazel builds that span multiple WORKSPACES.
def _path_ignoring_repository(f):
if len(f.owner.workspace_root) == 0:
@@ -40,8 +42,8 @@ def _java_rpc_library_impl(ctx):

java_info = java_common.compile(
ctx,
- java_toolchain = ctx.attr._java_toolchain,
- host_javabase = ctx.attr._host_javabase,
+ java_toolchain = find_java_toolchain(ctx, ctx.attr._java_toolchain),
+ host_javabase = find_java_runtime_toolchain(ctx, ctx.attr._host_javabase),
source_jars = [srcjar],
output_source_jar = ctx.outputs.srcjar,
output = ctx.outputs.jar,