fork/rules_rust

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

UebelAndreBump various dependencies (#3002)43e5279e

cleanup
6.1 KiB177 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//rust:repositories_transitive.bzl", "rules_rust_transitive_dependencies")
20
21rules_rust_transitive_dependencies()
22
23load("@rules_rust//crate_universe:repositories.bzl", "crate_universe_dependencies")
24
25crate_universe_dependencies(bootstrap = True)
26
27load("@rules_rust//tools/rust_analyzer:deps.bzl", "rust_analyzer_dependencies")
28
29rust_analyzer_dependencies()
30
31load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
32
33# We need to load rules_java before anything proto-related happens because otherwise it will pull in its own rules_java which isn't compatible with rules_jvm_external.
34http_archive(
35    name = "rules_java",
36    sha256 = "f8ae9ed3887df02f40de9f4f7ac3873e6dd7a471f9cddf63952538b94b59aeb3",
37    urls = [
38        "https://github.com/bazelbuild/rules_java/releases/download/7.6.1/rules_java-7.6.1.tar.gz",
39    ],
40)
41
42###############################################################################
43# Workspace examples
44###############################################################################
45
46# buildifier: disable=same-origin-load
47load("@rules_rust//rust:repositories.bzl", "rust_repository_set")
48
49# `rust_repository_set` is the core repository rule for downloading and defining
50# a rust_toolchain. Should there be a need for a customized toolchain, this macro can
51# be used to define and register one.
52rust_repository_set(
53    name = "fake_toolchain_for_test_of_sha256",
54    edition = "2018",
55    exec_triple = "x86_64-unknown-linux-gnu",
56    extra_target_triples = [],
57    sha256s = {
58        "rust-1.46.0-x86_64-unknown-linux-gnu": "e3b98bc3440fe92817881933f9564389eccb396f5f431f33d48b979fa2fbdcf5",
59        "rust-std-1.46.0-x86_64-unknown-linux-gnu": "ac04aef80423f612c0079829b504902de27a6997214eb58ab0765d02f7ec1dbc",
60        "rustfmt-1.4.12-x86_64-unknown-linux-gnu": "1894e76913303d66bf40885a601462844eec15fca9e76a6d13c390d7000d64b0",
61    },
62    versions = ["1.46.0"],
63)
64
65###############################################################################
66# Examples dependencies
67###############################################################################
68
69http_archive(
70    name = "rules_foreign_cc",
71    sha256 = "69023642d5781c68911beda769f91fcbc8ca48711db935a75da7f6536b65047f",
72    strip_prefix = "rules_foreign_cc-0.6.0",
73    url = "https://github.com/bazelbuild/rules_foreign_cc/archive/0.6.0.tar.gz",
74)
75
76load("@rules_foreign_cc//foreign_cc:repositories.bzl", "rules_foreign_cc_dependencies")
77
78rules_foreign_cc_dependencies()
79
80load("//sys:sys_deps.bzl", "sys_deps")
81
82sys_deps()
83
84local_repository(
85    name = "rules_rust_example_cargo_manifest_dir",
86    path = "cargo_manifest_dir/external_crate",
87)
88
89_LIBC_BUILD_FILE_CONTENT = """\
90load("@rules_rust//rust:defs.bzl", "rust_library")
91
92rust_library(
93    name = "libc",
94    srcs = glob(["src/**/*.rs"]),
95    edition = "2015",
96    rustc_flags = [
97        # In most cases, warnings in 3rd party crates are not interesting as
98        # they're out of the control of consumers. The flag here silences
99        # warnings. For more details see:
100        # https://doc.rust-lang.org/rustc/lints/levels.html
101        "--cap-lints=allow",
102    ],
103    visibility = ["//visibility:public"],
104)
105"""
106
107http_archive(
108    name = "libc",
109    build_file_content = _LIBC_BUILD_FILE_CONTENT,
110    sha256 = "1ac4c2ac6ed5a8fb9020c166bc63316205f1dc78d4b964ad31f4f21eb73f0c6d",
111    strip_prefix = "libc-0.2.20",
112    urls = [
113        "https://mirror.bazel.build/github.com/rust-lang/libc/archive/0.2.20.zip",
114        "https://github.com/rust-lang/libc/archive/0.2.20.zip",
115    ],
116)
117
118http_archive(
119    name = "rules_jvm_external",
120    sha256 = "08ea921df02ffe9924123b0686dc04fd0ff875710bfadb7ad42badb931b0fd50",
121    strip_prefix = "rules_jvm_external-6.1",
122    url = "https://github.com/bazelbuild/rules_jvm_external/releases/download/6.1/rules_jvm_external-6.1.tar.gz",
123)
124
125load("@rules_jvm_external//:repositories.bzl", "rules_jvm_external_deps")
126
127rules_jvm_external_deps()
128
129load("@rules_jvm_external//:setup.bzl", "rules_jvm_external_setup")
130
131rules_jvm_external_setup()
132
133load("@rules_jvm_external//:defs.bzl", "maven_install")
134
135maven_install(
136    name = "maven",
137    artifacts = [
138        "net.java.dev.jna:jna:5.14.0",
139        "org.hamcrest:hamcrest:2.2",
140    ],
141    maven_install_json = "@//:maven_install.json",
142    repositories = [
143        "https://repo1.maven.org/maven2",
144    ],
145)
146
147load("@maven//:defs.bzl", "pinned_maven_install")
148
149pinned_maven_install()
150
151###############################################################################
152
153http_archive(
154    name = "bazel_ci_rules",
155    sha256 = "eca21884e6f66a88c358e580fd67a6b148d30ab57b1680f62a96c00f9bc6a07e",
156    strip_prefix = "bazelci_rules-1.0.0",
157    url = "https://github.com/bazelbuild/continuous-integration/releases/download/rules-1.0.0/bazelci_rules-1.0.0.tar.gz",
158)
159
160load("@bazel_ci_rules//:rbe_repo.bzl", "rbe_preconfig")
161
162# Creates a default toolchain config for RBE.
163# Use this as is if you are using the rbe_ubuntu16_04 container,
164# otherwise refer to RBE docs.
165rbe_preconfig(
166    name = "buildkite_config",
167    toolchain = "ubuntu1804-bazel-java11",
168)
169
170load("@build_bazel_apple_support//crosstool:setup.bzl", "apple_cc_configure")
171
172# As of Bazel 7, Bazel's bundled cc_toolchain only supports using CommandLineTools and not a full Xcode.
173# This manifests itself if you try to use anything which requires access to $DEVELOPER_DIR, such as our bindgen example which non-hermetically tries to read libc++ headers from the system.
174# On CI (and for some of our contributors), we have a full Xcode install, so this fails.
175# We register the apple_support cc_toolchain here because it supports both CommandLineTools and full Xcodes.
176# See https://github.com/bazelbuild/rules_rust/issues/2207 and https://github.com/bazelbuild/bazel/issues/20638
177apple_cc_configure()