fork/rules_rust

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

UebelAndreFixed use of rust-analyzer with rust_static_library and rust_shared_library (#1482)685dfda4

0.8.1
5.0 KiB149 linesraw
1workspace(name = "examples")
2
3# Users of `rules_rust` will commonly be unable to load it
4# using a `local_repository`. Instead, to setup the rules,
5# please see https://bazelbuild.github.io/rules_rust/#setup
6local_repository(
7    name = "rules_rust",
8    path = "..",
9)
10
11load("@rules_rust//rust:repositories.bzl", "rules_rust_dependencies", "rust_register_toolchains")
12
13rules_rust_dependencies()
14
15rust_register_toolchains(
16    edition = "2018",
17)
18
19load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
20
21rust_analyzer_dependencies()
22
23load("@rules_rust//bindgen:repositories.bzl", "rust_bindgen_dependencies", "rust_bindgen_register_toolchains")
24
25rust_bindgen_dependencies()
26
27rust_bindgen_register_toolchains()
28
29load("@rules_rust//proto:repositories.bzl", "rust_proto_repositories")
30
31rust_proto_repositories()
32
33load("@rules_rust//proto:transitive_repositories.bzl", "rust_proto_transitive_repositories")
34
35rust_proto_transitive_repositories()
36
37load("@rules_rust//wasm_bindgen:repositories.bzl", "rust_wasm_bindgen_dependencies", "rust_wasm_bindgen_register_toolchains")
38
39rust_wasm_bindgen_dependencies()
40
41rust_wasm_bindgen_register_toolchains()
42
43load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
44
45###############################################################################
46# Workspace examples
47###############################################################################
48
49# buildifier: disable=same-origin-load
50load("@rules_rust//rust:repositories.bzl", "rust_repository_set")
51
52# `rust_repository_set` is the core repository rule for downloading and defining
53# a rust_toolchain. Should there be a need for a customized toolchain, this macro can
54# be used to define and register one.
55rust_repository_set(
56    name = "fake_toolchain_for_test_of_sha256",
57    edition = "2018",
58    exec_triple = "x86_64-unknown-linux-gnu",
59    extra_target_triples = [],
60    rustfmt_version = "1.4.12",
61    sha256s = {
62        "rust-1.46.0-x86_64-unknown-linux-gnu": "e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5",
63        "rust-std-1.46.0-x86_64-unknown-linux-gnu": "ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc",
64        "rustfmt-1.4.12-x86_64-unknown-linux-gnu": "1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0",
65    },
66    version = "1.46.0",
67)
68
69###############################################################################
70# Examples dependencies
71###############################################################################
72
73http_archive(
74    name = "build_bazel_rules_nodejs",
75    sha256 = "c78216f5be5d451a42275b0b7dc809fb9347e2b04a68f68bad620a2b01f5c774",
76    urls = ["https://github.com/bazelbuild/rules_nodejs/releases/download/5.5.2/rules_nodejs-5.5.2.tar.gz"],
77)
78
79load("@build_bazel_rules_nodejs//:index.bzl", "node_repositories")
80
81node_repositories()
82
83http_archive(
84    name = "rules_foreign_cc",
85    sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f",
86    strip_prefix = "rules_foreign_cc-0.6.0",
87    url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz",
88)
89
90load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
91
92rules_foreign_cc_dependencies()
93
94load("//sys:sys_deps.bzl", "sys_deps")
95
96sys_deps()
97
98local_repository(
99    name = "rules_rust_example_cargo_manifest_dir",
100    path = "cargo_manifest_dir/external_crate",
101)
102
103_LIBC_BUILD_FILE_CONTENT = """\
104load("@rules_rust//rust:defs.bzl", "rust_library")
105
106rust_library(
107    name = "libc",
108    srcs = glob(["src/**/*.rs"]),
109    edition = "2015",
110    rustc_flags = [
111        # In most cases, warnings in 3rd party crates are not interesting as
112        # they're out of the control of consumers. The flag here silences
113        # warnings. For more details see:
114        # https://doc.rust-lang.org/rustc/lints/levels.html
115        "--cap-lints=allow",
116    ],
117    visibility = ["//visibility:public"],
118)
119"""
120
121http_archive(
122    name = "libc",
123    build_file_content = _LIBC_BUILD_FILE_CONTENT,
124    sha256 = "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d",
125    strip_prefix = "libc-0.2.20",
126    urls = [
127        "https://mirror.bazel.build/github.com/rust-lang/libc/archive/0.2.20.zip",
128        "https://github.com/rust-lang/libc/archive/0.2.20.zip",
129    ],
130)
131
132###############################################################################
133
134http_archive(
135    name = "bazel_toolchains",
136    sha256 = "179ec02f809e86abf56356d8898c8bd74069f1bd7c56044050c2cd3d79d0e024",
137    strip_prefix = "bazel-toolchains-4.1.0",
138    urls = [
139        "https://mirror.bazel.build/github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
140        "https://github.com/bazelbuild/bazel-toolchains/releases/download/4.1.0/bazel-toolchains-4.1.0.tar.gz",
141    ],
142)
143
144load("@bazel_toolchains//rules:rbe_repo.bzl", "rbe_autoconfig")
145
146# Creates a default toolchain config for RBE.
147# Use this as is if you are using the rbe_ubuntu16_04 container,
148# otherwise refer to RBE docs.
149rbe_autoconfig(name = "buildkite_config")