From b36aefbfbc6ba87e2cb1469e919d13b68730c17d Mon Sep 17 00:00:00 2001 From: Carmi Grushko Date: Mon, 7 Nov 2016 21:29:25 +0000 Subject: Rollback of commit b043fafb957ae8038088e427ff27a5c9f951c979. *** Reason for rollback *** Use proto_lang_toolchain() in java_proto_library, after fixing breakage. Verified on Jenkins, http://ci.bazel.io/job/Gerrit-bazel-tests/169/ *** Original change description *** Automated [] rollback of commit a396b070ae36032a973672e11145533621c39edc. *** Reason for rollback *** Breaks tests on latest, as proto_lang_toolchain didn't make it into the 0.4.0 release see http://ci.bazel.io/job/bazel-tests/306/BAZEL_VERSION=latest,PLATFORM_NAME=linux-x86_64/console *** Original change description *** Use proto_lang_toolchain() in java_proto_library. -- MOS_MIGRATED_REVID=138432193 --- third_party/protobuf/3.0.0/BUILD | 7 +++++++ .../3.0.0/proto_lang_toolchain_if_exists.bzl | 24 ++++++++++++++++++++++ third_party/protobuf/BUILD | 2 ++ 3 files changed, 33 insertions(+) create mode 100644 third_party/protobuf/3.0.0/proto_lang_toolchain_if_exists.bzl (limited to 'third_party/protobuf') diff --git a/third_party/protobuf/3.0.0/BUILD b/third_party/protobuf/3.0.0/BUILD index 767ebd7306..0146f66727 100644 --- a/third_party/protobuf/3.0.0/BUILD +++ b/third_party/protobuf/3.0.0/BUILD @@ -3,6 +3,7 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) load("//third_party/protobuf:protobuf.bzl", "py_proto_library") +load(":proto_lang_toolchain_if_exists.bzl", "proto_lang_toolchain") filegroup( name = "srcs", @@ -311,3 +312,9 @@ cc_library( visibility = ["//visibility:public"], deps = [":protobuf_clib"], ) + +proto_lang_toolchain( + name = "java_toolchain", + command_line = "--java_out=shared,immutable:$(OUT)", + runtime = ":protobuf", +) diff --git a/third_party/protobuf/3.0.0/proto_lang_toolchain_if_exists.bzl b/third_party/protobuf/3.0.0/proto_lang_toolchain_if_exists.bzl new file mode 100644 index 0000000000..d0416f600d --- /dev/null +++ b/third_party/protobuf/3.0.0/proto_lang_toolchain_if_exists.bzl @@ -0,0 +1,24 @@ +# Copyright 2016 The Bazel Authors. All rights reserved. +# +# Licensed under the Apache License, Version 2.0 (the "License"); +# you may not use this file except in compliance with the License. +# You may obtain a copy of the License at +# +# http://www.apache.org/licenses/LICENSE-2.0 +# +# Unless required by applicable law or agreed to in writing, software +# distributed under the License is distributed on an "AS IS" BASIS, +# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. +# See the License for the specific language governing permissions and +# limitations under the License. + +"""Calls proto_lang_toolchain(), but only if it's already been released.""" + +# TODO(carmi): Delete this after proto_lang_toolchain() is released in Bazel. +def proto_lang_toolchain(**kwargs): + """Calls proto_lang_toolchain(), but only if it's already been released.""" + if hasattr(native, 'proto_lang_toolchain'): + native.proto_lang_toolchain(**kwargs) + else: + native.filegroup(name = kwargs['name']) + diff --git a/third_party/protobuf/BUILD b/third_party/protobuf/BUILD index 0f39107b93..f6e1ea9fda 100644 --- a/third_party/protobuf/BUILD +++ b/third_party/protobuf/BUILD @@ -29,3 +29,5 @@ proto_alias("protobuf_lite", PROTOBUF_VERSION) proto_alias("protobuf_clib", PROTOBUF_VERSION) proto_alias("protoc_lib", PROTOBUF_VERSION) + +proto_alias("java_toolchain", PROTOBUF_VERSION) -- cgit v1.2.3