build: wipe the doxygen xml dir before regenerating the jsonapi bindings - #370
build: wipe the doxygen xml dir before regenerating the jsonapi bindings#370jolavillette wants to merge 1 commit into
Conversation
| } else { | ||
| genjsonapi.commands = \ | ||
| mkdir -p $${JSONAPI_GENERATOR_OUT} && \ | ||
| rm -rf $${JSONAPI_GENERATOR_OUT}/xml && \ |
There was a problem hiding this comment.
Could you rather use something like "rm $${JSONAPI_GENERATOR_OUT}/xml/*_8h.xml" ? That line looks dangerous, if something ever happens to the JSONAPI_GENERATOR_OUT variable
There was a problem hiding this comment.
Agreed, done — no more directory removal anywhere.
Both generators only ever pick up the header XML (jsonapi-generator.cpp iterates *8h.xml, jsonapi-generator.py filters on endswith("8h.xml")), so deleting just those is enough: every other XML they open is reached through a live header'''s XML, which doxygen has just regenerated.
- sh branch:
rm -f $${JSONAPI_GENERATOR_OUT}/xml/*_8h.xml(-fso an unexpanded glob is not an error) - win32 no-sh branch:
-$(DEL_FILE) ... /xml/*_8h.xml - CMake:
cmake -E rmdoes not expand wildcards, so the glob is done by a tiny script generated next to the doxyfile (file(GLOB ...)+file(REMOVE ...), guarded against an empty match).
Force-pushed.
… bindings
A build directory that predates the removal or rename of a public header
keeps failing with:
jsonapi-includes.inl:11:10: fatal error: retroshare/rsmsgs.h:
No such file or directory
Doxygen never purges its OUTPUT_DIRECTORY, and both generators emit one
#include per *_8h.xml file found there, built from that XML's
<location file=...>. So the XML of a header that no longer exists is
re-read on every rebuild and turned back into a dead #include, with the
matching dead wrappers in jsonapi-wrappers.inl.
The generated clean rule lists only the two .inl files, never the xml/
directory, so a clean rebuild does not cure it: only deleting the whole
build directory does.
Delete the *_8h.xml files right before invoking doxygen, in both build
systems. Only those files drive the generators; every other XML they read
is reached through a live header's freshly regenerated XML. This costs
nothing, doxygen re-parses its whole input on every run anyway.
cmake -E rm does not expand wildcards, so the CMake side does the glob in
a small script generated next to the doxyfile.
Reported by Cyril on the dev chat.
Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
3dc48d5 to
29620c6
Compare
|
Given this change, does the compilation always regenerate the xml files, or does it keep the existing ones when the .h files haven't changed? |
|
Maybe that cleaning step should be in the make clean, not in the compilation. |
|
Doxygen has no incremental mode and never purges: every run re-parses the whole INPUT and rewrites the XML of everything it parses, leaving behind the XML of whatever is gone (checked with 1.9.8). That leftover is the bug. The deletion is a command inside the same rule as doxygen, so it runs if and only if doxygen runs, and it only removes files doxygen is about to rewrite anyway, plus those leftovers. No extra work, no extra run. On
Step 2 is a clean build tree as far as the clean rule is concerned; someone still has to know to delete the xml directory by hand. The stale XML is an input of the generation step, so purging it belongs to that step. If you want |
A build directory that predates the removal or rename of a public header keeps failing with:
rsmsgs.hwas removed by fd79225 ("started separating rsMsgs into rsMail and rsChats"), and grepping the sources for it finds nothing — because it is not in the sources. Doxygen never purges itsOUTPUT_DIRECTORY, sorsmsgs_8h.xmlis still sitting in the build tree, and both generators emit one#includeper*_8h.xmlfile they find there, built from that XML's<location file=...>. The dead header is re-included on every rebuild, andjsonapi-wrappers.inlgets the matching dead wrappers.make cleandoes not cure it:genjsonapi.cleanlists only the two.inlfiles, never thexml/directory. The clean deletes the outputs, doxygen reruns, and the same#includecomes back from the surviving XML. The only workaround is deleting the whole build directory, which is not something the error message suggests.So delete the
*_8h.xmlfiles right before invoking doxygen, in both build systems. Only those files drive the generators (jsonapi-generator.cppiterates*8h.xml,jsonapi-generator.pyfilters onendswith("8h.xml")); every other XML they open is reached through a live header's XML, which doxygen has just regenerated. This costs nothing: doxygen re-parses its whole input on every run anyway, it just stops reusing the stale header files.cmake -E rmdoes not expand wildcards, so the CMake side does the glob in a small script generated next to the doxyfile.Reproduced by dropping a single crafted
rsmsgs_8h.xmlinto an otherwise up-to-date xml directory — the generator emits#include "retroshare/rsmsgs.h"again; with the deletion in place the output is clean.Reported by Cyril on the dev chat.