-
-
Notifications
You must be signed in to change notification settings - Fork 355
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Use doxygen comments in sourcegen #1777
Conversation
Codecov ReportAll modified and coverable lines are covered by tests ✅
Additional details and impacted files@@ Coverage Diff @@
## main #1777 +/- ##
==========================================
+ Coverage 73.19% 73.22% +0.02%
==========================================
Files 381 381
Lines 54289 54344 +55
Branches 9242 9247 +5
==========================================
+ Hits 39737 39793 +56
+ Misses 11579 11576 -3
- Partials 2973 2975 +2 ☔ View full report in Codecov by Sentry. |
With the understanding that this is a limited-scope proof-of-concept, do you expect that extending this work will require the full doxygen parser at some point (and then just parse the Nonetheless, I'm impressed that this could be done in so few lines of code! |
The idea would be to run One thing that could be done next is to generate CLib implementation files automatically (essentially by switching out doxygen XML for YAML in what @speth originally suggested in Cantera/enhancements#39). As CLib compilation is done during regular CI, any typo for the |
Thanks for the context @ischoegl! Good to know, and we'd just want to obviously document that |
If we want to pull comments/default arguments from the original C++ code, yes. We could also go with a minimalist version where we just 'hijack' doxygen syntax (which we already use anyways). |
Pulling information out of Doxygen's Part of the rationale here is that I suspect there will be cases that are more complicated that what's currently handled by |
@speth ... you're right that some YAML will be needed, but I believe these can be implemented as part of For the time being, this PR just adds decorators to CLib headers (as bare-bones documentation), and makes those comments available to |
This comment was marked as outdated.
This comment was marked as outdated.
8546c82
to
15e088a
Compare
45904e9
to
fcf7757
Compare
fcf7757
to
b76b5d5
Compare
d5e5481
to
1cc2814
Compare
This PR has mutated into a proof-of-concept for code generation. While I made substantial progress towards automated generation of CLib header files, I will open a new PR with a cleaned implementation at a later point. |
Changes proposed in this pull request
Cantera/enhancements#39 suggested the use of YAML for autogenerated code; a partial solution emerged from Cantera/enhancements#156 (implemented in #1331), which is based on parsing of CLib header files. This PR prepares to use standard doxygen decorators as an alternative to YAML. Documenting CLib header files with
@implements
, together with the doxygenbuild/doc/Cantera.tag
(and linked information therein) will yield all necessary information needed for code generation.For illustration purposes, this PR just adds comments to autogenerated C# code.
If applicable, fill in the issue number this pull request is fixing
Partially addresses Cantera/enhancements#39
If applicable, provide an example illustrating new features this pull request is introducing
Snippet from decorated CLib header
ctfunc.h
:Corresponding generated C# code snippet (click to expand)
Corresponding doxygen tag/XML snippet (click to expand)
The
Cantera.tag
file entry fornewDiffFunction
iswhere the
<anchorfile>
/<anchor>
entries point to detailed information (an XML file corresponding to the HTML file exists):For demonstration purposes, a new YAML generator can be run as:
extracts information from doxygen tags and converts everthing to YAML with the corresponding code snippet (fields with
cxx_
prefix are extracted fromCantera.tag
):Checklist
scons build
&scons test
) and unit tests address code coverage