forked from bazelbuild/rules_rust
-
Notifications
You must be signed in to change notification settings - Fork 0
/
BUILD.bazel
141 lines (124 loc) · 3.94 KB
/
BUILD.bazel
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
load("@bazel_skylib//rules:common_settings.bzl", "string_flag")
load(
"//rust:defs.bzl",
"capture_clippy_output",
"clippy_flags",
"error_format",
"extra_exec_rustc_flag",
"extra_exec_rustc_flags",
"extra_rustc_flag",
"extra_rustc_flags",
"no_std",
"per_crate_rustc_flag",
"rustc_output_diagnostics",
)
exports_files([
"LICENSE",
"MODULE.bazel",
])
bzl_library(
name = "bzl_lib",
srcs = [
":version.bzl",
],
visibility = ["//visibility:public"],
)
# This setting may be changed from the command line to generate machine readable errors.
error_format(
name = "error_format",
build_setting_default = "human",
visibility = ["//visibility:public"],
)
# This setting may be changed from the command line to generate rustc diagnostics.
rustc_output_diagnostics(
name = "rustc_output_diagnostics",
build_setting_default = False,
visibility = ["//visibility:public"],
)
# This setting may be used to pass extra options to clippy from the command line.
# It applies across all targets.
clippy_flags(
name = "clippy_flags",
build_setting_default = [],
visibility = ["//visibility:public"],
)
# This setting may be used to pass extra options to rustc from the command line
# in non-exec configuration.
# It applies across all targets whereas the rustc_flags option on targets applies only
# to that target. This can be useful for passing build-wide options such as LTO.
extra_rustc_flags(
name = "extra_rustc_flags",
build_setting_default = [],
visibility = ["//visibility:public"],
)
extra_rustc_flag(
name = "extra_rustc_flag",
build_setting_default = "",
visibility = ["//visibility:public"],
)
# This setting may be used to pass extra options to rustc from the command line
# in exec configuration.
# It applies across all targets whereas the rustc_flags option on targets applies only
# to that target. This can be useful for passing build-wide options such as LTO.
extra_exec_rustc_flags(
name = "extra_exec_rustc_flags",
build_setting_default = [],
visibility = ["//visibility:public"],
)
extra_exec_rustc_flag(
name = "extra_exec_rustc_flag",
build_setting_default = "",
visibility = ["//visibility:public"],
)
per_crate_rustc_flag(
name = "experimental_per_crate_rustc_flag",
build_setting_default = "",
visibility = ["//visibility:public"],
)
# This setting is used by the clippy rules. See https://bazelbuild.github.io/rules_rust/rust_clippy.html
label_flag(
name = "clippy.toml",
build_setting_default = "//tools/clippy:clippy.toml",
visibility = ["//visibility:public"],
)
# This setting is used by the rustfmt rules. See https://bazelbuild.github.io/rules_rust/rust_fmt.html
label_flag(
name = "rustfmt.toml",
build_setting_default = "//tools/rustfmt:rustfmt.toml",
visibility = ["//visibility:public"],
)
alias(
name = "rustfmt",
actual = "//tools/rustfmt",
visibility = ["//visibility:public"],
)
capture_clippy_output(
name = "capture_clippy_output",
build_setting_default = False,
visibility = ["//visibility:public"],
)
# This setting may be used to enable builds without the standard library.
# Currently only no_std + alloc is supported, which can be enabled with setting the value to "alloc".
# In the future we could add support for additional modes, e.g "core", "alloc,collections".
string_flag(
name = "no_std",
build_setting_default = "off",
values = [
"alloc",
"off",
],
visibility = ["//visibility:public"],
)
# A hack target to allow as to only apply the no_std mode in target config.
no_std(
name = "build_target_in_no_std",
)
# A config setting for setting conditional `cargo_features`, `deps`, based on the `:no_std` value.
config_setting(
name = "is_no_std",
flag_values = {
":build_target_in_no_std": "alloc",
},
visibility = ["//visibility:public"],
)