Skip to content

Commit 718c61d

Browse files
Move docs content into a separate dir
and update the script to work outside of scripts dir.
1 parent e83ee34 commit 718c61d

File tree

15 files changed

+41
-20
lines changed

15 files changed

+41
-20
lines changed

.github/workflows/docs.yml

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -41,13 +41,15 @@ jobs:
4141
run: echo "$HOME/.local/bin" >> $GITHUB_PATH
4242

4343
- name: Build the documentation
44-
working-directory: scripts
45-
run: python3 generate_docs.py
44+
run: |
45+
mkdir build
46+
cd build
47+
python3 ../docs/generate_docs.py
4648
4749
- name: Upload artifact
4850
uses: actions/upload-pages-artifact@0252fc4ba7626f0298f0cf00902a25c6afc77fa8 # v3.0.0
4951
with:
50-
path: docs/html
52+
path: build/docs_build/generated/html
5153

5254
deploy:
5355
name: Deploy docs to GitHub Pages

.github/workflows/reusable_docs_build.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,5 +30,7 @@ jobs:
3030
python3 -m pip install -r third_party/requirements.txt
3131
3232
- name: Build the documentation
33-
working-directory: scripts
34-
run: python3 generate_docs.py
33+
run: |
34+
mkdir build
35+
cd build
36+
python3 ../docs/generate_docs.py

.gitignore

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ __pycache__/
5858
*.py[cod]
5959

6060
# Generated docs
61-
docs/
61+
docs_build/
6262

6363
# Build files
6464
/build*/

RELEASE_STEPS.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ Do changes for a release:
4141
- For major releases mention API and ABI compatibility with the previous release
4242
- Update project's version in a few places:
4343
- For major and minor releases: `UMF_VERSION_CURRENT` in `include/umf/base.h` (the API version)
44-
- `release` variable in `scripts/docs_config/conf.py` (for docs)
44+
- `release` variable in `docs/config/conf.py` (for docs)
4545
- `UMF_VERSION` variable in `.github/workflows/reusable_basic.yml` (for installation test)
4646
- For major releases update ABI version in `.map` and `.def` files
4747
- These files are defined for all public libraries (`libumf` and `proxy_lib`, at the moment)

docs/README.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
To generate HTML documentation run the `generate_docs.py` script from the `build` dir.
2+
It will create extra `./docs_build` directory, where the intermediate and final files
3+
will be created. HTML docs will be in the `./docs_build/generated/html` directory.
4+
5+
The script requires:
6+
* [Doxygen](http://www.doxygen.nl/) at least v1.9.1
7+
* [Python](https://www.python.org/downloads/) at least v3.8
8+
* and python pip requirements, as defined in `third_party/requirements.txt`

scripts/docs_config/Doxyfile renamed to docs/config/Doxyfile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2058,7 +2058,7 @@ GENERATE_XML = YES
20582058
# The default directory is: xml.
20592059
# This tag requires that the tag GENERATE_XML is set to YES.
20602060

2061-
XML_OUTPUT = ../docs/xml
2061+
XML_OUTPUT = docs_build/doxyxml
20622062

20632063
# If the XML_PROGRAMLISTING tag is set to YES, doxygen will dump the program
20642064
# listings (including syntax highlighting and cross-referencing information) to
File renamed without changes.

scripts/docs_config/conf.py renamed to docs/config/conf.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
# -- Extension configuration -------------------------------------------------
5050

5151
# -- Options for breathe extension -------------------------------------------
52-
breathe_projects = {project: "../../docs/xml"}
52+
# 'doxyxml' dir is generated with Doxygen; it's supposed to be in a directory
53+
# one above the config directory.
54+
breathe_projects = {project: "../doxyxml"}
5355
breathe_default_project = project
5456
breathe_show_include = False
5557
breathe_default_members = ("members", "undoc-members")
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

scripts/generate_docs.py renamed to docs/generate_docs.py

Lines changed: 18 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -6,17 +6,20 @@
66
"""
77

88
from pathlib import Path
9-
from shutil import rmtree
9+
from shutil import rmtree, copytree
1010
import subprocess # nosec B404
1111
import time
1212

1313

1414
def _check_cwd() -> None:
15-
script_path = Path(__file__).resolve().parent
1615
cwd = Path.cwd()
17-
if script_path != cwd:
16+
include_dir = Path(cwd, "../include")
17+
# Verify if include dir is one level up (as defined in Doxyfile)
18+
if not include_dir.exists():
1819
print(
19-
f"{__file__} script has to be run from the 'scripts' directory. Terminating..."
20+
f"Include directory {include_dir.resolve()} not found! "
21+
"Please run this script from <repo_root_dir>/build!",
22+
flush=True,
2023
)
2124
exit(1)
2225

@@ -66,8 +69,17 @@ def _generate_html(config_path: Path, docs_path: Path) -> None:
6669

6770
def main() -> None:
6871
_check_cwd()
69-
config_path = Path("docs_config").resolve()
70-
docs_path = Path("..", "docs").resolve()
72+
73+
script_dir = Path(__file__).resolve().parent
74+
docs_build_path = Path("docs_build").resolve()
75+
76+
# Sphinx and breathe require access to a Doxygen generated dir ('doxyxml')
77+
# so we copy the whole content of the 'docs' dir to the build dir.
78+
copytree(Path(script_dir), docs_build_path, dirs_exist_ok=True)
79+
80+
config_path = Path(docs_build_path, "config").resolve()
81+
docs_path = Path(docs_build_path, "generated").resolve()
82+
7183
start = time.time()
7284
_prepare_docs_dir(docs_path)
7385
_generate_xml(config_path, docs_path)

scripts/README.md

Lines changed: 0 additions & 5 deletions
This file was deleted.

0 commit comments

Comments
 (0)