fork/rules_rust
git clone https://git.julia.blue/fork/rules_rust
867fc37c
0.9.0
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"deps" : "depset[DepVariantInfo]: This crate's (rust or cc) dependencies' providers." , 23"edition" : "str: The edition of this crate." , 24"is_test" : "bool: If the crate is being compiled in a test context" , 25"metadata" : "File: The rmeta file produced for this crate. It is optional." , 26"name" : "str: The name of this crate." , 27"output" : "File: The output File that will be produced, depends on crate type." , 28"owner" : "Label: The label of the target that produced this CrateInfo" , 29"proc_macro_deps" : "depset[DepVariantInfo]: This crate's rust proc_macro dependencies' providers." , 30"root" : "File: The source File entrypoint to this crate, eg. lib.rs" , 31"rustc_env" : "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc." , 32"srcs" : "depset[File]: All source Files that are part of the crate." , 33"type" : ( 34"str: The type of this crate " + 35"(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))." 36), 37"wrapped_crate_type" : ( 38"str, optional: The original crate type for targets generated using a previously defined " + 39"crate (typically tests using the `rust_test::crate` attribute)" 40), 41}, 42) 43 44DepInfo = provider ( 45doc = "A provider containing information about a Crate's dependencies." , 46fields = { 47"dep_env" : "File: File with environment variables direct dependencies build scripts rely upon." , 48"direct_crates" : "depset[AliasableDepInfo]" , 49"link_search_path_files" : "depset[File]: All transitive files containing search paths to pass to the linker" , 50"transitive_build_infos" : "depset[BuildInfo]" , 51"transitive_crate_outputs" : "depset[File]: All transitive crate outputs." , 52"transitive_crates" : "depset[CrateInfo]" , 53"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." , 54"transitive_noncrates" : "depset[LinkerInput]: All transitive dependencies that aren't crates." , 55}, 56) 57 58BuildInfo = provider ( 59doc = "A provider containing `rustc` build settings for a given Crate." , 60fields = { 61"dep_env" : "File: extra build script environment varibles to be set to direct dependencies." , 62"flags" : "File: file containing additional flags to pass to rustc" , 63"link_flags" : "File: file containing flags to pass to the linker" , 64"link_search_paths" : "File: file containing search paths to pass to the linker" , 65"out_dir" : "File: directory containing the result of a build script" , 66"rustc_env" : "File: file containing additional environment variables to set for rustc." , 67}, 68) 69 70DepVariantInfo = provider ( 71doc = "A wrapper provider for a dependency of a crate. The dependency can be a Rust " + 72"dependency, in which case the `crate_info` and `dep_info` fields will be populated, " + 73"a Rust build script dependency, in which case `build_info` will be populated, or a " + 74"C/C++ dependency, in which case `cc_info` will be populated." , 75fields = { 76"build_info" : "BuildInfo: The BuildInfo of a Rust dependency" , 77"cc_info" : "CcInfo: The CcInfo of a C/C++ dependency" , 78"crate_info" : "CrateInfo: The CrateInfo of a Rust dependency" , 79"dep_info" : "DepInfo: The DepInfo of a Rust dependency" , 80}, 81) 82 83StdLibInfo = provider ( 84doc = ( 85"A collection of files either found within the `rust-stdlib` artifact or " + 86"generated based on existing files." 87), 88fields = { 89"alloc_files" : "List[File]: `.a` files related to the `alloc` module." , 90"between_alloc_and_core_files" : "List[File]: `.a` files related to the `compiler_builtins` module." , 91"between_core_and_std_files" : "List[File]: `.a` files related to all modules except `adler`, `alloc`, `compiler_builtins`, `core`, and `std`." , 92"core_files" : "List[File]: `.a` files related to the `core` and `adler` modules" , 93"dot_a_files" : "Depset[File]: Generated `.a` files" , 94"memchr_files" : "Depset[File]: `.a` files associated with the `memchr` module." , 95"self_contained_files" : "List[File]: All `.o` files from the `self-contained` directory." , 96"srcs" : "List[Target]: All targets from the original `srcs` attribute." , 97"std_files" : "Depset[File]: `.a` files associated with the `std` module." , 98"std_rlibs" : "List[File]: All `.rlib` files" , 99"test_files" : "Depset[File]: `.a` files associated with the `test` module." , 100}, 101) 102 103CaptureClippyOutputInfo = provider ( 104doc = "Value of the `capture_clippy_output` build setting" , 105fields = { "capture_output" : "Value of the `capture_clippy_output` build setting" }, 106) 107 108ClippyInfo = provider ( 109doc = "Provides information on a clippy run." , 110fields = { 111"output" : "File with the clippy output." , 112}, 113) 114 115TestCrateInfo = provider ( 116doc = "A wrapper around a CrateInfo. " + 117"Certain rule types, like rust_static_library and rust_shared_library " + 118"are not intended for consumption by other Rust targets, and should not " + 119"provide a CrateInfo. However, one should still be able to write a rust_test " + 120"for them. Thus, we create a CrateInfo, but do not advertise it as such, " + 121"but rather through this provider, that rust_test understands." , 122fields = { 123"crate" : "CrateInfo: The underlying CrateInfo of the dependency" , 124}, 125)