feat: add example with multiple rules in the same folder
diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml
index bf3e899..e38174e 100644
--- a/.github/workflows/ci.yml
+++ b/.github/workflows/ci.yml
@@ -47,7 +47,7 @@
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Create .bazelversion file
working-directory: examples
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -72,7 +72,7 @@
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Install doxygen
uses: ssciwr/doxygen-install@v1
with:
@@ -103,7 +103,7 @@
subdir: [base]
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Create .bazelversion file
working-directory: examples
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -157,7 +157,7 @@
subdir: [base]
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Create .bazelversion file
working-directory: examples
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -225,7 +225,7 @@
runs-on: ${{ matrix.os }}
steps:
- - uses: actions/checkout@v4
+ - uses: actions/checkout@v6
- name: Create .bazelversion file
working-directory: examples
run: echo "${{ matrix.bazel }}" > .bazelversion
@@ -241,3 +241,31 @@
- name: Check doxygen version in produced index.html
run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/submodules/${{ matrix.subdir }}/bazel-bin/html/index.html
shell: bash
+
+ nested:
+ strategy:
+ matrix:
+ os: [ubuntu-latest, windows-latest, macos-latest]
+ bazel: [7.0.0, 8.0.0, rolling]
+ runs-on: ${{ matrix.os }}
+
+ steps:
+ - uses: actions/checkout@v6
+ - name: Create .bazelversion file
+ working-directory: examples
+ run: echo "${{ matrix.bazel }}" > .bazelversion
+ shell: bash
+ - name: Build nested
+ run: bazel build //nested:doxygen_a //nested:doxygen_b
+ working-directory: examples/nested
+ - name: Check output
+ uses: andstor/file-existence-action@v3
+ with:
+ files: examples/bazel-bin/nested/html/index.html
+ fail: true
+ - name: Check doxygen version in produced index.html
+ run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/bazel-bin/nested/nested/a/html/index.html
+ shell: bash
+ - name: Check doxygen version in produced index.html
+ run: grep "Doxygen $DEFAULT_DOXYGEN_VERSION" examples/bazel-bin/nested/nested/b/html/index.html
+ shell: bash
diff --git a/examples/nested/BUILD.bazel b/examples/nested/BUILD.bazel
index 0d17a54..028f11b 100644
--- a/examples/nested/BUILD.bazel
+++ b/examples/nested/BUILD.bazel
@@ -16,3 +16,32 @@
project_brief = "Example project for doxygen",
project_name = "nested",
)
+
+doxygen(
+ name = "doxygen_a",
+ srcs = ["//nested/lib_a:sources"],
+ outs = [
+ "a/html",
+ "a/tags",
+ ],
+ doxyfile_prefix = "a",
+ project_brief = "Example project for doxygen, library A",
+ project_name = "nested",
+ generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
+)
+
+doxygen(
+ name = "doxygen_b",
+ srcs = glob([
+ "lib_b/*.h",
+ "lib_b/*.cpp",
+ ]),
+ outs = [
+ "b/html",
+ "b/tags",
+ ],
+ doxyfile_prefix = "b",
+ project_brief = "Example project for doxygen, library B",
+ project_name = "nested",
+ generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
+)
diff --git a/examples/nested/README.md b/examples/nested/README.md
index 3c80a3a..4d61df6 100644
--- a/examples/nested/README.md
+++ b/examples/nested/README.md
@@ -77,3 +77,41 @@
project_name = "nested",
)
```
+
+## Handling multiple doxygen rules in the same folder
+
+Having multiple `doxygen` rules in the same folder is supported, but requires some extra configuration.
+By default, all rules would create a `Doxyfile` in the same location, causing a conflict.
+The same applies to the output `html` folder.
+To avoid this, remember to specify different `doxyfile_prefix` and `outs` for each rule:
+
+```bzl
+doxygen(
+ name = "doxygen_a",
+ srcs = ["//nested/lib_a:sources"],
+ outs = [
+ "a/html",
+ "a/tags",
+ ],
+ doxyfile_prefix = "a",
+ project_brief = "Example project for doxygen, library A",
+ project_name = "nested",
+ generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
+)
+
+doxygen(
+ name = "doxygen_b",
+ srcs = glob([
+ "lib_b/*.h",
+ "lib_b/*.cpp",
+ ]),
+ outs = [
+ "b/html",
+ "b/tags",
+ ],
+ doxyfile_prefix = "b",
+ project_brief = "Example project for doxygen, library B",
+ project_name = "nested",
+ generate_tagfile = "$(OUTDIR)/tags/tagfile.xml",
+)
+```