Skip to content

Commit

Permalink
Added providers to documentation (#911)
Browse files Browse the repository at this point in the history
  • Loading branch information
UebelAndre authored Aug 27, 2021
1 parent 176aff7 commit e2f1ab9
Show file tree
Hide file tree
Showing 5 changed files with 205 additions and 8 deletions.
22 changes: 15 additions & 7 deletions docs/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,6 @@ PAGES = dict([
"crate",
],
),
page(
name = "settings",
symbols = [
"incompatible_flag",
"fail_when_enabled",
],
),
page(
name = "defs",
symbols = [
Expand All @@ -68,6 +61,14 @@ PAGES = dict([
"rust_test_suite",
],
),
page(
name = "providers",
symbols = [
"CrateInfo",
"DepInfo",
"StdLibInfo",
],
),
page(
name = "rust_analyzer",
header_template = ":rust_analyzer.vm",
Expand Down Expand Up @@ -139,6 +140,13 @@ PAGES = dict([
"rust_wasm_bindgen",
],
),
page(
name = "settings",
symbols = [
"incompatible_flag",
"fail_when_enabled",
],
),
])

# Generate headers for each page
Expand Down
85 changes: 85 additions & 0 deletions docs/flatten.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,8 @@
# Rust rules

* [CrateInfo](#CrateInfo)
* [DepInfo](#DepInfo)
* [StdLibInfo](#StdLibInfo)
* [cargo_bootstrap_repository](#cargo_bootstrap_repository)
* [cargo_build_script](#cargo_build_script)
* [crate](#crate)
Expand Down Expand Up @@ -1391,6 +1394,88 @@ A test rule for performing `rustfmt --check` on a set of targets
| <a id="rustfmt_test-targets"></a>targets | Rust targets to run <code>rustfmt --check</code> on. | <a href="https://bazel.build/docs/build-ref.html#labels">List of labels</a> | optional | [] |


<a id="#CrateInfo"></a>

## CrateInfo

<pre>
CrateInfo(<a href="#CrateInfo-aliases">aliases</a>, <a href="#CrateInfo-compile_data">compile_data</a>, <a href="#CrateInfo-deps">deps</a>, <a href="#CrateInfo-edition">edition</a>, <a href="#CrateInfo-is_test">is_test</a>, <a href="#CrateInfo-name">name</a>, <a href="#CrateInfo-output">output</a>, <a href="#CrateInfo-proc_macro_deps">proc_macro_deps</a>, <a href="#CrateInfo-root">root</a>,
<a href="#CrateInfo-rustc_env">rustc_env</a>, <a href="#CrateInfo-srcs">srcs</a>, <a href="#CrateInfo-type">type</a>, <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>)
</pre>

A provider containing general Crate information.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="CrateInfo-aliases"></a>aliases | Dict[Label, String]: Renamed and aliased crates |
| <a id="CrateInfo-compile_data"></a>compile_data | depset[File]: Compile data required by this crate. |
| <a id="CrateInfo-deps"></a>deps | depset[Provider]: This crate's (rust or cc) dependencies' providers. |
| <a id="CrateInfo-edition"></a>edition | str: The edition of this crate. |
| <a id="CrateInfo-is_test"></a>is_test | bool: If the crate is being compiled in a test context |
| <a id="CrateInfo-name"></a>name | str: The name of this crate. |
| <a id="CrateInfo-output"></a>output | File: The output File that will be produced, depends on crate type. |
| <a id="CrateInfo-proc_macro_deps"></a>proc_macro_deps | depset[CrateInfo]: This crate's rust proc_macro dependencies' providers. |
| <a id="CrateInfo-root"></a>root | File: The source File entrypoint to this crate, eg. lib.rs |
| <a id="CrateInfo-rustc_env"></a>rustc_env | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
| <a id="CrateInfo-type"></a>type | str: The type of this crate (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)). |
| <a id="CrateInfo-wrapped_crate_type"></a>wrapped_crate_type | str, optional: The original crate type for targets generated using a previously defined crate (typically tests using the <code>rust_test::crate</code> attribute) |


<a id="#DepInfo"></a>

## DepInfo

<pre>
DepInfo(<a href="#DepInfo-dep_env">dep_env</a>, <a href="#DepInfo-direct_crates">direct_crates</a>, <a href="#DepInfo-transitive_build_infos">transitive_build_infos</a>, <a href="#DepInfo-transitive_crates">transitive_crates</a>, <a href="#DepInfo-transitive_libs">transitive_libs</a>,
<a href="#DepInfo-transitive_noncrates">transitive_noncrates</a>)
</pre>

A provider containing information about a Crate's dependencies.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="DepInfo-dep_env"></a>dep_env | File: File with environment variables direct dependencies build scripts rely upon. |
| <a id="DepInfo-direct_crates"></a>direct_crates | depset[AliasableDepInfo] |
| <a id="DepInfo-transitive_build_infos"></a>transitive_build_infos | depset[BuildInfo] |
| <a id="DepInfo-transitive_crates"></a>transitive_crates | depset[CrateInfo] |
| <a id="DepInfo-transitive_libs"></a>transitive_libs | List[File]: All transitive dependencies, not filtered by type. |
| <a id="DepInfo-transitive_noncrates"></a>transitive_noncrates | depset[LinkerInput]: All transitive dependencies that aren't crates. |


<a id="#StdLibInfo"></a>

## StdLibInfo

<pre>
StdLibInfo(<a href="#StdLibInfo-alloc_files">alloc_files</a>, <a href="#StdLibInfo-between_alloc_and_core_files">between_alloc_and_core_files</a>, <a href="#StdLibInfo-between_core_and_std_files">between_core_and_std_files</a>, <a href="#StdLibInfo-core_files">core_files</a>,
<a href="#StdLibInfo-dot_a_files">dot_a_files</a>, <a href="#StdLibInfo-self_contained_files">self_contained_files</a>, <a href="#StdLibInfo-srcs">srcs</a>, <a href="#StdLibInfo-std_files">std_files</a>, <a href="#StdLibInfo-std_rlibs">std_rlibs</a>)
</pre>

A collection of files either found within the `rust-stdlib` artifact or generated based on existing files.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="StdLibInfo-alloc_files"></a>alloc_files | List[File]: <code>.a</code> files related to the <code>alloc</code> module. |
| <a id="StdLibInfo-between_alloc_and_core_files"></a>between_alloc_and_core_files | List[File]: <code>.a</code> files related to the <code>compiler_builtins</code> module. |
| <a id="StdLibInfo-between_core_and_std_files"></a>between_core_and_std_files | List[File]: <code>.a</code> files related to all modules except <code>adler</code>, <code>alloc</code>, <code>compiler_builtins</code>, <code>core</code>, and <code>std</code>. |
| <a id="StdLibInfo-core_files"></a>core_files | List[File]: <code>.a</code> files related to the <code>core</code> and <code>adler</code> modules |
| <a id="StdLibInfo-dot_a_files"></a>dot_a_files | Depset[File]: Generated <code>.a</code> files |
| <a id="StdLibInfo-self_contained_files"></a>self_contained_files | List[File]: All <code>.o</code> files from the <code>self-contained</code> directory. |
| <a id="StdLibInfo-srcs"></a>srcs | List[Target]: The original <code>src</code> attribute. |
| <a id="StdLibInfo-std_files"></a>std_files | Depset[File]: <code>.a</code> files associated with the <code>std</code> module. |
| <a id="StdLibInfo-std_rlibs"></a>std_rlibs | List[File]: All <code>.rlib</code> files |


<a id="#cargo_build_script"></a>

## cargo_build_script
Expand Down
89 changes: 89 additions & 0 deletions docs/providers.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,89 @@
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
# Providers

* [CrateInfo](#CrateInfo)
* [DepInfo](#DepInfo)
* [StdLibInfo](#StdLibInfo)

<a id="#CrateInfo"></a>

## CrateInfo

<pre>
CrateInfo(<a href="#CrateInfo-aliases">aliases</a>, <a href="#CrateInfo-compile_data">compile_data</a>, <a href="#CrateInfo-deps">deps</a>, <a href="#CrateInfo-edition">edition</a>, <a href="#CrateInfo-is_test">is_test</a>, <a href="#CrateInfo-name">name</a>, <a href="#CrateInfo-output">output</a>, <a href="#CrateInfo-proc_macro_deps">proc_macro_deps</a>, <a href="#CrateInfo-root">root</a>,
<a href="#CrateInfo-rustc_env">rustc_env</a>, <a href="#CrateInfo-srcs">srcs</a>, <a href="#CrateInfo-type">type</a>, <a href="#CrateInfo-wrapped_crate_type">wrapped_crate_type</a>)
</pre>

A provider containing general Crate information.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="CrateInfo-aliases"></a>aliases | Dict[Label, String]: Renamed and aliased crates |
| <a id="CrateInfo-compile_data"></a>compile_data | depset[File]: Compile data required by this crate. |
| <a id="CrateInfo-deps"></a>deps | depset[Provider]: This crate's (rust or cc) dependencies' providers. |
| <a id="CrateInfo-edition"></a>edition | str: The edition of this crate. |
| <a id="CrateInfo-is_test"></a>is_test | bool: If the crate is being compiled in a test context |
| <a id="CrateInfo-name"></a>name | str: The name of this crate. |
| <a id="CrateInfo-output"></a>output | File: The output File that will be produced, depends on crate type. |
| <a id="CrateInfo-proc_macro_deps"></a>proc_macro_deps | depset[CrateInfo]: This crate's rust proc_macro dependencies' providers. |
| <a id="CrateInfo-root"></a>root | File: The source File entrypoint to this crate, eg. lib.rs |
| <a id="CrateInfo-rustc_env"></a>rustc_env | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
| <a id="CrateInfo-type"></a>type | str: The type of this crate (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)). |
| <a id="CrateInfo-wrapped_crate_type"></a>wrapped_crate_type | str, optional: The original crate type for targets generated using a previously defined crate (typically tests using the <code>rust_test::crate</code> attribute) |


<a id="#DepInfo"></a>

## DepInfo

<pre>
DepInfo(<a href="#DepInfo-dep_env">dep_env</a>, <a href="#DepInfo-direct_crates">direct_crates</a>, <a href="#DepInfo-transitive_build_infos">transitive_build_infos</a>, <a href="#DepInfo-transitive_crates">transitive_crates</a>, <a href="#DepInfo-transitive_libs">transitive_libs</a>,
<a href="#DepInfo-transitive_noncrates">transitive_noncrates</a>)
</pre>

A provider containing information about a Crate's dependencies.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="DepInfo-dep_env"></a>dep_env | File: File with environment variables direct dependencies build scripts rely upon. |
| <a id="DepInfo-direct_crates"></a>direct_crates | depset[AliasableDepInfo] |
| <a id="DepInfo-transitive_build_infos"></a>transitive_build_infos | depset[BuildInfo] |
| <a id="DepInfo-transitive_crates"></a>transitive_crates | depset[CrateInfo] |
| <a id="DepInfo-transitive_libs"></a>transitive_libs | List[File]: All transitive dependencies, not filtered by type. |
| <a id="DepInfo-transitive_noncrates"></a>transitive_noncrates | depset[LinkerInput]: All transitive dependencies that aren't crates. |


<a id="#StdLibInfo"></a>

## StdLibInfo

<pre>
StdLibInfo(<a href="#StdLibInfo-alloc_files">alloc_files</a>, <a href="#StdLibInfo-between_alloc_and_core_files">between_alloc_and_core_files</a>, <a href="#StdLibInfo-between_core_and_std_files">between_core_and_std_files</a>, <a href="#StdLibInfo-core_files">core_files</a>,
<a href="#StdLibInfo-dot_a_files">dot_a_files</a>, <a href="#StdLibInfo-self_contained_files">self_contained_files</a>, <a href="#StdLibInfo-srcs">srcs</a>, <a href="#StdLibInfo-std_files">std_files</a>, <a href="#StdLibInfo-std_rlibs">std_rlibs</a>)
</pre>

A collection of files either found within the `rust-stdlib` artifact or generated based on existing files.

**FIELDS**


| Name | Description |
| :------------- | :------------- |
| <a id="StdLibInfo-alloc_files"></a>alloc_files | List[File]: <code>.a</code> files related to the <code>alloc</code> module. |
| <a id="StdLibInfo-between_alloc_and_core_files"></a>between_alloc_and_core_files | List[File]: <code>.a</code> files related to the <code>compiler_builtins</code> module. |
| <a id="StdLibInfo-between_core_and_std_files"></a>between_core_and_std_files | List[File]: <code>.a</code> files related to all modules except <code>adler</code>, <code>alloc</code>, <code>compiler_builtins</code>, <code>core</code>, and <code>std</code>. |
| <a id="StdLibInfo-core_files"></a>core_files | List[File]: <code>.a</code> files related to the <code>core</code> and <code>adler</code> modules |
| <a id="StdLibInfo-dot_a_files"></a>dot_a_files | Depset[File]: Generated <code>.a</code> files |
| <a id="StdLibInfo-self_contained_files"></a>self_contained_files | List[File]: All <code>.o</code> files from the <code>self-contained</code> directory. |
| <a id="StdLibInfo-srcs"></a>srcs | List[Target]: The original <code>src</code> attribute. |
| <a id="StdLibInfo-std_files"></a>std_files | Depset[File]: <code>.a</code> files associated with the <code>std</code> module. |
| <a id="StdLibInfo-std_rlibs"></a>std_rlibs | List[File]: All <code>.rlib</code> files |


12 changes: 12 additions & 0 deletions docs/symbols.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -70,6 +70,14 @@ load(
_rust_stdlib_filegroup = "rust_stdlib_filegroup",
_rust_toolchain = "rust_toolchain",
)

# buildifier: disable=bzl-visibility
load(
"@rules_rust//rust/private:providers.bzl",
_CrateInfo = "CrateInfo",
_DepInfo = "DepInfo",
_StdLibInfo = "StdLibInfo",
)
load(
"@rules_rust//rust/settings:incompatible.bzl",
_fail_when_enabled = "fail_when_enabled",
Expand Down Expand Up @@ -135,3 +143,7 @@ rustfmt_test = _rustfmt_test

incompatible_flag = _incompatible_flag
fail_when_enabled = _fail_when_enabled

CrateInfo = _CrateInfo
DepInfo = _DepInfo
StdLibInfo = _StdLibInfo
5 changes: 4 additions & 1 deletion rust/private/providers.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,10 @@ CrateInfo = provider(
"root": "File: The source File entrypoint to this crate, eg. lib.rs",
"rustc_env": "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc.",
"srcs": "depset[File]: All source Files that are part of the crate.",
"type": "str: The type of this crate. eg. lib or bin",
"type": (
"str: The type of this crate " +
"(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))."
),
"wrapped_crate_type": (
"str, optional: The original crate type for targets generated using a previously defined " +
"crate (typically tests using the `rust_test::crate` attribute)"
Expand Down

0 comments on commit e2f1ab9

Please sign in to comment.