GNOME Bugzilla – Bug 627920
`make check` rule to list xml files missing from DOC_MAIN_SGML_FILE
Last modified: 2010-09-15 19:19:44 UTC
I often forget to add an <xi:include/> to my DOC_MAIN_SGML_FILE when adding a new class to my project, resulting in the documentation for that class never actually being seen. Here's a small `make check` rule I wrote to check for xml files which are missing from DOC_MAIN_SGML_FILE; hopefully it can be integrated into gtk-doc: check-local: check-xml-includes check-xml-includes: @any_missing=0; find $(srcdir) -name "*.xml" | while read x; do \ xml_file="$${x#./}"; \ if test "x$$xml_file" != "x$(DOC_MAIN_SGML_FILE)"; then \ if ! grep "\"$$xml_file\"" $(DOC_MAIN_SGML_FILE) >/dev/null; then \ echo "$(DOC_MAIN_SGML_FILE) doesn't appear to include \"$$xml_file\""; \ any_missing=1; \ fi; \ fi; \ done; exit "$$any_missing"
I totally like the idea, but would probably add it to gtkdoc-check. I would be happy about a patch.
Created attachment 169807 [details] [review] gtkdoc-check: Add a test checking if all XML files are included in main file This works, but only if the project's Makefile.am doesn't use variable substitutions in DOC_MAIN_SGML_FILE. If, for example, it uses DOC_MAIN_SGML_FILE=$(DOC_MODULE)-docs.xml the test will fail, as it won't be able to open "$(DOC_MODULE)-docs.xml". I see no way around this other than (hackily) finding and replacing "$(DOC_MODULE)" (and variants) with the parsed value of DOC_MODULE; or implementing the check in automake as I originally did.
Thanks for the quick update && patch. That is indeed nasty. I'll think a bit about it.
Comment on attachment 169807 [details] [review] gtkdoc-check: Add a test checking if all XML files are included in main file I found a nice solution. I put some vars from Makefile.am to TEST_ENVIRONMENT and this was gtkdoc-check can grab them from %ENV. I pushed your patch with small modification. Thanks for the patch!