Skip to content

Commit e2f1ab9

Browse files
authored
Added providers to documentation (#911)
1 parent 176aff7 commit e2f1ab9

File tree

5 files changed

+205
-8
lines changed

5 files changed

+205
-8
lines changed

docs/BUILD.bazel

Lines changed: 15 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -48,13 +48,6 @@ PAGES = dict([
4848
"crate",
4949
],
5050
),
51-
page(
52-
name = "settings",
53-
symbols = [
54-
"incompatible_flag",
55-
"fail_when_enabled",
56-
],
57-
),
5851
page(
5952
name = "defs",
6053
symbols = [
@@ -68,6 +61,14 @@ PAGES = dict([
6861
"rust_test_suite",
6962
],
7063
),
64+
page(
65+
name = "providers",
66+
symbols = [
67+
"CrateInfo",
68+
"DepInfo",
69+
"StdLibInfo",
70+
],
71+
),
7172
page(
7273
name = "rust_analyzer",
7374
header_template = ":rust_analyzer.vm",
@@ -139,6 +140,13 @@ PAGES = dict([
139140
"rust_wasm_bindgen",
140141
],
141142
),
143+
page(
144+
name = "settings",
145+
symbols = [
146+
"incompatible_flag",
147+
"fail_when_enabled",
148+
],
149+
),
142150
])
143151

144152
# Generate headers for each page

docs/flatten.md

Lines changed: 85 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# Rust rules
22

3+
* [CrateInfo](#CrateInfo)
4+
* [DepInfo](#DepInfo)
5+
* [StdLibInfo](#StdLibInfo)
36
* [cargo_bootstrap_repository](#cargo_bootstrap_repository)
47
* [cargo_build_script](#cargo_build_script)
58
* [crate](#crate)
@@ -1391,6 +1394,88 @@ A test rule for performing `rustfmt --check` on a set of targets
13911394
| <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 | [] |
13921395

13931396

1397+
<a id="#CrateInfo"></a>
1398+
1399+
## CrateInfo
1400+
1401+
<pre>
1402+
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>,
1403+
<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>)
1404+
</pre>
1405+
1406+
A provider containing general Crate information.
1407+
1408+
**FIELDS**
1409+
1410+
1411+
| Name | Description |
1412+
| :------------- | :------------- |
1413+
| <a id="CrateInfo-aliases"></a>aliases | Dict[Label, String]: Renamed and aliased crates |
1414+
| <a id="CrateInfo-compile_data"></a>compile_data | depset[File]: Compile data required by this crate. |
1415+
| <a id="CrateInfo-deps"></a>deps | depset[Provider]: This crate's (rust or cc) dependencies' providers. |
1416+
| <a id="CrateInfo-edition"></a>edition | str: The edition of this crate. |
1417+
| <a id="CrateInfo-is_test"></a>is_test | bool: If the crate is being compiled in a test context |
1418+
| <a id="CrateInfo-name"></a>name | str: The name of this crate. |
1419+
| <a id="CrateInfo-output"></a>output | File: The output File that will be produced, depends on crate type. |
1420+
| <a id="CrateInfo-proc_macro_deps"></a>proc_macro_deps | depset[CrateInfo]: This crate's rust proc_macro dependencies' providers. |
1421+
| <a id="CrateInfo-root"></a>root | File: The source File entrypoint to this crate, eg. lib.rs |
1422+
| <a id="CrateInfo-rustc_env"></a>rustc_env | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
1423+
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
1424+
| <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)). |
1425+
| <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) |
1426+
1427+
1428+
<a id="#DepInfo"></a>
1429+
1430+
## DepInfo
1431+
1432+
<pre>
1433+
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>,
1434+
<a href="#DepInfo-transitive_noncrates">transitive_noncrates</a>)
1435+
</pre>
1436+
1437+
A provider containing information about a Crate's dependencies.
1438+
1439+
**FIELDS**
1440+
1441+
1442+
| Name | Description |
1443+
| :------------- | :------------- |
1444+
| <a id="DepInfo-dep_env"></a>dep_env | File: File with environment variables direct dependencies build scripts rely upon. |
1445+
| <a id="DepInfo-direct_crates"></a>direct_crates | depset[AliasableDepInfo] |
1446+
| <a id="DepInfo-transitive_build_infos"></a>transitive_build_infos | depset[BuildInfo] |
1447+
| <a id="DepInfo-transitive_crates"></a>transitive_crates | depset[CrateInfo] |
1448+
| <a id="DepInfo-transitive_libs"></a>transitive_libs | List[File]: All transitive dependencies, not filtered by type. |
1449+
| <a id="DepInfo-transitive_noncrates"></a>transitive_noncrates | depset[LinkerInput]: All transitive dependencies that aren't crates. |
1450+
1451+
1452+
<a id="#StdLibInfo"></a>
1453+
1454+
## StdLibInfo
1455+
1456+
<pre>
1457+
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>,
1458+
<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>)
1459+
</pre>
1460+
1461+
A collection of files either found within the `rust-stdlib` artifact or generated based on existing files.
1462+
1463+
**FIELDS**
1464+
1465+
1466+
| Name | Description |
1467+
| :------------- | :------------- |
1468+
| <a id="StdLibInfo-alloc_files"></a>alloc_files | List[File]: <code>.a</code> files related to the <code>alloc</code> module. |
1469+
| <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. |
1470+
| <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>. |
1471+
| <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 |
1472+
| <a id="StdLibInfo-dot_a_files"></a>dot_a_files | Depset[File]: Generated <code>.a</code> files |
1473+
| <a id="StdLibInfo-self_contained_files"></a>self_contained_files | List[File]: All <code>.o</code> files from the <code>self-contained</code> directory. |
1474+
| <a id="StdLibInfo-srcs"></a>srcs | List[Target]: The original <code>src</code> attribute. |
1475+
| <a id="StdLibInfo-std_files"></a>std_files | Depset[File]: <code>.a</code> files associated with the <code>std</code> module. |
1476+
| <a id="StdLibInfo-std_rlibs"></a>std_rlibs | List[File]: All <code>.rlib</code> files |
1477+
1478+
13941479
<a id="#cargo_build_script"></a>
13951480

13961481
## cargo_build_script

docs/providers.md

Lines changed: 89 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,89 @@
1+
<!-- Generated with Stardoc: http://skydoc.bazel.build -->
2+
# Providers
3+
4+
* [CrateInfo](#CrateInfo)
5+
* [DepInfo](#DepInfo)
6+
* [StdLibInfo](#StdLibInfo)
7+
8+
<a id="#CrateInfo"></a>
9+
10+
## CrateInfo
11+
12+
<pre>
13+
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>,
14+
<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>)
15+
</pre>
16+
17+
A provider containing general Crate information.
18+
19+
**FIELDS**
20+
21+
22+
| Name | Description |
23+
| :------------- | :------------- |
24+
| <a id="CrateInfo-aliases"></a>aliases | Dict[Label, String]: Renamed and aliased crates |
25+
| <a id="CrateInfo-compile_data"></a>compile_data | depset[File]: Compile data required by this crate. |
26+
| <a id="CrateInfo-deps"></a>deps | depset[Provider]: This crate's (rust or cc) dependencies' providers. |
27+
| <a id="CrateInfo-edition"></a>edition | str: The edition of this crate. |
28+
| <a id="CrateInfo-is_test"></a>is_test | bool: If the crate is being compiled in a test context |
29+
| <a id="CrateInfo-name"></a>name | str: The name of this crate. |
30+
| <a id="CrateInfo-output"></a>output | File: The output File that will be produced, depends on crate type. |
31+
| <a id="CrateInfo-proc_macro_deps"></a>proc_macro_deps | depset[CrateInfo]: This crate's rust proc_macro dependencies' providers. |
32+
| <a id="CrateInfo-root"></a>root | File: The source File entrypoint to this crate, eg. lib.rs |
33+
| <a id="CrateInfo-rustc_env"></a>rustc_env | Dict[String, String]: Additional <code>"key": "value"</code> environment variables to set for rustc. |
34+
| <a id="CrateInfo-srcs"></a>srcs | depset[File]: All source Files that are part of the crate. |
35+
| <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)). |
36+
| <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) |
37+
38+
39+
<a id="#DepInfo"></a>
40+
41+
## DepInfo
42+
43+
<pre>
44+
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>,
45+
<a href="#DepInfo-transitive_noncrates">transitive_noncrates</a>)
46+
</pre>
47+
48+
A provider containing information about a Crate's dependencies.
49+
50+
**FIELDS**
51+
52+
53+
| Name | Description |
54+
| :------------- | :------------- |
55+
| <a id="DepInfo-dep_env"></a>dep_env | File: File with environment variables direct dependencies build scripts rely upon. |
56+
| <a id="DepInfo-direct_crates"></a>direct_crates | depset[AliasableDepInfo] |
57+
| <a id="DepInfo-transitive_build_infos"></a>transitive_build_infos | depset[BuildInfo] |
58+
| <a id="DepInfo-transitive_crates"></a>transitive_crates | depset[CrateInfo] |
59+
| <a id="DepInfo-transitive_libs"></a>transitive_libs | List[File]: All transitive dependencies, not filtered by type. |
60+
| <a id="DepInfo-transitive_noncrates"></a>transitive_noncrates | depset[LinkerInput]: All transitive dependencies that aren't crates. |
61+
62+
63+
<a id="#StdLibInfo"></a>
64+
65+
## StdLibInfo
66+
67+
<pre>
68+
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>,
69+
<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>)
70+
</pre>
71+
72+
A collection of files either found within the `rust-stdlib` artifact or generated based on existing files.
73+
74+
**FIELDS**
75+
76+
77+
| Name | Description |
78+
| :------------- | :------------- |
79+
| <a id="StdLibInfo-alloc_files"></a>alloc_files | List[File]: <code>.a</code> files related to the <code>alloc</code> module. |
80+
| <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. |
81+
| <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>. |
82+
| <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 |
83+
| <a id="StdLibInfo-dot_a_files"></a>dot_a_files | Depset[File]: Generated <code>.a</code> files |
84+
| <a id="StdLibInfo-self_contained_files"></a>self_contained_files | List[File]: All <code>.o</code> files from the <code>self-contained</code> directory. |
85+
| <a id="StdLibInfo-srcs"></a>srcs | List[Target]: The original <code>src</code> attribute. |
86+
| <a id="StdLibInfo-std_files"></a>std_files | Depset[File]: <code>.a</code> files associated with the <code>std</code> module. |
87+
| <a id="StdLibInfo-std_rlibs"></a>std_rlibs | List[File]: All <code>.rlib</code> files |
88+
89+

docs/symbols.bzl

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,14 @@ load(
7070
_rust_stdlib_filegroup = "rust_stdlib_filegroup",
7171
_rust_toolchain = "rust_toolchain",
7272
)
73+
74+
# buildifier: disable=bzl-visibility
75+
load(
76+
"@rules_rust//rust/private:providers.bzl",
77+
_CrateInfo = "CrateInfo",
78+
_DepInfo = "DepInfo",
79+
_StdLibInfo = "StdLibInfo",
80+
)
7381
load(
7482
"@rules_rust//rust/settings:incompatible.bzl",
7583
_fail_when_enabled = "fail_when_enabled",
@@ -135,3 +143,7 @@ rustfmt_test = _rustfmt_test
135143

136144
incompatible_flag = _incompatible_flag
137145
fail_when_enabled = _fail_when_enabled
146+
147+
CrateInfo = _CrateInfo
148+
DepInfo = _DepInfo
149+
StdLibInfo = _StdLibInfo

rust/private/providers.bzl

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,10 @@ CrateInfo = provider(
2828
"root": "File: The source File entrypoint to this crate, eg. lib.rs",
2929
"rustc_env": "Dict[String, String]: Additional `\"key\": \"value\"` environment variables to set for rustc.",
3030
"srcs": "depset[File]: All source Files that are part of the crate.",
31-
"type": "str: The type of this crate. eg. lib or bin",
31+
"type": (
32+
"str: The type of this crate " +
33+
"(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))."
34+
),
3235
"wrapped_crate_type": (
3336
"str, optional: The original crate type for targets generated using a previously defined " +
3437
"crate (typically tests using the `rust_test::crate` attribute)"

0 commit comments

Comments
 (0)