[docs] Address Doc Building Issues
Issues when building the SW API Doxygen docs were not being correctly
propagated to fail the build.
This commit contains two changes:
- The first is to ensure we `set -e` in the docs CI bash script, so that
if the `build_docs.py` errors, the build fails.
- The second is to make the process which extracts information from the
Doxygen XML dump more robust to failures - returning empty strings
when information is not available rather than throwing exceptions.
Closes #2813
Signed-off-by: Sam Elliott <selliott@lowrisc.org>
diff --git a/util/build_docs.py b/util/build_docs.py
index 2b44bc7..cbeb01f 100755
--- a/util/build_docs.py
+++ b/util/build_docs.py
@@ -277,18 +277,17 @@
dif_listings_filename = dif_listings_root_path.joinpath(dif_header + ".html")
dif_listings_filename.parent.mkdir(parents=True, exist_ok=True)
- dif_listings_html = open(str(dif_listings_filename), mode='w')
- gen_dif_listing.gen_listing_html(combined_xml, dif_header, dif_listings_html)
- dif_listings_html.close()
+ with open(str(dif_listings_filename), mode='w') as dif_listings_html:
+ gen_dif_listing.gen_listing_html(combined_xml, dif_header,
+ dif_listings_html)
difref_functions = gen_dif_listing.get_difref_info(combined_xml, dif_header)
for function in difref_functions:
difref_filename = difrefs_root_path.joinpath(function["name"] + '.html')
difref_filename.parent.mkdir(parents=True, exist_ok=True)
- difref_html = open(str(difref_filename), mode='w')
- gen_dif_listing.gen_difref_html(function, difref_html)
- difref_html.close()
+ with open(str(difref_filename), mode='w') as difref_html:
+ gen_dif_listing.gen_difref_html(function, difref_html)
logging.info("Generated DIF Listing for {}".format(dif_header))