Doxygen and git for automated file version information

Is there a way to get information for Doxygen from git: For example, for:

@version @author @date 

Information should be automatically included in Doxygen comments.

It would be nice for @version to get tag information.

Thank you very much in advance!

+5
source share
1 answer

I understand this is an old question, but I was just trying to do the same.

None of the related answers in the comments are a great solution to this problem. We might want to include, for example, a version of git in the generated documentation without having to deal with git filters, etc. In our working sources.

Luckily. Doxygen supports the use of environment variables in your Doxyfile and provides various settings that you can use to place information in your generated content. The PROJECT_NUMBER parameter is intended to include version control information in your documentation.

If we have this in our Doxyfile :

 PROJECT_NUMBER = $(PROJECT_NUMBER) 

You can run doxygen as follows to include git revision in your generated documents:

 PROJECT_NUMBER=$(git rev-parse --short HEAD) doxygen 

You are not limited to commit identifier only. For instance:

 PROJECT_NUMBER=$(git log -1 --format "%h (%cd)") doxygen 

This makes the title in my generated HTML look like:

 <div id="projectname">MyProject &#160;<span id="projectnumber">9dd847b (Fri Feb 1 15:36:13 2019 -0500)</span> </div> 
0
source

Source: https://habr.com/ru/post/1397777/


All Articles