Skip to content

Commit b541fce

Browse files
committed
feat: add example with multiple rules in the same folder
1 parent bce965e commit b541fce

File tree

3 files changed

+100
-5
lines changed

3 files changed

+100
-5
lines changed

.github/workflows/ci.yml

Lines changed: 33 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ jobs:
4747
runs-on: ${{ matrix.os }}
4848

4949
steps:
50-
- uses: actions/checkout@v4
50+
- uses: actions/checkout@v6
5151
- name: Create .bazelversion file
5252
working-directory: examples
5353
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -72,7 +72,7 @@ jobs:
7272
runs-on: ${{ matrix.os }}
7373

7474
steps:
75-
- uses: actions/checkout@v4
75+
- uses: actions/checkout@v6
7676
- name: Install doxygen
7777
uses: ssciwr/doxygen-install@v1
7878
with:
@@ -103,7 +103,7 @@ jobs:
103103
subdir: [base]
104104
runs-on: ${{ matrix.os }}
105105
steps:
106-
- uses: actions/checkout@v4
106+
- uses: actions/checkout@v6
107107
- name: Create .bazelversion file
108108
working-directory: examples
109109
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -157,7 +157,7 @@ jobs:
157157
subdir: [base]
158158
runs-on: ${{ matrix.os }}
159159
steps:
160-
- uses: actions/checkout@v4
160+
- uses: actions/checkout@v6
161161
- name: Create .bazelversion file
162162
working-directory: examples
163163
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -225,7 +225,7 @@ jobs:
225225
runs-on: ${{ matrix.os }}
226226

227227
steps:
228-
- uses: actions/checkout@v4
228+
- uses: actions/checkout@v6
229229
- name: Create .bazelversion file
230230
working-directory: examples
231231
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -241,3 +241,31 @@ jobs:
241241
- name: Check doxygen version in produced index.html
242242
run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/submodules/${{ matrix.subdir }}/bazel-bin/html/index.html
243243
shell: bash
244+
245+
nested:
246+
strategy:
247+
matrix:
248+
os: [ubuntu-latest, windows-latest, macos-latest]
249+
bazel: [7.0.0, 8.0.0, rolling]
250+
runs-on: ${{ matrix.os }}
251+
252+
steps:
253+
- uses: actions/checkout@v6
254+
- name: Create .bazelversion file
255+
working-directory: examples
256+
run: echo "${{ matrix.bazel }}" > .bazelversion
257+
shell: bash
258+
- name: Build nested
259+
run: bazel build //nested:doxygen_a //nested:doxygen_b
260+
working-directory: examples/nested
261+
- name: Check output
262+
uses: andstor/file-existence-action@v3
263+
with:
264+
files: examples/bazel-bin/nested/html/index.html
265+
fail: true
266+
- name: Check doxygen version in produced index.html
267+
run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/bazel-bin/nested/nested/a/html/index.html
268+
shell: bash
269+
- name: Check doxygen version in produced index.html
270+
run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/bazel-bin/nested/nested/b/html/index.html
271+
shell: bash

examples/nested/BUILD.bazel

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,3 +16,32 @@ doxygen(
1616
project_brief = "Example project for doxygen",
1717
project_name = "nested",
1818
)
19+
20+
doxygen(
21+
name = "doxygen_a",
22+
srcs = ["//nested/lib_a:sources"],
23+
outs = [
24+
"a/html",
25+
"a/tags",
26+
],
27+
doxyfile_prefix = "a",
28+
project_brief = "Example project for doxygen, library A",
29+
project_name = "nested",
30+
generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
31+
)
32+
33+
doxygen(
34+
name = "doxygen_b",
35+
srcs = glob([
36+
"lib_b/*.h",
37+
"lib_b/*.cpp",
38+
]),
39+
outs = [
40+
"b/html",
41+
"b/tags",
42+
],
43+
doxyfile_prefix = "b",
44+
project_brief = "Example project for doxygen, library B",
45+
project_name = "nested",
46+
generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
47+
)

examples/nested/README.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,3 +77,41 @@ doxygen(
7777
project_name = "nested",
7878
)
7979
```
80+
81+
## Handling multiple doxygen rules in the same folder
82+
83+
Having multiple `doxygen` rules in the same folder is supported, but requires some extra configuration.
84+
By default, all rules would create a `Doxyfile` in the same location, causing a conflict.
85+
The same applies to the output `html` folder.
86+
To avoid this, remember to specify different `doxyfile_prefix` and `outs` for each rule:
87+
88+
```bzl
89+
doxygen(
90+
name = "doxygen_a",
91+
srcs = ["//nested/lib_a:sources"],
92+
outs = [
93+
"a/html",
94+
"a/tags",
95+
],
96+
doxyfile_prefix = "a",
97+
project_brief = "Example project for doxygen, library A",
98+
project_name = "nested",
99+
generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
100+
)
101+
102+
doxygen(
103+
name = "doxygen_b",
104+
srcs = glob([
105+
"lib_b/*.h",
106+
"lib_b/*.cpp",
107+
]),
108+
outs = [
109+
"b/html",
110+
"b/tags",
111+
],
112+
doxyfile_prefix = "b",
113+
project_brief = "Example project for doxygen, library B",
114+
project_name = "nested",
115+
generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
116+
)
117+
```

0 commit comments

Comments
 (0)