Skip to content

Commit a25d6ad

Browse files
Merge pull request #3815 from raspberrypi/doxygen_fixes
Doxygen fixes
2 parents af13225 + 6e6dca3 commit a25d6ad

13 files changed

+401
-385
lines changed

.gitmodules

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,5 +8,6 @@
88
branch = master
99

1010
[submodule "doxygentoasciidoc"]
11-
path = doxygentoasciidoc
11+
path = lib/doxygentoasciidoc
1212
url = https://github.com/raspberrypi/doxygentoasciidoc.git
13+
branch = main

Makefile

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ AUTO_NINJABUILD = $(BUILD_DIR)/autogenerated.ninja
1616

1717
PICO_SDK_DIR = lib/pico-sdk
1818
PICO_EXAMPLES_DIR = lib/pico-examples
19+
DOXYGEN_TO_ASCIIDOC_DIR = lib/doxygentoasciidoc
1920
ALL_SUBMODULE_CMAKELISTS = $(PICO_SDK_DIR)/CMakeLists.txt $(PICO_EXAMPLES_DIR)/CMakeLists.txt
2021
DOXYGEN_PICO_SDK_BUILD_DIR = build-pico-sdk-docs
2122
DOXYGEN_XML_DIR = $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined/docs/doxygen/xml
@@ -26,7 +27,7 @@ JEKYLL_CMD = bundle exec jekyll
2627

2728
.DEFAULT_GOAL := html
2829

29-
.PHONY: clean run_ninja clean_ninja html serve_html clean_html build_doxygen_html clean_doxygen_html build_doxygen_adoc clean_doxygen_adoc fetch_submodules clean_submodules clean_everything
30+
.PHONY: clean run_ninja clean_ninja html serve_html clean_html build_doxygen_xml clean_doxygen_xml build_doxygen_adoc clean_doxygen_adoc fetch_submodules clean_submodules clean_everything
3031

3132
$(BUILD_DIR):
3233
@mkdir -p $@
@@ -51,20 +52,20 @@ $(PICO_EXAMPLES_DIR)/CMakeLists.txt: | $(PICO_SDK_DIR)/CMakeLists.txt $(PICO_EXA
5152
git submodule update --init $(PICO_EXAMPLES_DIR)
5253

5354
# Initialise doxygentoasciidoc submodule
54-
doxygentoasciidoc/__main__.py:
55-
git submodule update --init doxygentoasciidoc
55+
$(DOXYGEN_TO_ASCIIDOC_DIR)/__main__.py:
56+
git submodule update --init $(DOXYGEN_TO_ASCIIDOC_DIR)
5657

57-
fetch_submodules: $(ALL_SUBMODULE_CMAKELISTS)
58+
fetch_submodules: $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_TO_ASCIIDOC_DIR)/__main__.py
5859

5960
# Get rid of the submodules
6061
clean_submodules:
6162
git submodule deinit --all
6263

6364
# Create the pico-sdk Doxygen XML files
6465
$(DOXYGEN_XML_DIR) $(DOXYGEN_XML_DIR)/index.xml: | $(ALL_SUBMODULE_CMAKELISTS) $(DOXYGEN_PICO_SDK_BUILD_DIR)
65-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=combined-docs
66-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2040
67-
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../$(PICO_EXAMPLES_DIR) -D PICO_PLATFORM=rp2350
66+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_NO_PICOTOOL=1 -D PICO_PLATFORM=combined-docs
67+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_NO_PICOTOOL=1 -D PICO_PLATFORM=rp2040
68+
cmake -S $(PICO_SDK_DIR) -B $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 -D PICO_EXAMPLES_PATH=../../$(PICO_EXAMPLES_DIR) -D PICO_NO_PICOTOOL=1 -D PICO_PLATFORM=rp2350
6869
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/combined docs
6970
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2040 docs
7071
$(MAKE) -C $(DOXYGEN_PICO_SDK_BUILD_DIR)/PICO_RP2350 docs
@@ -79,13 +80,14 @@ clean_doxygen_xml:
7980
rm -rf $(DOXYGEN_PICO_SDK_BUILD_DIR)
8081

8182
# create the sdk adoc and the json file
82-
$(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc: $(ASCIIDOC_DOXYGEN_DIR) $(DOXYGEN_XML_DIR)/index.xml doxygentoasciidoc/__main__.py doxygentoasciidoc/cli.py doxygentoasciidoc/nodes.py doxygentoasciidoc/helpers.py | $(BUILD_DIR)
83+
$(ASCIIDOC_DOXYGEN_DIR)/picosdk_index.json $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc: $(ASCIIDOC_DOXYGEN_DIR) $(DOXYGEN_XML_DIR)/index.xml $(DOXYGEN_TO_ASCIIDOC_DIR)/__main__.py $(DOXYGEN_TO_ASCIIDOC_DIR)/cli.py $(DOXYGEN_TO_ASCIIDOC_DIR)/nodes.py $(DOXYGEN_TO_ASCIIDOC_DIR)/helpers.py | $(BUILD_DIR) $(DOXYGEN_TO_ASCIIDOC_DIR)/requirements.txt
8384
$(MAKE) clean_ninja
84-
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/index.xml > $(ASCIIDOC_DOXYGEN_DIR)/all_groups.adoc
85-
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/indexpage.xml -c > $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
86-
python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/examples_page.xml -c > $(ASCIIDOC_DOXYGEN_DIR)/examples_page.adoc
85+
pip3 install -r $(DOXYGEN_TO_ASCIIDOC_DIR)/requirements.txt
86+
PYTHONPATH=$(DOXYGEN_TO_ASCIIDOC_DIR)/.. python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/index.xml -o $(ASCIIDOC_DOXYGEN_DIR)/all_groups.adoc
87+
PYTHONPATH=$(DOXYGEN_TO_ASCIIDOC_DIR)/.. python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/indexpage.xml -c -o $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
88+
PYTHONPATH=$(DOXYGEN_TO_ASCIIDOC_DIR)/.. python3 -m doxygentoasciidoc -f $(DOXYGEN_XML_DIR)/examples_page.xml -c -o $(ASCIIDOC_DOXYGEN_DIR)/examples_page.adoc
8789
python3 $(SCRIPTS_DIR)/postprocess_doxygen_adoc.py $(ASCIIDOC_DOXYGEN_DIR)
88-
-cp $(DOXYGEN_XML_DIR)/*.png $(ASCIIDOC_DOXYGEN_DIR)
90+
-cp $(DOXYGEN_XML_DIR)/*.png $(ASCIIDOC_DOXYGEN_DIR) 2>/dev/null || true
8991

9092
build_doxygen_adoc: $(ASCIIDOC_DOXYGEN_DIR)/index_doxygen.adoc
9193

@@ -94,7 +96,7 @@ clean_doxygen_adoc:
9496
if [ -d $(ASCIIDOC_DOXYGEN_DIR) ]; then $(MAKE) clean_ninja; fi
9597
rm -rf $(ASCIIDOC_DOXYGEN_DIR)
9698

97-
clean_everything: clean_submodules clean_doxygen_html clean
99+
clean_everything: clean_submodules clean_doxygen_xml clean
98100

99101
# AUTO_NINJABUILD contains all the parts of the ninjabuild where the rules themselves depend on other files
100102
$(AUTO_NINJABUILD): $(SCRIPTS_DIR)/create_auto_ninjabuild.py $(DOCUMENTATION_INDEX) $(SITE_CONFIG) | $(BUILD_DIR)

doxygentoasciidoc

Lines changed: 0 additions & 1 deletion
This file was deleted.

lib/doxygentoasciidoc

Submodule doxygentoasciidoc added at 278bc08

scripts/create_build_adoc_doxygen.py

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,8 @@ def check_no_markdown(filename):
1616
asciidoc = re.sub(r'----\n.*?\n----', '', asciidoc, flags=re.DOTALL)
1717
# strip out pass-through blocks
1818
asciidoc = re.sub(r'\+\+\+\+\n.*?\n\+\+\+\+', '', asciidoc, flags=re.DOTALL)
19-
# This is messing up the c code blocks
20-
# if re.search(r'(?:^|\n)#+', asciidoc):
21-
# raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename))
19+
if re.search(r'(?:^|\n)#+', asciidoc):
20+
raise Exception("{} contains a Markdown-style header (i.e. '#' rather than '=')".format(filename))
2221
if re.search(r'(\[.+?\]\(.+?\))', asciidoc):
2322
raise Exception("{} contains a Markdown-style link (i.e. '[title](url)' rather than 'url[title]')".format(filename))
2423

scripts/create_output_supplemental_data.py

Lines changed: 17 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -6,24 +6,24 @@
66
import re
77

88
def get_release_version(doxyfile_path):
9-
version = "unknown"
10-
with open(doxyfile_path) as f:
11-
doxy_content = f.read()
12-
version_search = re.search(r"(\nPROJECT_NUMBER\s*=\s*)([\d.]+)", doxy_content)
13-
if version_search is not None:
14-
version = version_search.group(2)
15-
return version
9+
version = "unknown"
10+
with open(doxyfile_path) as f:
11+
doxy_content = f.read()
12+
version_search = re.search(r"(\nPROJECT_NUMBER\s*=\s*)([\d.]+)", doxy_content)
13+
if version_search is not None:
14+
version = version_search.group(2)
15+
return version
1616

1717
def write_new_data_file(output_json_file, data_obj):
18-
f = open(output_json_file, 'w')
19-
f.write(json.dumps(data_obj))
20-
f.close()
18+
f = open(output_json_file, 'w')
19+
f.write(json.dumps(data_obj))
20+
f.close()
2121

2222
if __name__ == "__main__":
23-
# read the doxygen config file
24-
doxyfile_path = sys.argv[1]
25-
# output the new data file
26-
output_json_file = sys.argv[2]
27-
version = get_release_version(doxyfile_path)
28-
data_obj = {"pico_sdk_release": version}
29-
write_new_data_file(output_json_file, data_obj)
23+
# read the doxygen config file
24+
doxyfile_path = sys.argv[1]
25+
# output the new data file
26+
output_json_file = sys.argv[2]
27+
version = get_release_version(doxyfile_path)
28+
data_obj = {"pico_sdk_release": version}
29+
write_new_data_file(output_json_file, data_obj)

0 commit comments

Comments
 (0)