-
Notifications
You must be signed in to change notification settings - Fork 4.1k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Make the fake implementation of repository_rule register the rule instead of blindly returning the implementation function. In this way, the documentation generated for repository rules contains the correct arguments. Fixes bazelbuild/skydoc#168 Change-Id: I4b4101a9a604282051eeaadafccdc9a987b14264 PiperOrigin-RevId: 239029265
- Loading branch information
1 parent
9303df6
commit 547aa48
Showing
8 changed files
with
138 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
39 changes: 39 additions & 0 deletions
39
src/test/java/com/google/devtools/build/skydoc/testdata/repo_rules_test/golden.txt
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
<a name="#my_repo"></a> | ||
## my_repo | ||
|
||
<pre> | ||
my_repo(<a href="#my_repo-name">name</a>, <a href="#my_repo-useless">useless</a>) | ||
</pre> | ||
|
||
Minimal example of a repository rule. | ||
|
||
### Attributes | ||
|
||
<table class="params-table"> | ||
<colgroup> | ||
<col class="col-param" /> | ||
<col class="col-description" /> | ||
</colgroup> | ||
<tbody> | ||
<tr id="my_repo-name"> | ||
<td><code>name</code></td> | ||
<td> | ||
<a href="https://bazel.build/docs/build-ref.html#name">Name</a>; required | ||
<p> | ||
A unique name for this repository. | ||
</p> | ||
</td> | ||
</tr> | ||
<tr id="my_repo-useless"> | ||
<td><code>useless</code></td> | ||
<td> | ||
String; optional | ||
<p> | ||
This argument will be ingored. You don't have to specify it, but you may. | ||
</p> | ||
</td> | ||
</tr> | ||
</tbody> | ||
</table> | ||
|
||
|
13 changes: 13 additions & 0 deletions
13
src/test/java/com/google/devtools/build/skydoc/testdata/repo_rules_test/input.bzl
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
def _repo_rule_impl(ctx): | ||
ctx.file("BUILD", "") | ||
|
||
my_repo = repository_rule( | ||
implementation = _repo_rule_impl, | ||
doc = "Minimal example of a repository rule.", | ||
attrs = { | ||
"useless" : attr.string( | ||
doc = "This argument will be ingored. You don't have to specify it, but you may.", | ||
default = "ignoreme", | ||
), | ||
}, | ||
) |