Skip to content

Commit 4f7bd8a

Browse files
authored
Removed deprecated dep attribute from rustdoc rules (#1086)
1 parent b74f130 commit 4f7bd8a

File tree

4 files changed

+12
-38
lines changed

4 files changed

+12
-38
lines changed

docs/flatten.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -447,7 +447,7 @@ rust_clippy(
447447
## rust_doc
448448

449449
<pre>
450-
rust_doc(<a href="#rust_doc-name">name</a>, <a href="#rust_doc-crate">crate</a>, <a href="#rust_doc-dep">dep</a>, <a href="#rust_doc-html_after_content">html_after_content</a>, <a href="#rust_doc-html_before_content">html_before_content</a>, <a href="#rust_doc-html_in_header">html_in_header</a>, <a href="#rust_doc-markdown_css">markdown_css</a>)
450+
rust_doc(<a href="#rust_doc-name">name</a>, <a href="#rust_doc-crate">crate</a>, <a href="#rust_doc-html_after_content">html_after_content</a>, <a href="#rust_doc-html_before_content">html_before_content</a>, <a href="#rust_doc-html_in_header">html_in_header</a>, <a href="#rust_doc-markdown_css">markdown_css</a>)
451451
</pre>
452452

453453
Generates code documentation.
@@ -493,8 +493,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing
493493
| Name | Description | Type | Mandatory | Default |
494494
| :------------- | :------------- | :------------- | :------------- | :------------- |
495495
| <a id="rust_doc-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
496-
| <a id="rust_doc-crate"></a>crate | The label of the target to generate code documentation for.<br><br><code>rust_doc</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
497-
| <a id="rust_doc-dep"></a>dep | __deprecated__: use <code>crate</code> | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
496+
| <a id="rust_doc-crate"></a>crate | The label of the target to generate code documentation for.<br><br><code>rust_doc</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
498497
| <a id="rust_doc-html_after_content"></a>html_after_content | File to add in <code>&lt;body&gt;</code>, after content. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
499498
| <a id="rust_doc-html_before_content"></a>html_before_content | File to add in <code>&lt;body&gt;</code>, before content. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
500499
| <a id="rust_doc-html_in_header"></a>html_in_header | File to add to <code>&lt;head&gt;</code>. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
@@ -506,7 +505,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing
506505
## rust_doc_test
507506

508507
<pre>
509-
rust_doc_test(<a href="#rust_doc_test-name">name</a>, <a href="#rust_doc_test-crate">crate</a>, <a href="#rust_doc_test-dep">dep</a>)
508+
rust_doc_test(<a href="#rust_doc_test-name">name</a>, <a href="#rust_doc_test-crate">crate</a>)
510509
</pre>
511510

512511
Runs Rust documentation tests.
@@ -553,8 +552,7 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t
553552
| Name | Description | Type | Mandatory | Default |
554553
| :------------- | :------------- | :------------- | :------------- | :------------- |
555554
| <a id="rust_doc_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
556-
| <a id="rust_doc_test-crate"></a>crate | The label of the target to generate code documentation for. <code>rust_doc_test</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
557-
| <a id="rust_doc_test-dep"></a>dep | __deprecated__: use <code>crate</code> | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
555+
| <a id="rust_doc_test-crate"></a>crate | The label of the target to generate code documentation for. <code>rust_doc_test</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
558556

559557

560558
<a id="#rust_grpc_library"></a>

docs/rust_doc.md

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@
99
## rust_doc
1010

1111
<pre>
12-
rust_doc(<a href="#rust_doc-name">name</a>, <a href="#rust_doc-crate">crate</a>, <a href="#rust_doc-dep">dep</a>, <a href="#rust_doc-html_after_content">html_after_content</a>, <a href="#rust_doc-html_before_content">html_before_content</a>, <a href="#rust_doc-html_in_header">html_in_header</a>, <a href="#rust_doc-markdown_css">markdown_css</a>)
12+
rust_doc(<a href="#rust_doc-name">name</a>, <a href="#rust_doc-crate">crate</a>, <a href="#rust_doc-html_after_content">html_after_content</a>, <a href="#rust_doc-html_before_content">html_before_content</a>, <a href="#rust_doc-html_in_header">html_in_header</a>, <a href="#rust_doc-markdown_css">markdown_css</a>)
1313
</pre>
1414

1515
Generates code documentation.
@@ -55,8 +55,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing
5555
| Name | Description | Type | Mandatory | Default |
5656
| :------------- | :------------- | :------------- | :------------- | :------------- |
5757
| <a id="rust_doc-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
58-
| <a id="rust_doc-crate"></a>crate | The label of the target to generate code documentation for.<br><br><code>rust_doc</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
59-
| <a id="rust_doc-dep"></a>dep | __deprecated__: use <code>crate</code> | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
58+
| <a id="rust_doc-crate"></a>crate | The label of the target to generate code documentation for.<br><br><code>rust_doc</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
6059
| <a id="rust_doc-html_after_content"></a>html_after_content | File to add in <code>&lt;body&gt;</code>, after content. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
6160
| <a id="rust_doc-html_before_content"></a>html_before_content | File to add in <code>&lt;body&gt;</code>, before content. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
6261
| <a id="rust_doc-html_in_header"></a>html_in_header | File to add to <code>&lt;head&gt;</code>. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
@@ -68,7 +67,7 @@ Running `bazel build //hello_lib:hello_lib_doc` will build a zip file containing
6867
## rust_doc_test
6968

7069
<pre>
71-
rust_doc_test(<a href="#rust_doc_test-name">name</a>, <a href="#rust_doc_test-crate">crate</a>, <a href="#rust_doc_test-dep">dep</a>)
70+
rust_doc_test(<a href="#rust_doc_test-name">name</a>, <a href="#rust_doc_test-crate">crate</a>)
7271
</pre>
7372

7473
Runs Rust documentation tests.
@@ -115,7 +114,6 @@ Running `bazel test //hello_lib:hello_lib_doc_test` will run all documentation t
115114
| Name | Description | Type | Mandatory | Default |
116115
| :------------- | :------------- | :------------- | :------------- | :------------- |
117116
| <a id="rust_doc_test-name"></a>name | A unique name for this target. | <a href="https://bazel.build/docs/build-ref.html#name">Name</a> | required | |
118-
| <a id="rust_doc_test-crate"></a>crate | The label of the target to generate code documentation for. <code>rust_doc_test</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
119-
| <a id="rust_doc_test-dep"></a>dep | __deprecated__: use <code>crate</code> | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | optional | None |
117+
| <a id="rust_doc_test-crate"></a>crate | The label of the target to generate code documentation for. <code>rust_doc_test</code> can generate HTML code documentation for the source files of <code>rust_library</code> or <code>rust_binary</code> targets. | <a href="https://bazel.build/docs/build-ref.html#labels">Label</a> | required | |
120118

121119

rust/private/rustdoc.bzl

Lines changed: 2 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -158,15 +158,7 @@ def _rust_doc_impl(ctx):
158158
ctx (ctx): The rule's context object
159159
"""
160160

161-
if ctx.attr.crate and ctx.attr.dep:
162-
fail("{} should only use the `crate` attribute. `dep` is deprecated".format(
163-
ctx.label,
164-
))
165-
166-
crate = ctx.attr.crate or ctx.attr.dep
167-
if not crate:
168-
fail("{} is missing the `crate` attribute".format(ctx.label))
169-
161+
crate = ctx.attr.crate
170162
crate_info = crate[rust_common.crate_info]
171163
dep_info = crate[rust_common.dep_info]
172164

@@ -260,11 +252,7 @@ rust_doc = rule(
260252
"`rust_library` or `rust_binary` targets."
261253
),
262254
providers = [rust_common.crate_info],
263-
# TODO: Make this attribute mandatory once `dep` is removed
264-
),
265-
"dep": attr.label(
266-
doc = "__deprecated__: use `crate`",
267-
providers = [rust_common.crate_info],
255+
mandatory = True,
268256
),
269257
"html_after_content": attr.label(
270258
doc = "File to add in `<body>`, after content.",

rust/private/rustdoc_test.bzl

Lines changed: 2 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -94,16 +94,10 @@ def _rust_doc_test_impl(ctx):
9494
Returns:
9595
list: A list containing a DefaultInfo provider
9696
"""
97-
if ctx.attr.crate and ctx.attr.dep:
98-
fail("{} should only use the `crate` attribute. `dep` is deprecated".format(
99-
ctx.label,
100-
))
10197

10298
toolchain = find_toolchain(ctx)
10399

104-
crate = ctx.attr.crate or ctx.attr.dep
105-
if not crate:
106-
fail("{} is missing the `crate` attribute".format(ctx.label))
100+
crate = ctx.attr.crate
107101
crate_info = crate[rust_common.crate_info]
108102

109103
if toolchain.os == "windows":
@@ -165,11 +159,7 @@ rust_doc_test = rule(
165159
"source files of `rust_library` or `rust_binary` targets."
166160
),
167161
providers = [rust_common.crate_info],
168-
# TODO: Make this attribute mandatory once `dep` is removed
169-
),
170-
"dep": attr.label(
171-
doc = "__deprecated__: use `crate`",
172-
providers = [rust_common.crate_info],
162+
mandatory = True,
173163
),
174164
"_cc_toolchain": attr.label(
175165
doc = (

0 commit comments

Comments
 (0)