fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
443b089c
main
1# Copyright 2021 The Bazel Authors. All rights reserved. 2# 3# Licensed under the Apache License, Version 2.0 (the "License"); 4# you may not use this file except in compliance with the License. 5# You may obtain a copy of the License at 6# 7# http://www.apache.org/licenses/LICENSE-2.0 8# 9# Unless required by applicable law or agreed to in writing, software 10# distributed under the License is distributed on an "AS IS" BASIS, 11# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 12# See the License for the specific language governing permissions and 13# limitations under the License. 14 15"""Module containing definitions of all Rust providers.""" 16 17CrateInfo = provider ( 18doc = "A provider containing general Crate information." , 19fields = { 20"aliases" : "Dict[Label, String]: Renamed and aliased crates" , 21"compile_data" : "depset[File]: Compile data required by this crate." , 22"compile_data_targets" : "depset[Label]: Compile data targets required by this crate." , 23"data" : "depset[File]: Compile data required by crates that use the current crate as a proc-macro." , 24"deps" : "depset[DepVariantInfo]: This crate's (rust or cc) dependencies' providers." , 25"edition" : "str: The edition of this crate." , 26"is_test" : "bool: If the crate is being compiled in a test context" , 27"metadata" : "File: The output from rustc from producing the output file. It is optional." , 28"name" : "str: The name of this crate." , 29"output" : "File: The output File that will be produced, depends on crate type." , 30"owner" : "Label: The label of the target that produced this CrateInfo" , 31"proc_macro_deps" : "depset[DepVariantInfo]: This crate's rust proc_macro dependencies' providers." , 32"root" : "File: The source File entrypoint to this crate, eg. lib.rs" , 33"rustc_env" : "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc." , 34"rustc_env_files" : "[File]: Files containing additional environment variables to set for rustc." , 35"rustc_output" : "File: The output from rustc from producing the output file. It is optional." , 36"rustc_rmeta_output" : "File: The rmeta file produced for this crate. It is optional." , 37"srcs" : "depset[File]: All source Files that are part of the crate." , 38"std_dylib" : "File: libstd.so file" , 39"type" : ( 40"str: The type of this crate " + 41"(see [rustc --crate-type](https://doc.rust-lang.org/rustc/command-line-arguments.html#--crate-type-a-list-of-types-of-crates-for-the-compiler-to-emit))." 42), 43"wrapped_crate_type" : ( 44"str, optional: The original crate type for targets generated using a previously defined " + 45"crate (typically tests using the `rust_test::crate` attribute)" 46), 47}, 48) 49 50DepInfo = provider ( 51doc = "A provider containing information about a Crate's dependencies." , 52fields = { 53"dep_env" : "File: File with environment variables direct dependencies build scripts rely upon." , 54"direct_crates" : "depset[AliasableDepInfo]" , 55"link_search_path_files" : "depset[File]: All transitive files containing search paths to pass to the linker" , 56"transitive_build_infos" : "depset[BuildInfo]" , 57"transitive_crate_outputs" : "depset[File]: All transitive crate outputs." , 58"transitive_crates" : "depset[CrateInfo]" , 59"transitive_data" : "depset[File]: Data of all transitive non-macro dependencies." , 60"transitive_metadata_outputs" : "depset[File]: All transitive metadata dependencies (.rmeta, for crates that provide them) and all transitive object dependencies (.rlib) for crates that don't provide metadata." , 61"transitive_noncrates" : "depset[LinkerInput]: All transitive dependencies that aren't crates." , 62"transitive_proc_macro_data" : "depset[File]: Data of all transitive proc-macro dependencies, and non-macro dependencies of those macros." , 63}, 64) 65 66CrateGroupInfo = provider ( 67doc = "A provider containing a group of crates." , 68fields = { 69"dep_variant_infos" : "depset[DepVariantInfo]: Dependency information from all crates in the group." , 70}, 71) 72 73BuildInfo = provider ( 74doc = "A provider containing `rustc` build settings for a given Crate." , 75fields = { 76"compile_data" : "Depset[File]: Compile data provided by the build script that was not copied into `out_dir`." , 77"dep_env" : "Optinal[File]: extra build script environment varibles to be set to direct dependencies." , 78"flags" : "Optional[File]: file containing additional flags to pass to rustc" , 79"link_search_paths" : "Optional[File]: file containing search paths to pass to rustc and linker" , 80"linker_flags" : "Optional[File]: file containing flags to pass to the linker invoked by rustc or cc_common.link" , 81"out_dir" : "Optional[File]: directory containing the result of a build script" , 82"rustc_env" : "Optional[File]: file containing additional environment variables to set for rustc." , 83}, 84) 85 86DepVariantInfo = provider ( 87doc = "A wrapper provider for a dependency of a crate. The dependency can be a Rust " + 88"dependency, in which case the `crate_info` and `dep_info` fields will be populated, " + 89"a Rust build script dependency, in which case `build_info` will be populated, a C/C++" + 90"dependency, in which case `cc_info` will be populated, or a Rust crate group, in which" + 91"case `crate_group_info` will be populated." , 92fields = { 93"build_info" : "BuildInfo: The BuildInfo of a Rust dependency" , 94"cc_info" : "CcInfo: The CcInfo of a C/C++ dependency" , 95"crate_group_info" : "CrateGroupInfo: The CrateGroupInfo of a Rust crate group dependency" , 96"crate_info" : "CrateInfo: The CrateInfo of a Rust dependency" , 97"dep_info" : "DepInfo: The DepInfo of a Rust dependency" , 98}, 99) 100 101RustcOutputDiagnosticsInfo = provider ( 102doc = ( 103"Save json diagnostics from rustc. Json diagnostics are able to be " + 104"consumed by tools such as rust-analyzer to provide IDE integration" 105), 106fields = { 107"rustc_output_diagnostics" : "bool: Whether or not to output diagnostics" , 108}, 109) 110 111StdLibInfo = provider ( 112doc = ( 113"A collection of files either found within the `rust-stdlib` artifact or " + 114"generated based on existing files." 115), 116fields = { 117"alloc_files" : "List[File]: `.a` files related to the `alloc` module." , 118"between_alloc_and_core_files" : "List[File]: `.a` files related to the `compiler_builtins` module." , 119"between_core_and_std_files" : "List[File]: `.a` files related to all modules except `adler`, `alloc`, `compiler_builtins`, `core`, and `std`." , 120"core_files" : "List[File]: `.a` files related to the `core` and `adler` modules" , 121"dot_a_files" : "Depset[File]: Generated `.a` files" , 122"memchr_files" : "Depset[File]: `.a` files associated with the `memchr` module." , 123"panic_files" : "Depset[File]: `.a` files associated with `panic_unwind` and `panic_abort`." , 124"self_contained_files" : "List[File]: All `.o` files from the `self-contained` directory." , 125"srcs" : "List[Target]: All targets from the original `srcs` attribute." , 126"std_dylib" : "File: libstd.so file" , 127"std_files" : "Depset[File]: `.a` files associated with the `std` module." , 128"std_rlibs" : "List[File]: All `.rlib` files" , 129"test_files" : "Depset[File]: `.a` files associated with the `test` module." , 130}, 131) 132 133CaptureClippyOutputInfo = provider ( 134doc = "Value of the `capture_clippy_output` build setting" , 135fields = { "capture_output" : "Value of the `capture_clippy_output` build setting" }, 136) 137 138ClippyInfo = provider ( 139doc = "Provides information on a clippy run." , 140fields = { 141"output" : "File with the clippy output." , 142}, 143) 144 145TestCrateInfo = provider ( 146doc = "A wrapper around a CrateInfo. " + 147"Certain rule types, like rust_static_library and rust_shared_library " + 148"are not intended for consumption by other Rust targets, and should not " + 149"provide a CrateInfo. However, one should still be able to write a rust_test " + 150"for them. Thus, we create a CrateInfo, but do not advertise it as such, " + 151"but rather through this provider, that rust_test understands." , 152fields = { 153"crate" : "CrateInfo: The underlying CrateInfo of the dependency" , 154}, 155) 156 157RustAnalyzerInfo = provider ( 158doc = "RustAnalyzerInfo holds rust crate metadata for targets" , 159fields = { 160"aliases" : "Dict[String, String]: Maps crate IDs to Replacement names these targets should be known as in Rust code" , 161"build_info" : "BuildInfo: build info for this crate if present" , 162"cfgs" : "List[String]: features or other compilation `--cfg` settings" , 163"crate" : "CrateInfo: Crate information." , 164"crate_specs" : "Depset[File]: transitive closure of OutputGroupInfo files" , 165"deps" : "List[String]: IDs of direct dependency crates" , 166"env" : "Dict[String: String]: Environment variables, used for the `env!` macro" , 167"id" : "String: Arbitrary unique ID for this crate" , 168"proc_macro_dylib_path" : "File: compiled shared library output of proc-macro rule" , 169}, 170) 171 172RustAnalyzerGroupInfo = provider ( 173doc = "RustAnalyzerGroupInfo holds multiple RustAnalyzerInfos" , 174fields = { 175"crate_specs" : "Depset[File]: transitive closure of OutputGroupInfo files" , 176"deps" : "List[String]: crate IDs of direct dependencies" , 177}, 178)