1load("@bazel_skylib//:bzl_library.bzl", "bzl_library") 2load("@bazel_skylib//rules:common_settings.bzl", "bool_flag", "string_flag") 3load("//rust/private:unpretty.bzl", "rust_unpretty_flag") 4load(":incompatible.bzl", "incompatible_flag") 5 6package(default_visibility = ["//visibility:public"]) 7 8bzl_library( 9 name = "bzl_lib", 10 srcs = glob(["**/*.bzl"]), 11) 12 13rust_unpretty_flag( 14 name = "unpretty", 15 build_setting_default = [ 16 "ast-tree,expanded", 17 "ast-tree", 18 "expanded,hygiene", 19 "expanded,identified", 20 "expanded", 21 "hir-tree", 22 "hir,identified", 23 "hir,typed", 24 "hir", 25 "identified", 26 "mir-cfg", 27 "mir", 28 "normal", 29 ], 30) 31 32# A flag controlling whether to rename first-party crates such that their names 33# encode the Bazel package and target name, instead of just the target name. 34# 35# First-party vs. third-party crates are identified using the value of 36# //settings:third_party_dir. 37bool_flag( 38 name = "rename_first_party_crates", 39 build_setting_default = False, 40) 41 42# A flag specifying the location of vendored third-party rust crates within this 43# repository that must not be renamed when `rename_first_party_crates` is enabled. 44# 45# Must be specified as a Bazel package, e.g. "//some/location/in/repo". 46string_flag( 47 name = "third_party_dir", 48 build_setting_default = "//third_party/rust", 49) 50 51# A flag to control whether rust_library and rust_binary targets should 52# implicitly depend on the *real* import macro, or on a no-op target. 53bool_flag( 54 name = "use_real_import_macro", 55 build_setting_default = False, 56) 57 58# When set, this flag causes rustc to emit .rmeta files and use them for rlib -> rlib dependencies. 59# While this involves one extra (short) rustc invocation to build the rmeta file, 60# it allows library dependencies to be unlocked much sooner, increasing parallelism during compilation. 61bool_flag( 62 name = "pipelined_compilation", 63 build_setting_default = False, 64) 65 66# A flag to control whether to link rust_binary and rust_test targets using 67# cc_common.link instead of rustc. 68bool_flag( 69 name = "experimental_use_cc_common_link", 70 build_setting_default = False, 71) 72 73# A flag to indicate that a global allocator is in use when using --@rules_rust//rust/settings:experimental_use_cc_common_link 74# Users need to specify this flag because rustc generates different set of symbols at link time when a global allocator is in use. 75# When the linking is not done by rustc, the `rust_toolchain` itself provides the appropriate set of symbols. 76bool_flag( 77 name = "experimental_use_global_allocator", 78 build_setting_default = False, 79) 80 81# A flag to have coverage tooling added as `coverage_common.instrumented_files_info.metadata_files` instead of 82# reporting tools like `llvm-cov` and `llvm-profdata` as runfiles to each test. 83bool_flag( 84 name = "experimental_use_coverage_metadata_files", 85 build_setting_default = False, 86) 87 88# A flag to set rustc --sysroot flag to the sysroot generated by rust_toolchain 89incompatible_flag( 90 name = "experimental_toolchain_generated_sysroot", 91 build_setting_default = True, 92 issue = "https://github.com/bazelbuild/rules_rust/issues/2039", 93) 94 95# A flag to control whether to link libstd dynamically. 96bool_flag( 97 name = "experimental_link_std_dylib", 98 build_setting_default = False, 99) 100 101# A flag to remove the SYSROOT environment variable from `Rustc` actions. 102incompatible_flag( 103 name = "incompatible_no_rustc_sysroot_env", 104 build_setting_default = True, 105 issue = "https://github.com/bazelbuild/rules_rust/issues/2429", 106) 107 108# A flag to control whether the shell path from a shell toolchain (`@bazel_tools//tools/sh:toolchain_type`) 109# is embedded into the bootstrap process wrapper for the `.sh` file. 110bool_flag( 111 name = "experimental_use_sh_toolchain_for_bootstrap_process_wrapper", 112 build_setting_default = False, 113) 114