-
-
Notifications
You must be signed in to change notification settings - Fork 3.5k
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
docs(doc_builder.py) overhaul, remove bugs, clean up, modularize #7913
base: master
Are you sure you want to change the base?
Conversation
...and: - make `api_doc_builder.py` a client of `doxy_xml_parser` handling creation of API pages and adding API hyperlinks to those pages. This moves from old `doc_builder.py` functionality that was ONLY used by build.py. (It also serves `gen_json.py`, so doesn't need build.py functionality.) - pycparser_monkeypatch.py: rename `doc_builder.py` module to `doxy_xml_parser` and document what it provides. Add some function args to provide DoxygenXmlParser() with what it needs. - gen_json.py: function args to provide DoxygenXmlParser() with what it needs, and rename some vars to be very clear about what they are.
...how logic is managed when no change of directory is needed.
...and build.py: enhance announcements
...now handling reads and writes of Doxyfile for both `gen_json.py` and `build.py` via `api_doc_builder.py`.
...with other stuff.
The place-holder "tags" in Doxyfile are no longer needed thanks to the introduction of `doxygen_config.py` module that now gives us an easy interface to the Doxygen settings during the doc-build process. The Doxyfile settings pertinent to the doc-build are now set (overridden) during the doc-build without altering the original Doxyfile.
- Maintenance nightmare recursive directory-tree-walking logic replaced with clean, easy-to-understand tree-walking logic. - API page now not included if Doxygen did not generate any documentation for it. This places the control point of what gets excluded in the Doxyfile EXCLUDE_PATTERNS list, which is where it belongs. No more empty API pages with error messages in them.
...Doxygen TAGFILES! (Very cool shortcut found to connect C symbols with the C files they were contained in. A much more complex version of this is currently being used to generate hyperlinks to API pages.
...that was causing struct docstrings to be excluded from `gen_json.py`'s JSON output. It was also adversely impacting the new algorithm for adding API links to docs, since STRUCT objects `file_name` attributes were not being populated.
...preventing them from being associated with their source files.
...that Doxygen does not generate documentation for. Also, new API-link-generation algorithm partially implemented, with TODOs listed for what is left.
...minor refactoring.
- Only `.rst` files with API section at end are eligible. - Allow doc writers/editors to add their own API links. New links added will not duplicate these, and the editor-added links will remain at the top. - Now parses and adds API-links per new link directives as per Issue lvgl#7068. - Minus the new link directcives, a more logical version of the original algorithm is used (until API-link directives can be added). - Previously `lv_types_h` link was in almost every list. No more. - `lv_xxxx_private_h` links now included where applicable. Reason: advanced users are going to need this documentation, and it is important for all users to understand that these files exist even when that user is not directly accessing the fields in the private structs. Better to err on the side of thoroughness. - API-link lists now have a special sort algorithm applied to them to help users find links quickly in long lists. - Modify build.py to pass simpler dir list to examine. - Fix 3 build.py announce lines that were not passing __file__ correctly.
e52f5fc
to
ce609ed
Compare
...add `./docs/src/intro/` directory to docs searched for API sections at end, since they may be added to certain docs therein.
ce609ed
to
ad46630
Compare
...that was causing UNION objects to be added into the STRUCTS dictionary and leaving the unions dictionary empty. The result is that `gen_json.py` now has 465 additional bytes of docstrings that were being erroneously omitted before.
de5d5ad
to
acfe952
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi Victor,
Im on embedded world and could not immerse in it deeply. In principle in looks great, and happy that these long outstanding error with thorvg (and others) are resolved. @liamHowatt please test it on your end.
cc: @liamHowatt Indeed. By the way, this upgrade now makes several things possible that were hidden problems before:
Anyway, my point is to let the two of you know these things are coming (with a "wrap-up" PR) and have been prevented (up to this point) by that incomplete algorithm being in the way—remedied herein. |
This PR has been long in the making. Firstly,
doc_builder.py
was a module that was partly a package that dealt with Doxygen XML output as well as logic that generated API pages and links to those pages forbuild.py
-- and these two logically separate functions were literally mixed inside the file, making it difficult to understand and maintain. Finally, it had a significant amount of duplicated functionality, undocumented and/or obfuscated (difficult-to-comprehend) code, and several important bugs, all of which have been fixed herein.doc_builder.py
was split into 2 cleanly-designed modules:doxygen_xml.py
is now the module that deals with Doxygen XML output (also used bygen_json.py
, which still generates what it previously generated), andapi_doc_builder.py
is now much cleaner and better logic that:3 bugs were found and fixed in
doxygen_xml.py
that was previously causing about 11.7KB of documentation to be erroneously omitted from the JSON output bygen_json.py
, and simultaneously omitted linkage of certain elements in the data structure back to their source files. Both of these were fixed and documented.api_doc_builder.py
now takes into account NOT generating API pages for source code that Doxygen was told to ignore (e.g. thorvg and other 3rd-party library code that is not part of the LVGL API). Simultaneously, this eliminates a large number of Sphinx errors from the doc build.Issue Generated API-Page Link Problems #7068 spells out illogic in auto-generating hyperlinks to the API pages, that especially did not age well when documents were renamed or restructured. This has been thoroughly handled herein.
The API-page hyperlinks added to eligible documents are now of better quality:
lv_types_h
was in virtually every hyperlink list (useless). No more.lv_xxxx_private_h
links are now included. Reason: advanced users are going to need this documentation, and it is important for all users to understand that these files exist even when that user is not directly accessing the fields in "private" structs. Better to err on side of thoroughness.Functionality that previously prepared the Doxyfile and ran Doxygen is factored out from 2 places to 1 place, now handled inside
doxygen_xml.py
.Functionality that handled non-trivial log-type announcements to STDOUT during the build processes factored out from many places to 1 place in new
announce.py
module.doxygen_xml.py
now uses the newdoxygen_config.py
module to gracefully and reliably manage Doxyfile configuration contents, so the need for the Doxyfile to carry place-holder values for the doc-build process (that make it unusable to an end user) is no longer needed. The result is that Doxyfile is now set up so it is syntactically correct and logical for its location, so any user can$ cd ./docs/ $ doxygen
and it will generate HTML output in
./docs/doxygen/html
or./docs/doxygen/xxxx
where xxxx is any other format the user turns on in the Doxyfile. The local.gitignore
file has been modified to allow for this without making Git think new files have arrived. It's not that this is needed, but it is sometimes nice be able to reference Doxygen HTML when verifying API documentation in source files is being done correctly. This is about 50X faster than doing a whole doc-build to find out. This is very useful when you are "tweaking" API documentation in source files to ensure Doxygen understands it correctly. Further, it seemed somewhat unprofessional to have a Doxyfile sitting there carrying invalid Doxygen syntax and thereby being useless, even if someone wanted to use it—he could not change it lest it would previously break the doc-build process. This restriction (thankfully) no longer applies.As usual, http://crystal-clear-research.com/for_gabor/demo/docs.lvgl.io/master/ is a reflection of what the documentation will look like with this PR merged.
Resolves #7068
cc: @kisvegabor
I attest this is okay to merge.
Notes
lv_conf_template.h
run lv_conf_internal_gen.py and update Kconfig. n/ascripts/code-format.py
(astyle v3.4.12
needs to installed by runningcd scripts; ./install_astyle.sh
) and follow the Code Conventions. n/a