Skip to content

Commit 5156772

Browse files
committed
docs: update documentation
1 parent 29a7cd3 commit 5156772

File tree

3 files changed

+55
-10
lines changed

3 files changed

+55
-10
lines changed

CHANGELOG.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,12 +13,12 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
1313

1414
### Fix
1515

16-
- Remove dependency on `@bazel_tools//tools/build_defs/repo` to support Bazel 7.0.0 [#22](https://github.com/TendTo/rules_doxygen/issues/22)
16+
- Remove dependency on `@bazel_tools//tools/build_defs/repo` to support Bazel 7.0.0 [#22](https://github.com/TendTo/rules_doxygen/issues/22) (thanks to @filmil)
1717
- Remove unnecessary `get_auth`
1818

1919
### Changed
2020

21-
- Updated documentation and added example with the output substitution
21+
- Made documentation clearer
2222

2323
## [2.2.1]
2424

@@ -88,7 +88,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8888
### Added
8989

9090
- Support for system-wide doxygen installation. This allows the rule to run on mac os, but loses hermeticity. Can be enabled by using doxygen version `0.0.0`.
91-
- Testes for the new feature in the CI pipeline
91+
- Tests for the new feature in the CI pipeline
9292
- Local repository rule for doxygen
9393

9494
### Changed

docs/extensions_doc.md

Lines changed: 49 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,50 @@
22

33
Repository rule for downloading the correct version of doxygen using module extensions.
44

5+
<a id="get_default_canonical_id"></a>
6+
7+
## get_default_canonical_id
8+
9+
<pre>
10+
load("@rules_doxygen//:extensions.bzl", "get_default_canonical_id")
11+
12+
get_default_canonical_id(<a href="#get_default_canonical_id-repository_ctx">repository_ctx</a>, <a href="#get_default_canonical_id-urls">urls</a>)
13+
</pre>
14+
15+
Returns the default canonical id to use for downloads.
16+
17+
Copied from [@bazel_tools//tools/build_defs/repo:cache.bzl](https://github.com/bazelbuild/bazel/blob/dbb05116a07429ec3524bcf7252cedbb11269bea/tools/build_defs/repo/cache.bzl)
18+
to avoid a dependency on the whole `@bazel_tools` package, since its visibility changed from private to public between Bazel 7.0.0 and 8.0.0.
19+
20+
Returns `""` (empty string) when Bazel is run with
21+
`--repo_env=BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID=0`.
22+
23+
e.g.
24+
```python
25+
load("@bazel_tools//tools/build_defs/repo:cache.bzl", "get_default_canonical_id")
26+
# ...
27+
repository_ctx.download_and_extract(
28+
url = urls,
29+
integrity = integrity
30+
canonical_id = get_default_canonical_id(repository_ctx, urls),
31+
),
32+
```
33+
34+
35+
**PARAMETERS**
36+
37+
38+
| Name | Description | Default Value |
39+
| :------------- | :------------- | :------------- |
40+
| <a id="get_default_canonical_id-repository_ctx"></a>repository_ctx | The repository context of the repository rule calling this utility function. | none |
41+
| <a id="get_default_canonical_id-urls"></a>urls | A list of URLs matching what is passed to `repository_ctx.download` and `repository_ctx.download_and_extract`. | none |
42+
43+
**RETURNS**
44+
45+
The canonical ID to use for the download, or an empty string if
46+
`BAZEL_HTTP_RULES_URLS_AS_DEFAULT_CANONICAL_ID` is set to `0`.
47+
48+
549
<a id="doxygen_repository"></a>
650

751
## doxygen_repository
@@ -75,7 +119,7 @@ doxygen_repository(
75119
<pre>
76120
doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension")
77121
doxygen_extension.configuration(<a href="#doxygen_extension.configuration-executable">executable</a>, <a href="#doxygen_extension.configuration-platform">platform</a>, <a href="#doxygen_extension.configuration-sha256">sha256</a>, <a href="#doxygen_extension.configuration-version">version</a>)
78-
doxygen_extension.repository()
122+
doxygen_extension.repository(<a href="#doxygen_extension.repository-name">name</a>)
79123
</pre>
80124

81125
Module extension for declaring the doxygen configurations to use.
@@ -84,7 +128,7 @@ The resulting repository will have the following targets:
84128
- `@doxygen//:doxygen.bzl`, containing the doxygen macro used to generate the documentation.
85129
- `@doxygen//:Doxyfile.template`, default Doxyfile template used to generate the Doxyfile.
86130

87-
The extension will create a default configuration for all platforms with the version `1.12.0` of Doxygen.
131+
The extension will create a default configuration for all platforms with the version `1.13.2` of Doxygen.
88132
You can override this value with a custom one for each supported platform, i.e. _windows_, _mac_, _mac-arm_, _linux_ and _linux-arm_.
89133

90134
```bzl
@@ -230,8 +274,8 @@ use_repo(doxygen_extension, "doxygen")
230274

231275
| Name | Description | Type | Mandatory | Default |
232276
| :------------- | :------------- | :------------- | :------------- | :------------- |
233-
| <a id="doxygen_extension.configuration-executable"></a>executable | The doxygen executable to use. If set, no download will take place and the provided doxygen executable will be used. Mutually exclusive with `version`. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
234-
| <a id="doxygen_extension.configuration-platform"></a>platform | The target platform for the doxygen binary. Available options are (windows, mac, mac-arm, linux, linux-arm). If not specified, it will select the platform it is currently running on. | String | optional | `""` |
277+
| <a id="doxygen_extension.configuration-executable"></a>executable | Target pointing to the doxygen executable to use. If set, no download will take place and the provided doxygen executable will be used. Mutually exclusive with `version`. | <a href="https://bazel.build/concepts/labels">Label</a> | optional | `None` |
278+
| <a id="doxygen_extension.configuration-platform"></a>platform | The platform this configuration applies to. Available options are (windows, mac, mac-arm, linux, linux-arm). If not specified, the configuration will apply to the platform it is currently running on. | String | optional | `""` |
235279
| <a id="doxygen_extension.configuration-sha256"></a>sha256 | The sha256 hash of the doxygen archive. If not specified, an all-zero hash will be used. | String | optional | `""` |
236280
| <a id="doxygen_extension.configuration-version"></a>version | The version of doxygen to use. If set to `0.0.0`, the doxygen executable will be assumed to be available from the PATH. Mutually exclusive with `executable`. | String | optional | `""` |
237281

@@ -243,5 +287,6 @@ use_repo(doxygen_extension, "doxygen")
243287

244288
| Name | Description | Type | Mandatory | Default |
245289
| :------------- | :------------- | :------------- | :------------- | :------------- |
290+
| <a id="doxygen_extension.repository-name"></a>name | The name of the repository the extension will create. Useful if you don't use 'rules_doxygen' as a dev_dependency, since it will avoid name collision for module depending on yours. Can only be specified once. Defaults to 'doxygen'. | <a href="https://bazel.build/concepts/labels#target-names">Name</a> | required | |
246291

247292

extensions.bzl

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -320,11 +320,11 @@ def _doxygen_extension_impl(ctx):
320320
_doxygen_configuration_tag = tag_class(attrs = {
321321
"version": attr.string(doc = "The version of doxygen to use. If set to `0.0.0`, the doxygen executable will be assumed to be available from the PATH. Mutually exclusive with `executable`."),
322322
"sha256": attr.string(doc = "The sha256 hash of the doxygen archive. If not specified, an all-zero hash will be used."),
323-
"platform": attr.string(doc = "The target platform for the doxygen binary. Available options are (windows, mac, mac-arm, linux, linux-arm). If not specified, it will select the platform it is currently running on."),
324-
"executable": attr.label(doc = "The doxygen executable to use. If set, no download will take place and the provided doxygen executable will be used. Mutually exclusive with `version`."),
323+
"platform": attr.string(doc = "The platform this configuration applies to. Available options are (windows, mac, mac-arm, linux, linux-arm). If not specified, the configuration will apply to the platform it is currently running on."),
324+
"executable": attr.label(doc = "Target pointing to the doxygen executable to use. If set, no download will take place and the provided doxygen executable will be used. Mutually exclusive with `version`."),
325325
})
326326
_doxygen_repository_tag = tag_class(attrs = {
327-
"name": attr.string(doc = "The name of the repository the extension will create. Useful if you don't use 'rules_doxygen' as a dev_dependency, since it will avoid name collision for module depending on yours. Must be the same for all configurations. Defaults to 'doxygen'.", mandatory = True),
327+
"name": attr.string(doc = "The name of the repository the extension will create. Useful if you don't use 'rules_doxygen' as a dev_dependency, since it will avoid name collision for module depending on yours. Can only be specified once. Defaults to 'doxygen'.", mandatory = True),
328328
})
329329

330330
doxygen_extension = module_extension(

0 commit comments

Comments
 (0)