-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #3 from TendTo/feat/hermetic-dot
Feat/hermetic dot
- Loading branch information
Showing
12 changed files
with
155 additions
and
18 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -2903,6 +2903,8 @@ MSCFILE_DIRS = | |
|
||
# {{INPUT}} | ||
|
||
# {{DOT_PATH}} | ||
|
||
# {{ADDITIONAL PARAMETERS}} | ||
|
||
# {{OUTPUT DIRECTORY}} |
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 |
---|---|---|
@@ -1,5 +1,5 @@ | ||
"""rules_doxygen module""" | ||
module(name = "rules_doxygen", version = "1.1.2", compatibility_level = 1) | ||
module(name = "rules_doxygen", version = "1.1.3", compatibility_level = 1) | ||
|
||
bazel_dep(name = "platforms", version = "0.0.5") | ||
bazel_dep(name = "stardoc", version = "0.6.2", dev_dependency = True) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -34,11 +34,3 @@ graph TD; | |
B-->D; | ||
C-->D; | ||
</pre> | ||
|
||
<pre class="mermaid"> | ||
graph TD; | ||
A-->B; | ||
A-->C; | ||
B-->D; | ||
C-->D; | ||
</pre> |
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,15 @@ | ||
load("@doxygen//:doxygen.bzl", "doxygen") | ||
|
||
# WARNINING: this assume the existence of a repository @graphviz exposing the target :executable | ||
doxygen( | ||
name = "doxygen", | ||
srcs = glob([ | ||
"*.h", | ||
"*.cpp", | ||
"*.sh", | ||
]) + ["@graphviz//:executable"], | ||
dot_executable = "@graphviz//:executable", | ||
have_dot = True, | ||
project_brief = "Example project for doxygen", | ||
project_name = "graphviz", | ||
) |
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,46 @@ | ||
# Graphiz path example | ||
|
||
This is an example of how to use the `doxygen` alongside `graphviz` to generate inheritance diagrams for C++ classes. | ||
By default, `doxygen` looks for the `dot` executable in the system path, meaning that a system installation of `graphviz` will work out of the box. | ||
If you want to make the build fully hermetic, you can specify the path to the `dot` executable in the `doxygen` rule, making it point to a `dot` binary of your choosing. | ||
|
||
```bash | ||
bazel build //doxyfile:doxygen | ||
``` | ||
|
||
## Custom dot binary | ||
|
||
To ensure the `dot` binary is available to the rule, make sure to add it to the sources of the macro. | ||
Also, remember to add the `have_dot = True` parameter, otherwise no graphs will be produced. | ||
|
||
```bzl | ||
load("@doxygen//:doxygen.bzl", "doxygen") | ||
|
||
# Assuming the binary is located in the same folder | ||
|
||
filegroup( | ||
name = "dot_executable", | ||
srcs = select( | ||
{ | ||
"@platforms//os:linux": ["dot"], | ||
"@platforms//os:macos": ["dot"], | ||
"@platforms//os:windows": ["dot"], | ||
}, | ||
"Unsupported platform", | ||
), | ||
) | ||
|
||
# Ideally, instead of using a local filegroup, you would want and external module, like "@graphviz//:bin/dot" | ||
|
||
doxygen( | ||
name = "doxygen", | ||
srcs = glob([ | ||
"*.h", | ||
"*.cpp", | ||
"*.sh", | ||
]) + [":dot_executable"], | ||
dot_executable = ":dot_executable", | ||
have_dot = True, | ||
project_name = "graphviz", | ||
) | ||
``` |
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,10 @@ | ||
/** | ||
* @file lib.cpp | ||
* @author Ernesto Casablanca ([email protected]) | ||
* @copyright 2024 | ||
*/ | ||
|
||
#include "lib.h" | ||
|
||
int Adder::op(int a, int b) { return a + b; } | ||
int Subtractor::op(int a, int b) { return a - b; } |
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,52 @@ | ||
/** | ||
* @file lib.h | ||
* @author Ernesto Casablanca ([email protected]) | ||
* @copyright 2024 | ||
*/ | ||
#pragma once | ||
|
||
/** | ||
* @brief Run a calculation on two integers. | ||
*/ | ||
class Calculator { | ||
public: | ||
/** | ||
* @brief Run a calculation on two integers. | ||
* | ||
* The actual operation is defined by the derived class. | ||
* @param a first integer | ||
* @param b second integer | ||
* @return result of the operation | ||
*/ | ||
virtual int op(int a, int b) = 0; | ||
}; | ||
|
||
/** | ||
* @brief Add two integers. | ||
*/ | ||
class Adder : public Calculator { | ||
public: | ||
/** | ||
* @brief Add two integers. | ||
* | ||
* @param a first integer | ||
* @param b second integer | ||
* @return sum of a and b | ||
*/ | ||
int op(int a, int b) override; | ||
}; | ||
|
||
/** | ||
* @brief Subtract two integers. | ||
*/ | ||
class Subtractor : public Calculator { | ||
public: | ||
/** | ||
* @brief Subtract two integers. | ||
* | ||
* @param a first integer | ||
* @param b second integer | ||
* @return difference of a and b | ||
*/ | ||
int op(int a, int b) override; | ||
}; |
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