Skip to content

Commit 4b3b411

Browse files
authored
Merge pull request #9 from TendTo/feat/support-arm-binaries
feat: support arm platforms and custom binaries
2 parents d029a88 + f45c72b commit 4b3b411

File tree

8 files changed

+358
-126
lines changed

8 files changed

+358
-126
lines changed

.github/workflows/ci.yml

Lines changed: 91 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,9 @@ jobs:
2424
with:
2525
files: "examples/bazel-bin/${{ matrix.subdir }}/html/index.html"
2626
fail: true
27+
- name: Check doxygen version in produced index.html
28+
run: grep 'Doxygen 1.12.0' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
29+
shell: bash
2730

2831
tests-system-installation:
2932
strategy:
@@ -36,11 +39,13 @@ jobs:
3639
- uses: actions/checkout@v4
3740
- name: Install doxygen
3841
uses: ssciwr/doxygen-install@v1
42+
with:
43+
version: "1.9.7"
3944
- name: Enable use of system doxygen by decommenting the module extension line
4045
uses: richardrigutins/replace-in-files@v2
4146
with:
42-
search-text: '# doxygen_extension.version(version = "0.0.0")'
43-
replacement-text: doxygen_extension.version(version = "0.0.0")
47+
search-text: '# doxygen_extension.configuration(version = "0.0.0")'
48+
replacement-text: doxygen_extension.configuration(version = "0.0.0")
4449
files: examples/MODULE.bazel
4550
- name: Build ${{ matrix.subdir }}
4651
run: bazel build //${{ matrix.subdir }}:doxygen
@@ -50,12 +55,15 @@ jobs:
5055
with:
5156
files: "examples/bazel-bin/${{ matrix.subdir }}/html/index.html"
5257
fail: true
58+
- name: Check doxygen version in produced index.html
59+
run: grep 'Doxygen 1.9.7' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
60+
shell: bash
5361

5462
tests-multiple-installations:
5563
strategy:
5664
matrix:
5765
os: [ubuntu-latest, windows-latest, macos-latest]
58-
subdir: [base, kwargs, doxyfile, latex, nested, custom, awesome]
66+
subdir: [base]
5967
runs-on: ${{ matrix.os }}
6068
steps:
6169
- uses: actions/checkout@v4
@@ -64,21 +72,92 @@ jobs:
6472
- name: Enable use of windows doxygen by decommenting the module extension line
6573
uses: richardrigutins/replace-in-files@v2
6674
with:
67-
search-text: '# doxygen_extension.version(version = "1.11.0", sha256 = "478fc9897d00ca181835d248a4d3e5c83c26a32d1c7571f4321ddb0f2e97459f", platform = "windows")'
68-
replacement-text: doxygen_extension.version(version = "1.11.0", sha256 = "478fc9897d00ca181835d248a4d3e5c83c26a32d1c7571f4321ddb0f2e97459f", platform = "windows")
75+
search-text: '# doxygen_extension.configuration(version = "1.11.0", sha256 = "478fc9897d00ca181835d248a4d3e5c83c26a32d1c7571f4321ddb0f2e97459f", platform = "windows")'
76+
replacement-text: doxygen_extension.configuration(version = "1.11.0", sha256 = "478fc9897d00ca181835d248a4d3e5c83c26a32d1c7571f4321ddb0f2e97459f", platform = "windows")
6977
files: examples/MODULE.bazel
7078
- name: Enable use of mac doxygen by decommenting the module extension line
7179
uses: richardrigutins/replace-in-files@v2
7280
with:
73-
search-text: '# doxygen_extension.version(version = "1.12.0", sha256 = "6ace7dde967d41f4e293d034a67eb2c7edd61318491ee3131112173a77344001", platform = "mac")'
74-
replacement-text: doxygen_extension.version(version = "1.12.0", sha256 = "6ace7dde967d41f4e293d034a67eb2c7edd61318491ee3131112173a77344001", platform = "mac")
81+
search-text: '# doxygen_extension.configuration(version = "1.12.0", sha256 = "6ace7dde967d41f4e293d034a67eb2c7edd61318491ee3131112173a77344001", platform = "mac")'
82+
replacement-text: doxygen_extension.configuration(version = "1.12.0", sha256 = "6ace7dde967d41f4e293d034a67eb2c7edd61318491ee3131112173a77344001", platform = "mac")
7583
files: examples/MODULE.bazel
7684
- name: Enable use linux doxygen by decommenting the module extension line
7785
uses: richardrigutins/replace-in-files@v2
7886
with:
79-
search-text: '# doxygen_extension.version(version = "1.10.0", sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747", platform = "linux")'
80-
replacement-text: doxygen_extension.version(version = "1.10.0", sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747", platform = "linux")
87+
search-text: '# doxygen_extension.configuration(version = "1.10.0", sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747", platform = "linux")'
88+
replacement-text: doxygen_extension.configuration(version = "1.10.0", sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747", platform = "linux")
89+
files: examples/MODULE.bazel
90+
- name: Build ${{ matrix.subdir }}
91+
run: bazel build //${{ matrix.subdir }}:doxygen
92+
working-directory: examples
93+
- name: Check output
94+
uses: andstor/file-existence-action@v3
95+
with:
96+
files: "examples/bazel-bin/${{ matrix.subdir }}/html/index.html"
97+
fail: true
98+
- name: Check doxygen version in produced index.html (windows)
99+
if: matrix.os == 'windows-latest'
100+
run: grep 'Doxygen 1.11.0' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
101+
shell: bash
102+
- name: Check doxygen version in produced index.html (mac)
103+
if: matrix.os == 'macos-latest'
104+
run: grep 'Doxygen 1.12.0' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
105+
shell: bash
106+
- name: Check doxygen version in produced index.html (linux)
107+
if: matrix.os == 'ubuntu-latest'
108+
run: grep 'Doxygen 1.10.0' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
109+
shell: bash
110+
111+
tests-local-executable:
112+
strategy:
113+
matrix:
114+
os: [ubuntu-latest, windows-latest, macos-latest]
115+
subdir: [base]
116+
runs-on: ${{ matrix.os }}
117+
steps:
118+
- uses: actions/checkout@v4
119+
- name: Install doxygen
120+
uses: ssciwr/doxygen-install@v1
121+
with:
122+
version: "1.10.0"
123+
124+
- name: Copy binary to examples folder (windows)
125+
if: matrix.os == 'windows-latest'
126+
run: cp $(Get-Command doxygen).Source examples/doxygen.exe
127+
- name: Copy binary to examples folder (mac, linux)
128+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
129+
run: cp $(which doxygen) examples/doxygen
130+
131+
- name: Enable use of local doxygen by decommenting the module extension line (windows)
132+
uses: richardrigutins/replace-in-files@v2
133+
if: matrix.os == 'windows-latest'
134+
with:
135+
search-text: '# doxygen_extension.configuration(executable = "@//:doxygen")'
136+
replacement-text: doxygen_extension.configuration(executable = "@//:doxygen.exe")
81137
files: examples/MODULE.bazel
138+
- name: Export doxygen binary (windows)
139+
uses: richardrigutins/replace-in-files@v2
140+
if: matrix.os == 'windows-latest'
141+
with:
142+
search-text: '# exports_files(["doxygen"])'
143+
replacement-text: exports_files(["doxygen.exe"])
144+
files: examples/BUILD.bazel
145+
146+
- name: Enable use of local doxygen by decommenting the module extension line (mac, linux)
147+
uses: richardrigutins/replace-in-files@v2
148+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
149+
with:
150+
search-text: '# doxygen_extension.configuration(executable = "@//:doxygen")'
151+
replacement-text: doxygen_extension.configuration(executable = "@//:doxygen")
152+
files: examples/MODULE.bazel
153+
- name: Export doxygen binary (mac, linux)
154+
uses: richardrigutins/replace-in-files@v2
155+
if: matrix.os == 'ubuntu-latest' || matrix.os == 'macos-latest'
156+
with:
157+
search-text: '# exports_files(["doxygen"])'
158+
replacement-text: exports_files(["doxygen"])
159+
files: examples/BUILD.bazel
160+
82161
- name: Build ${{ matrix.subdir }}
83162
run: bazel build //${{ matrix.subdir }}:doxygen
84163
working-directory: examples
@@ -87,3 +166,6 @@ jobs:
87166
with:
88167
files: "examples/bazel-bin/${{ matrix.subdir }}/html/index.html"
89168
fail: true
169+
- name: Check doxygen version in produced index.html
170+
run: grep 'Doxygen 1.10.0' examples/bazel-bin/${{ matrix.subdir }}/html/index.html
171+
shell: bash

CHANGELOG.md

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
6969

7070
### Added
7171

72-
- Support hermetic build for `macos` platform (thanks to @kaycebasques)
72+
- Support hermetic build for `mac` platform (thanks to @kaycebasques, @wyverald, @tpudlik, @rickeylev)
7373
- Support for platform-specific configurations in the extension rule
7474

7575
### Changed
@@ -78,6 +78,18 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
7878
- Refactor of internal repository and extension rules
7979
- Updated documentation
8080

81+
## [2.0.0]
82+
83+
### Added
84+
85+
- Platform `mac-silicon` to support the Apple silicon macs (thanks to @kaycebasques, @wyverald, @tpudlik, @rickeylev)
86+
- Allow executable configuration in the `doxygen` extension rule (thanks to @kaycebasques, @wyverald, @tpudlik, @rickeylev)
87+
88+
### Changed
89+
90+
- Module extension tag renamed from `version` to `configuration` **BREAKING CHANGE**
91+
- Updated documentation
92+
8193
## [NEXT.VERSION]
8294

8395
[1.0.0]: https://github.com/TendTo/rules_doxygen/tree/1.0.0
@@ -87,4 +99,5 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
8799
[1.1.3]: https://github.com/TendTo/rules_doxygen/compare/1.1.2...1.1.3
88100
[1.2.0]: https://github.com/TendTo/rules_doxygen/compare/1.1.3...1.2.0
89101
[1.3.0]: https://github.com/TendTo/rules_doxygen/compare/1.2.0...1.3.0
90-
[NEXT.VERSION]: https://github.com/TendTo/rules_doxygen/compare/1.3.0...HEAD
102+
[2.0.0]: https://github.com/TendTo/rules_doxygen/compare/1.3.0...2.0.0
103+
[NEXT.VERSION]: https://github.com/TendTo/rules_doxygen/compare/2.0.0...HEAD

MODULE.bazel

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
"""rules_doxygen module"""
2-
module(name = "rules_doxygen", version = "1.3.0", compatibility_level = 1)
2+
module(name = "rules_doxygen", version = "2.0.0", compatibility_level = 2)
33

44
bazel_dep(name = "platforms", version = "0.0.10")
55
bazel_dep(name = "stardoc", version = "0.7.1", dev_dependency = True)

README.md

Lines changed: 38 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# Doxygen rules for Bazel
22

3-
[![Bazel Central Repository](https://img.shields.io/badge/BCR-1.3.0-%230C713A?logo=bazel)](https://registry.bazel.build/modules/rules_doxygen)
3+
[![Bazel Central Repository](https://img.shields.io/badge/BCR-2.0.0-%230C713A?logo=bazel)](https://registry.bazel.build/modules/rules_doxygen)
44
[![CI](https://github.com/TendTo/rules_doxygen/actions/workflows/ci.yml/badge.svg)](https://github.com/TendTo/rules_doxygen/actions/workflows/ci.yml)
55

66
This repository contains a [Starlark](https://github.com/bazelbuild/starlark) implementation of [Doxygen](https://www.doxygen.nl/) rules in [Bazel](https://bazel.build/).
@@ -12,27 +12,25 @@ Add the following to your _MODULE.bazel_:
1212
```bzl
1313
# MODULE.bazel file
1414

15-
bazel_dep(name = "rules_doxygen", version = "1.3.0", dev_dependency = True)
15+
bazel_dep(name = "rules_doxygen", version = "2.0.0", dev_dependency = True)
1616
```
1717

18-
If you don't want to depend on the [Bazel package registry](https://bazel.build/external/bazelbuild/rules_pkg) or you want to use a not-yet-published version of this module, you can use an archive override by adding the following lines below the `bazel_dep` rule in your _MODULE.bazel_ file:
18+
If you don't want to depend on the [Bazel package registry](https://bazel.build/external/bazelbuild/rules_pkg) or need a not-yet-published version of this module, you can use a `git_override` by adding the following lines below `bazel_dep` in your _MODULE.bazel_ file:
1919

2020
```bzl
2121
# MODULE.bazel file
2222

23-
bazel_dep(name = "rules_doxygen", version = "1.3.0", dev_dependency = True)
24-
archive_override(
23+
bazel_dep(name = "rules_doxygen", version = "2.0.0", dev_dependency = True)
24+
git_override(
2525
module_name = "rules_doxygen",
26-
urls = "https://github.com/TendTo/rules_doxygen/archive/refs/heads/main.tar.gz",
27-
strip_prefix = "rules_doxygen-main",
28-
# The SHA256 checksum of the archive file, based on the rules' version
29-
# integrity = "sha256-0SCaZuAerluoDs6HXMb0Bj9FttZVieM4+Dpd9gnMM+o=", # Example
26+
commit = "aacc1c856c350a89a0fa9c43b9318a248d5f1781", # Commit hash you want to use
27+
remote = "https://github.com/TendTo/rules_doxygen.git",
3028
)
3129
```
3230

3331
### Doxygen version selection
3432

35-
To select a doxygen version to use, use the `doxygen_extension` module extension below the `bazel_dep` rule in your MODULE.bazel file.
33+
To add the `@doxygen` repository to your module, use `doxygen_extension` under `bazel_dep` in your MODULE.bazel file.
3634

3735
```bzl
3836
# MODULE.bazel file
@@ -43,8 +41,8 @@ doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_ex
4341
use_repo(doxygen_extension, "doxygen")
4442
```
4543

46-
By default, version `1.12.0` of Doxygen is used.
47-
You can override this value with a custom one for each supported platform, i.e. _windows_, _mac_ and _linux_.
44+
The extension will create a default configuration for all platforms with the version `1.12.0` of Doxygen.
45+
You can override this value with a custom one for each supported platform, i.e. _windows_, _mac_, _mac-arm_, _linux_ and _linux-arm_.
4846

4947
```bzl
5048
# MODULE.bazel file
@@ -54,7 +52,7 @@ bazel_dep(name = "rules_doxygen", version = "...", dev_dependency = True)
5452
doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension")
5553

5654
# Download doxygen version 1.10.0 on linux, default version on all other platforms
57-
doxygen_extension.version(
55+
doxygen_extension.configuration(
5856
version = "1.10.0",
5957
sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747",
6058
platform = "linux",
@@ -63,24 +61,37 @@ doxygen_extension.version(
6361
use_repo(doxygen_extension, "doxygen")
6462
```
6563

66-
When you do so, you must also provide the SHA256 of the given doxygen installation.
64+
When you do so, you must also provide the SHA256 of the given doxygen archive.
6765
If you don't know the SHA256 value, just leave it empty.
6866
The build will fail with an error message containing the correct SHA256.
6967

7068
```bash
7169
Download from https://github.com/doxygen/doxygen/releases/download/Release_1_10_0/doxygen-1.10.0.windows.x64.bin.zip failed: class com.google.devtools.build.lib.bazel.repository.downloader.UnrecoverableHttpException Checksum was 2135c1d5bdd6e067b3d0c40a4daac5d63d0fee1b3f4d6ef1e4f092db0d632d5b but wanted 0000000000000000000000000000000000000000000000000000000000000000
7270
```
7371

72+
> [!Tip]
73+
> Not indicating the platform will make the configuration apply to the platform it is running on.
74+
> The build will fail when the download does not match the SHA256 checksum, i.e. when the platform changes.
75+
> Unless you are using a system-wide doxygen installation, you should always specify the platform.
76+
77+
#### System-wide doxygen installation
78+
7479
If you set the version to `0.0.0`, the doxygen executable will be assumed to be available from the PATH.
7580
No download will be performed and bazel will use the installed version of doxygen.
7681

7782
> [!Warning]
7883
> Setting the version to `0.0.0` this will break the hermeticity of your build, as it will now depend on the environment.
7984
80-
> [!Tip]
81-
> Not indicating the platform will make the configuration apply to the platform it is running on.
82-
> The build will fail when the downloaded file does not match the SHA256 checksum, i.e. when the platform changes.
83-
> Unless you are using a system-wide doxygen installation, you should always specify the platform.
85+
#### Using a local doxygen executable
86+
87+
You can also provide a label pointing to the `doxygen` executable you want to use by using the `executable` parameter in the extension configuration.
88+
No download will be performed, and the file indicated by the label will be used as the doxygen executable.
89+
90+
> [!Note]
91+
> `version` and `executable` are mutually exclusive.
92+
> You must provide exactly one of them.
93+
94+
#### Example
8495

8596
Different strategies can be combined in the same file, one for each platform, as shown below:
8697

@@ -92,17 +103,23 @@ bazel_dep(name = "rules_doxygen", version = "...", dev_dependency = True)
92103
doxygen_extension = use_extension("@rules_doxygen//:extensions.bzl", "doxygen_extension")
93104

94105
# Download doxygen version 1.10.0 on linux
95-
doxygen_extension.version(
106+
doxygen_extension.configuration(
96107
version = "1.10.0",
97108
sha256 = "dcfc9aa4cc05aef1f0407817612ad9e9201d9bf2ce67cecf95a024bba7d39747",
98109
platform = "linux",
99110
)
100111
# Use the local doxygen installation on mac
101-
doxygen_extension.version(
112+
doxygen_extension.configuration(
102113
version = "0.0.0",
103114
platform = "mac",
104115
)
105-
# Since no configuration has been provided, windows will fallback to the default version
116+
# Use the doxygen provided executable on mac-arm
117+
doxygen_extension.configuration(
118+
executable = "@my_module//path/to/doxygen:doxygen",
119+
platform = "mac-arm",
120+
)
121+
# Since no configuration has been provided for them,
122+
# all other platforms will fallback to the default version
106123

107124
use_repo(doxygen_extension, "doxygen")
108125
```

0 commit comments

Comments
 (0)