Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 1 | load("@bazel_skylib//:bzl_library.bzl", "bzl_library") |
Brian Silverman | 5f6f276 | 2022-08-13 19:30:05 -0700 | [diff] [blame^] | 2 | 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", "is_proc_macro_dep", "is_proc_macro_dep_enabled") |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 3 | |
| 4 | exports_files(["LICENSE"]) |
| 5 | |
| 6 | bzl_library( |
| 7 | name = "bzl_lib", |
| 8 | srcs = [ |
| 9 | ":workspace.bzl", |
| 10 | ], |
| 11 | visibility = ["//visibility:public"], |
| 12 | ) |
| 13 | |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 14 | # This setting may be changed from the command line to generate machine readable errors. |
| 15 | error_format( |
| 16 | name = "error_format", |
| 17 | build_setting_default = "human", |
| 18 | visibility = ["//visibility:public"], |
| 19 | ) |
| 20 | |
Brian Silverman | 5f6f276 | 2022-08-13 19:30:05 -0700 | [diff] [blame^] | 21 | # This setting may be used to pass extra options to clippy from the command line. |
| 22 | # It applies across all targets. |
| 23 | clippy_flags( |
| 24 | name = "clippy_flags", |
| 25 | build_setting_default = [], |
| 26 | visibility = ["//visibility:public"], |
| 27 | ) |
| 28 | |
| 29 | # This setting may be used to identify dependencies of proc-macro-s. |
| 30 | # This feature is only enabled if `is_proc_macro_dep_enabled` is true. |
| 31 | # Its value controls the BAZEL_RULES_RUST_IS_PROC_MACRO_DEP environment variable |
| 32 | # made available to the rustc invocation. |
| 33 | is_proc_macro_dep( |
| 34 | name = "is_proc_macro_dep", |
| 35 | build_setting_default = False, |
| 36 | visibility = ["//visibility:public"], |
| 37 | ) |
| 38 | |
| 39 | # This setting enables the feature to identify dependencies of proc-macro-s, |
| 40 | # see `is_proc_macro_dep`. |
| 41 | is_proc_macro_dep_enabled( |
| 42 | name = "is_proc_macro_dep_enabled", |
| 43 | build_setting_default = False, |
| 44 | visibility = ["//visibility:public"], |
| 45 | ) |
| 46 | |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 47 | # This setting may be used to pass extra options to rustc from the command line |
| 48 | # in non-exec configuration. |
| 49 | # It applies across all targets whereas the rustc_flags option on targets applies only |
| 50 | # to that target. This can be useful for passing build-wide options such as LTO. |
| 51 | extra_rustc_flags( |
| 52 | name = "extra_rustc_flags", |
| 53 | build_setting_default = [], |
| 54 | visibility = ["//visibility:public"], |
| 55 | ) |
| 56 | |
Brian Silverman | 5f6f276 | 2022-08-13 19:30:05 -0700 | [diff] [blame^] | 57 | extra_rustc_flag( |
| 58 | name = "extra_rustc_flag", |
| 59 | build_setting_default = "", |
| 60 | visibility = ["//visibility:public"], |
| 61 | ) |
| 62 | |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 63 | # This setting may be used to pass extra options to rustc from the command line |
| 64 | # in exec configuration. |
| 65 | # It applies across all targets whereas the rustc_flags option on targets applies only |
| 66 | # to that target. This can be useful for passing build-wide options such as LTO. |
| 67 | extra_exec_rustc_flags( |
| 68 | name = "extra_exec_rustc_flags", |
| 69 | build_setting_default = [], |
| 70 | visibility = ["//visibility:public"], |
| 71 | ) |
| 72 | |
Brian Silverman | 5f6f276 | 2022-08-13 19:30:05 -0700 | [diff] [blame^] | 73 | extra_exec_rustc_flag( |
| 74 | name = "extra_exec_rustc_flag", |
| 75 | build_setting_default = "", |
| 76 | visibility = ["//visibility:public"], |
| 77 | ) |
| 78 | |
Brian Silverman | cc09f18 | 2022-03-09 15:40:20 -0800 | [diff] [blame] | 79 | # This setting is used by the clippy rules. See https://bazelbuild.github.io/rules_rust/rust_clippy.html |
| 80 | label_flag( |
| 81 | name = "clippy.toml", |
| 82 | build_setting_default = "//tools/clippy:clippy.toml", |
| 83 | visibility = ["//visibility:public"], |
| 84 | ) |
| 85 | |
| 86 | # This setting is used by the rustfmt rules. See https://bazelbuild.github.io/rules_rust/rust_fmt.html |
| 87 | label_flag( |
| 88 | name = "rustfmt.toml", |
| 89 | build_setting_default = "//tools/rustfmt:rustfmt.toml", |
| 90 | visibility = ["//visibility:public"], |
| 91 | ) |
| 92 | |
| 93 | alias( |
| 94 | name = "rustfmt", |
| 95 | actual = "//tools/rustfmt", |
| 96 | visibility = ["//visibility:public"], |
| 97 | ) |
| 98 | |
| 99 | capture_clippy_output( |
| 100 | name = "capture_clippy_output", |
| 101 | build_setting_default = False, |
| 102 | visibility = ["//visibility:public"], |
| 103 | ) |