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