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