fork/rules_rust

git clone https://git.julia.blue/fork/rules_rust

UebelAndreUpdated `rules_cc` and `rules_proto` (#945)e589105b

0.6.0
2.5 KiB59 linesraw
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# buildifier: disable=module-docstring
16load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
17load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
18load("//proto/raze:crates.bzl", "rules_rust_proto_fetch_remote_crates")
19
20# buildifier: disable=unnamed-macro
21def rust_proto_repositories(register_default_toolchain = True):
22    """Declare dependencies needed for proto compilation.
23
24    Args:
25        register_default_toolchain (bool, optional): If True, the default [rust_proto_toolchain](#rust_proto_toolchain)
26            (`@rules_rust//proto:default-proto-toolchain`) is registered. This toolchain requires a set of dependencies
27            that were generated using [cargo raze](https://github.com/google/cargo-raze). These will also be loaded.
28    """
29    maybe(
30        http_archive,
31        name = "rules_proto",
32        sha256 = "66bfdf8782796239d3875d37e7de19b1d94301e8972b3cbd2446b332429b4df1",
33        strip_prefix = "rules_proto-4.0.0",
34        urls = [
35            "https://mirror.bazel.build/github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
36            "https://github.com/bazelbuild/rules_proto/archive/refs/tags/4.0.0.tar.gz",
37        ],
38    )
39
40    maybe(
41        http_archive,
42        name = "com_google_protobuf",
43        sha256 = "758249b537abba2f21ebc2d02555bf080917f0f2f88f4cbe2903e0e28c4187ed",
44        strip_prefix = "protobuf-3.10.0",
45        urls = [
46            "https://mirror.bazel.build/github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
47            "https://github.com/protocolbuffers/protobuf/archive/v3.10.0.tar.gz",
48        ],
49        patch_args = ["-p1"],
50        patches = [
51            Label("//proto/patches:com_google_protobuf-v3.10.0-bzl_visibility.patch"),
52        ],
53    )
54
55    rules_rust_proto_fetch_remote_crates()
56
57    # Register toolchains
58    if register_default_toolchain:
59        native.register_toolchains(str(Label("//proto:default-proto-toolchain")))