1# Copyright 2018 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Dependencies for Rust proto rules""" 16 17load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") 18load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe") 19load("//proto/protobuf/3rdparty/crates:defs.bzl", "crate_repositories") 20 21def rust_proto_protobuf_dependencies(): 22 maybe( 23 http_archive, 24 name = "rules_proto", 25 sha256 = "dc3fb206a2cb3441b485eb1e423165b231235a1ea9b031b4433cf7bc1fa460dd", 26 strip_prefix = "rules_proto-5.3.0-21.7", 27 urls = [ 28 "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", 29 "https://github.com/bazelbuild/rules_proto/archive/refs/tags/5.3.0-21.7.tar.gz", 30 ], 31 ) 32 33 maybe( 34 http_archive, 35 name = "com_google_protobuf", 36 sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed", 37 strip_prefix = "protobuf-3.10.0", 38 urls = [ 39 "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz", 40 "https://github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz", 41 ], 42 patch_args = ["-p1"], 43 patches = [ 44 Label("//proto/protobuf/3rdparty/patches:com_google_protobuf-v3.10.0-bzl_visibility.patch"), 45 ], 46 ) 47 48 crate_repositories() 49 50# buildifier: disable=unnamed-macro 51def rust_proto_protobuf_register_toolchains(register_toolchains = True): 52 """Register toolchains for proto compilation.""" 53 54 if register_toolchains: 55 native.register_toolchains(str(Label("//proto/protobuf:default-proto-toolchain"))) 56