Doxygen 和 git 用于自动获取文件版本信息
有没有办法从 git 获取 Doxygen 的信息: 例如:
@version
@author
@date
信息应自动包含在 Doxygen 注释中。
对于 @version
来说,获得标签信息可能会很不错。
非常感谢!
is there a way to get information for Doxygen from git:
For instance for:
@version
@author
@date
The information should be automatically included in the Doxygen comments.
For @version
it would be nice to get maybe the tag information.
Many thanks in advance!
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我意识到这是一个较老的问题,但我只是想做同样的事情。
评论中的链接答案都不是解决此问题的好方法。我们可能希望在生成文档中包含例如 git 修订版,而无需在我们的工作源中使用 git 过滤器等。
幸运的是,Doxygen 支持在 Doxyfile 中使用环境变量,并提供各种可用于将信息放入生成的内容中的设置。
PROJECT_NUMBER
设置明确用于在文档中包含版本控制信息。如果我们的
Doxyfile
中有这个:您可以像这样运行
doxygen
以在生成的文档中包含 git 修订版:您也不仅限于提交 ID 。例如:
这使得我生成的 HTML 中的标题看起来像:
I realize this is an older question, but I was just trying to do the same thing.
Neither of the linked answers in the comments are a great solution to this issue. We may want to include e.g. a git revision in the generated documentation without mucking about with git filters and so forth in our working sources.
Fortunately, Doxygen supports the use of environment variables in your
Doxyfile
, and provides various settings that can be used to place information in your generated content. ThePROJECT_NUMBER
setting is meant explicitly for including version control information in your documentation.If we have this in our
Doxyfile
:You can run
doxygen
like this to include the git revision in your generated docs:You're not limited to just the commit id, either. For example:
This makes the title in my generated HTML look like: