fork/rules_rust

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

Roman Kashitsynfeat(#514): pass extra flags to clippy (#1264)f7cb22ef

0.5.0
2.7 KiB92 linesraw
1load("@bazel_skylib//:bzl_library.bzl", "bzl_library")
2load("//rust:defs.bzl", "capture_clippy_output", "clippy_flags", "error_format", "extra_exec_rustc_flags", "extra_rustc_flags")
3
4exports_files(["LICENSE"])
5
6bzl_library(
7    name = "bzl_lib",
8    srcs = [
9        ":workspace.bzl",
10    ],
11    visibility = ["//visibility:public"],
12)
13
14filegroup(
15    name = "distro",
16    srcs = glob(["*.bzl"]) + [
17        "//bindgen:distro",
18        "//cargo:distro",
19        "//crate_universe:distro",
20        "//proto:distro",
21        "//rust:distro",
22        "//tools:distro",
23        "//util:distro",
24        "//wasm_bindgen:distro",
25        "BUILD.bazel",
26        "README.md",
27        "LICENSE.txt",
28        "WORKSPACE.bazel",
29    ],
30    visibility = ["//:__subpackages__"],
31)
32
33# This setting may be changed from the command line to generate machine readable errors.
34error_format(
35    name = "error_format",
36    build_setting_default = "human",
37    visibility = ["//visibility:public"],
38)
39
40# This setting may be used to pass extra options to clippy from the command line.
41# It applies across all targets.
42clippy_flags(
43    name = "clippy_flags",
44    build_setting_default = [],
45    visibility = ["//visibility:public"],
46)
47
48# This setting may be used to pass extra options to rustc from the command line
49# in non-exec configuration.
50# It applies across all targets whereas the rustc_flags option on targets applies only
51# to that target. This can be useful for passing build-wide options such as LTO.
52extra_rustc_flags(
53    name = "extra_rustc_flags",
54    build_setting_default = [],
55    visibility = ["//visibility:public"],
56)
57
58# This setting may be used to pass extra options to rustc from the command line
59# in exec configuration.
60# It applies across all targets whereas the rustc_flags option on targets applies only
61# to that target. This can be useful for passing build-wide options such as LTO.
62extra_exec_rustc_flags(
63    name = "extra_exec_rustc_flags",
64    build_setting_default = [],
65    visibility = ["//visibility:public"],
66)
67
68# This setting is used by the clippy rules. See https://bazelbuild.github.io/rules_rust/rust_clippy.html
69label_flag(
70    name = "clippy.toml",
71    build_setting_default = "//tools/clippy:clippy.toml",
72    visibility = ["//visibility:public"],
73)
74
75# This setting is used by the rustfmt rules. See https://bazelbuild.github.io/rules_rust/rust_fmt.html
76label_flag(
77    name = "rustfmt.toml",
78    build_setting_default = "//tools/rustfmt:rustfmt.toml",
79    visibility = ["//visibility:public"],
80)
81
82alias(
83    name = "rustfmt",
84    actual = "//tools/rustfmt",
85    visibility = ["//visibility:public"],
86)
87
88capture_clippy_output(
89    name = "capture_clippy_output",
90    build_setting_default = False,
91    visibility = ["//visibility:public"],
92)