sphinx-java-autodoc 0.2.1__tar.gz → 0.4.0__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/.gitignore +1 -0
- sphinx_java_autodoc-0.4.0/CONTRIBUTING.md +88 -0
- sphinx_java_autodoc-0.4.0/PKG-INFO +87 -0
- sphinx_java_autodoc-0.4.0/README.md +57 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/SECURITY.md +2 -2
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/agents/domain.md +1 -1
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/alternatives.rst +5 -8
- sphinx_java_autodoc-0.4.0/docs/build-integration.rst +183 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/compatibility.rst +13 -28
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/conf.py +17 -1
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/design.rst +0 -8
- sphinx_java_autodoc-0.4.0/docs/gallery/comments.rst +65 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/declarations.rst +92 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/directives.rst +86 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/index.rst +41 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/inheritance.rst +31 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/links.rst +69 -0
- sphinx_java_autodoc-0.4.0/docs/gallery/warnings.rst +45 -0
- sphinx_java_autodoc-0.4.0/docs/getting-started.rst +85 -0
- sphinx_java_autodoc-0.4.0/docs/guide.rst +69 -0
- sphinx_java_autodoc-0.4.0/docs/index.rst +54 -0
- sphinx_java_autodoc-0.4.0/docs/javadoc-support.rst +80 -0
- sphinx_java_autodoc-0.4.0/docs/performance.rst +47 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/schema.md +26 -14
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/showcase.rst +5 -3
- sphinx_java_autodoc-0.4.0/docs/troubleshooting.rst +59 -0
- sphinx_java_autodoc-0.4.0/docs/usage.rst +201 -0
- sphinx_java_autodoc-0.4.0/examples/README.md +24 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/Point.java +1 -1
- sphinx_java_autodoc-0.4.0/examples/standalone/src/demo/Shape.java +8 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/Transformer.java +13 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/Widget.java +3 -2
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/pyproject.toml +1 -1
- sphinx_java_autodoc-0.4.0/src/sphinx_java_autodoc/__init__.py +118 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/__main__.py +14 -4
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/domain.py +84 -14
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/extractor.py +21 -8
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/java/SphinxDoclet.java +268 -65
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/model.py +11 -0
- sphinx_java_autodoc-0.2.1/src/sphinx_java_autodoc/__init__.py → sphinx_java_autodoc-0.4.0/src/sphinx_java_autodoc/pages.py +14 -113
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/render.py +23 -3
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/benchmark.py +2 -3
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_boundaries.py +23 -13
- sphinx_java_autodoc-0.4.0/tests/test_conformance.py +235 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_generic_throws.py +7 -10
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_integration.py +124 -63
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_navigation.py +12 -5
- sphinx_java_autodoc-0.4.0/tests/test_options.py +87 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_signatures.py +29 -8
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_snippets.py +4 -7
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_sourcepath.py +5 -6
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_tables.py +2 -3
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_value.py +4 -6
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/visual_check.py +1 -1
- sphinx_java_autodoc-0.2.1/CONTRIBUTING.md +0 -125
- sphinx_java_autodoc-0.2.1/PKG-INFO +0 -110
- sphinx_java_autodoc-0.2.1/README.md +0 -80
- sphinx_java_autodoc-0.2.1/docs/build-integration.rst +0 -240
- sphinx_java_autodoc-0.2.1/docs/getting-started.rst +0 -112
- sphinx_java_autodoc-0.2.1/docs/guide.rst +0 -96
- sphinx_java_autodoc-0.2.1/docs/index.rst +0 -58
- sphinx_java_autodoc-0.2.1/docs/javadoc-support.rst +0 -90
- sphinx_java_autodoc-0.2.1/docs/performance.rst +0 -74
- sphinx_java_autodoc-0.2.1/docs/roadmap.md +0 -18
- sphinx_java_autodoc-0.2.1/docs/troubleshooting.rst +0 -82
- sphinx_java_autodoc-0.2.1/docs/usage.rst +0 -183
- sphinx_java_autodoc-0.2.1/examples/README.md +0 -27
- sphinx_java_autodoc-0.2.1/tests/test_conformance.py +0 -93
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/LICENSE +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/adr/0001-jdk-doclet-xml-sphinx-domain.md +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/docs/agents/issue-tracker.md +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/build-consumer/BuildInfo.java.in +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/build-consumer/src/demo/Consumer.java +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/dependency/src/vendor/Token.java +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/gradle/build.gradle +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/gradle/settings.gradle +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/maven/pom.xml +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/docs/conf.py +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/docs/guide.rst +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/docs/index.rst +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/docs/reference.rst +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/Label.java +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/Mode.java +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/examples/standalone/src/demo/package-info.java +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/javadoc.py +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/src/sphinx_java_autodoc/static/java-autodoc.css +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/build_tools_check.py +0 -0
- {sphinx_java_autodoc-0.2.1 → sphinx_java_autodoc-0.4.0}/tests/test_javadoc.py +0 -0
|
@@ -0,0 +1,88 @@
|
|
|
1
|
+
# Development
|
|
2
|
+
|
|
3
|
+
Install [uv](https://docs.astral.sh/uv/getting-started/installation/) and Temurin
|
|
4
|
+
JDK 25, with `java`, `javac` and `javadoc` on `PATH`.
|
|
5
|
+
|
|
6
|
+
```sh
|
|
7
|
+
uv sync --locked
|
|
8
|
+
uv run --locked pre-commit install
|
|
9
|
+
uv run --locked pre-commit run --all-files
|
|
10
|
+
uv run --locked pytest -q
|
|
11
|
+
uv run --locked --group showcase python showcase/build.py
|
|
12
|
+
uv run --locked sphinx-build -W --keep-going -n docs docs/_build/html
|
|
13
|
+
uv build
|
|
14
|
+
uv run --locked twine check --strict dist/*
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
Build the showcase before the docs, because the docs link into it.
|
|
18
|
+
`showcase/build.py` fetches the pinned Apache Commons Lang commit, builds it in
|
|
19
|
+
Furo, Read the Docs, Alabaster and Lumina under `build/showcase/commons-lang/html/<theme>/`,
|
|
20
|
+
and fails when a warning category exceeds the baseline in
|
|
21
|
+
`showcase/commons-lang/showcase.json`. Record lower counts with `--update-baseline`;
|
|
22
|
+
an increase needs a deliberate baseline update in the same change.
|
|
23
|
+
|
|
24
|
+
The pre-commit hooks also run in CI. They cover Ruff, google-java-format for the
|
|
25
|
+
doclet, `javac -Xlint:all -Werror`, actionlint, zizmor, typos, RST checks and
|
|
26
|
+
`uv.lock` freshness. Commit messages need conventional prefixes (`feat:`, `fix:`,
|
|
27
|
+
`docs:`), and direct commits to `main` are rejected. Hooks with `--fix` rewrite
|
|
28
|
+
files; review and stage their changes.
|
|
29
|
+
|
|
30
|
+
Update dependencies with `uv lock --upgrade` and commit `uv.lock` together with
|
|
31
|
+
`pyproject.toml`. Dependabot opens weekly updates after a seven-day cooldown.
|
|
32
|
+
|
|
33
|
+
## Browser checks
|
|
34
|
+
|
|
35
|
+
```sh
|
|
36
|
+
uv sync --locked --extra test --group showcase
|
|
37
|
+
uv run --locked --extra test --group showcase playwright install chromium
|
|
38
|
+
for theme in alabaster classic furo sphinx_rtd_theme lumina; do
|
|
39
|
+
output=$theme; [ "$theme" = alabaster ] && output=html
|
|
40
|
+
uv run --locked --extra test --group showcase sphinx-build -W --keep-going -n \
|
|
41
|
+
-D "html_theme=$theme" examples/standalone/docs "examples/standalone/docs/_build/$output"
|
|
42
|
+
done
|
|
43
|
+
uv run --locked --extra test --group showcase python tests/visual_check.py
|
|
44
|
+
```
|
|
45
|
+
|
|
46
|
+
The checks render `examples/standalone/docs` at desktop and mobile widths in each
|
|
47
|
+
theme, including the search page, and fail on page errors or when API pages are
|
|
48
|
+
wider than the theme's own layout (measured on `reference.rst`).
|
|
49
|
+
|
|
50
|
+
## Other checks
|
|
51
|
+
|
|
52
|
+
- `uv run --locked python tests/build_tools_check.py` runs the Maven and Gradle
|
|
53
|
+
consumer builds. It needs both tools on `PATH`, or `--maven`/`--gradle` paths.
|
|
54
|
+
- `uv run --locked python tests/benchmark.py /prepared/source/root` times a real
|
|
55
|
+
project; see `docs/performance.rst`.
|
|
56
|
+
|
|
57
|
+
The required `All checks` status covers all of the above except the benchmark.
|
|
58
|
+
Passing CI does not widen `docs/compatibility.rst`; update that page only when a
|
|
59
|
+
new environment has actually passed.
|
|
60
|
+
|
|
61
|
+
# Releases
|
|
62
|
+
|
|
63
|
+
[Release Please](https://github.com/googleapis/release-please) opens a release PR
|
|
64
|
+
from the conventional commits on `main`. The PR bumps the version in
|
|
65
|
+
`pyproject.toml`, `src/sphinx_java_autodoc/extractor.py` and `uv.lock`, and updates
|
|
66
|
+
`CHANGELOG.md`. Before 1.0, `feat:` and breaking changes bump the minor version.
|
|
67
|
+
A `Release-As: 0.3.0` commit footer sets the version explicitly.
|
|
68
|
+
|
|
69
|
+
To release, merge the release PR once `All checks` passes. Release Please tags the
|
|
70
|
+
merge commit and dispatches the Release workflow, which reruns CI on the tag,
|
|
71
|
+
publishes to PyPI with attestations and publishes the GitHub release. Published
|
|
72
|
+
versions are immutable; fix a bad release with a new version. To retry, rerun the
|
|
73
|
+
failed jobs, or dispatch Release manually on the existing tag.
|
|
74
|
+
|
|
75
|
+
PyPI accepts uploads through a
|
|
76
|
+
[trusted publisher](https://docs.pypi.org/trusted-publishers/adding-a-publisher/),
|
|
77
|
+
so no API token is stored:
|
|
78
|
+
|
|
79
|
+
| Field | Value |
|
|
80
|
+
| --- | --- |
|
|
81
|
+
| PyPI project name | `sphinx-java-autodoc` |
|
|
82
|
+
| GitHub owner | `r4sky0` |
|
|
83
|
+
| Repository | `sphinx-java-autodoc` |
|
|
84
|
+
| Workflow filename | `release.yml` |
|
|
85
|
+
| Environment | `pypi` |
|
|
86
|
+
|
|
87
|
+
GitHub Pages publishes the docs from each successful `main` build. Same-repository
|
|
88
|
+
PRs get a preview at `pr-preview/pr-<number>/` after CI passes.
|
|
@@ -0,0 +1,87 @@
|
|
|
1
|
+
Metadata-Version: 2.5
|
|
2
|
+
Name: sphinx-java-autodoc
|
|
3
|
+
Version: 0.4.0
|
|
4
|
+
Summary: Compiler-backed Java API documentation in native Sphinx nodes
|
|
5
|
+
Project-URL: Documentation, https://r4sky0.github.io/sphinx-java-autodoc/
|
|
6
|
+
Project-URL: Repository, https://github.com/r4sky0/sphinx-java-autodoc
|
|
7
|
+
Project-URL: Issues, https://github.com/r4sky0/sphinx-java-autodoc/issues
|
|
8
|
+
Project-URL: Changelog, https://github.com/r4sky0/sphinx-java-autodoc/releases
|
|
9
|
+
Author: Ralph Offinger
|
|
10
|
+
License-Expression: MIT
|
|
11
|
+
License-File: LICENSE
|
|
12
|
+
Keywords: autodoc,documentation,java,javadoc,sphinx
|
|
13
|
+
Classifier: Development Status :: 3 - Alpha
|
|
14
|
+
Classifier: Framework :: Sphinx :: Extension
|
|
15
|
+
Classifier: Intended Audience :: Developers
|
|
16
|
+
Classifier: Operating System :: OS Independent
|
|
17
|
+
Classifier: Programming Language :: Java
|
|
18
|
+
Classifier: Programming Language :: Python :: 3 :: Only
|
|
19
|
+
Classifier: Programming Language :: Python :: 3.12
|
|
20
|
+
Classifier: Programming Language :: Python :: 3.13
|
|
21
|
+
Classifier: Programming Language :: Python :: 3.14
|
|
22
|
+
Classifier: Topic :: Documentation :: Sphinx
|
|
23
|
+
Requires-Python: >=3.12
|
|
24
|
+
Requires-Dist: sphinx<9.2,>=9.1
|
|
25
|
+
Provides-Extra: test
|
|
26
|
+
Requires-Dist: build>=1; extra == 'test'
|
|
27
|
+
Requires-Dist: playwright>=1.50; extra == 'test'
|
|
28
|
+
Requires-Dist: pytest>=8; extra == 'test'
|
|
29
|
+
Description-Content-Type: text/markdown
|
|
30
|
+
|
|
31
|
+
# sphinx-java-autodoc
|
|
32
|
+
|
|
33
|
+
[](https://github.com/r4sky0/sphinx-java-autodoc/actions/workflows/ci.yml)
|
|
34
|
+
[](https://pypi.org/project/sphinx-java-autodoc/)
|
|
35
|
+
[Documentation](https://r4sky0.github.io/sphinx-java-autodoc/)
|
|
36
|
+
|
|
37
|
+
Publish your Java library's guides and API reference in one searchable Sphinx
|
|
38
|
+
site. `sphinx-java-autodoc` reads your Java sources and Javadoc comments with the
|
|
39
|
+
JDK compiler APIs and renders them as native Sphinx content:
|
|
40
|
+
|
|
41
|
+
- Generated pages for classes, interfaces, enums, records, annotation types and
|
|
42
|
+
nested types.
|
|
43
|
+
- Signatures, overloads, Javadoc links and inherited method documentation.
|
|
44
|
+
- Class excerpts in handwritten guides, and cross-project links through intersphinx.
|
|
45
|
+
- Content-based caching: pages refresh when sources change.
|
|
46
|
+
|
|
47
|
+
Extraction never runs application classes or annotation processors, and never
|
|
48
|
+
downloads Java dependencies. See the
|
|
49
|
+
[Apache Commons Lang example](https://r4sky0.github.io/sphinx-java-autodoc/showcase/commons-lang/alabaster/)
|
|
50
|
+
for the output.
|
|
51
|
+
|
|
52
|
+
## Requirements
|
|
53
|
+
|
|
54
|
+
Python 3.12+, Sphinx 9.1.x, and **JDK 25 for extraction**. Your library can keep
|
|
55
|
+
targeting Java 17 or 21. See
|
|
56
|
+
[compatibility and limits](https://r4sky0.github.io/sphinx-java-autodoc/compatibility.html).
|
|
57
|
+
|
|
58
|
+
## Quick start
|
|
59
|
+
|
|
60
|
+
```sh
|
|
61
|
+
uv add sphinx-java-autodoc
|
|
62
|
+
```
|
|
63
|
+
|
|
64
|
+
In `docs/conf.py`:
|
|
65
|
+
|
|
66
|
+
```python
|
|
67
|
+
extensions = ["sphinx_java_autodoc"]
|
|
68
|
+
java_sources = ["../src/main/java"]
|
|
69
|
+
java_release = "17"
|
|
70
|
+
java_generate = "api"
|
|
71
|
+
java_visibility = "public"
|
|
72
|
+
```
|
|
73
|
+
|
|
74
|
+
Add `api/index` to the toctree in `docs/index.rst`, then build:
|
|
75
|
+
|
|
76
|
+
```sh
|
|
77
|
+
uv run sphinx-build -W --keep-going -n docs docs/_build/html
|
|
78
|
+
```
|
|
79
|
+
|
|
80
|
+
Next: [the first-build walkthrough](https://r4sky0.github.io/sphinx-java-autodoc/getting-started.html),
|
|
81
|
+
[writing guides](https://r4sky0.github.io/sphinx-java-autodoc/guide.html),
|
|
82
|
+
[dependencies and CI](https://r4sky0.github.io/sphinx-java-autodoc/build-integration.html) and the
|
|
83
|
+
[configuration reference](https://r4sky0.github.io/sphinx-java-autodoc/usage.html).
|
|
84
|
+
|
|
85
|
+
## Development
|
|
86
|
+
|
|
87
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). [MIT licensed](LICENSE).
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
# sphinx-java-autodoc
|
|
2
|
+
|
|
3
|
+
[](https://github.com/r4sky0/sphinx-java-autodoc/actions/workflows/ci.yml)
|
|
4
|
+
[](https://pypi.org/project/sphinx-java-autodoc/)
|
|
5
|
+
[Documentation](https://r4sky0.github.io/sphinx-java-autodoc/)
|
|
6
|
+
|
|
7
|
+
Publish your Java library's guides and API reference in one searchable Sphinx
|
|
8
|
+
site. `sphinx-java-autodoc` reads your Java sources and Javadoc comments with the
|
|
9
|
+
JDK compiler APIs and renders them as native Sphinx content:
|
|
10
|
+
|
|
11
|
+
- Generated pages for classes, interfaces, enums, records, annotation types and
|
|
12
|
+
nested types.
|
|
13
|
+
- Signatures, overloads, Javadoc links and inherited method documentation.
|
|
14
|
+
- Class excerpts in handwritten guides, and cross-project links through intersphinx.
|
|
15
|
+
- Content-based caching: pages refresh when sources change.
|
|
16
|
+
|
|
17
|
+
Extraction never runs application classes or annotation processors, and never
|
|
18
|
+
downloads Java dependencies. See the
|
|
19
|
+
[Apache Commons Lang example](https://r4sky0.github.io/sphinx-java-autodoc/showcase/commons-lang/alabaster/)
|
|
20
|
+
for the output.
|
|
21
|
+
|
|
22
|
+
## Requirements
|
|
23
|
+
|
|
24
|
+
Python 3.12+, Sphinx 9.1.x, and **JDK 25 for extraction**. Your library can keep
|
|
25
|
+
targeting Java 17 or 21. See
|
|
26
|
+
[compatibility and limits](https://r4sky0.github.io/sphinx-java-autodoc/compatibility.html).
|
|
27
|
+
|
|
28
|
+
## Quick start
|
|
29
|
+
|
|
30
|
+
```sh
|
|
31
|
+
uv add sphinx-java-autodoc
|
|
32
|
+
```
|
|
33
|
+
|
|
34
|
+
In `docs/conf.py`:
|
|
35
|
+
|
|
36
|
+
```python
|
|
37
|
+
extensions = ["sphinx_java_autodoc"]
|
|
38
|
+
java_sources = ["../src/main/java"]
|
|
39
|
+
java_release = "17"
|
|
40
|
+
java_generate = "api"
|
|
41
|
+
java_visibility = "public"
|
|
42
|
+
```
|
|
43
|
+
|
|
44
|
+
Add `api/index` to the toctree in `docs/index.rst`, then build:
|
|
45
|
+
|
|
46
|
+
```sh
|
|
47
|
+
uv run sphinx-build -W --keep-going -n docs docs/_build/html
|
|
48
|
+
```
|
|
49
|
+
|
|
50
|
+
Next: [the first-build walkthrough](https://r4sky0.github.io/sphinx-java-autodoc/getting-started.html),
|
|
51
|
+
[writing guides](https://r4sky0.github.io/sphinx-java-autodoc/guide.html),
|
|
52
|
+
[dependencies and CI](https://r4sky0.github.io/sphinx-java-autodoc/build-integration.html) and the
|
|
53
|
+
[configuration reference](https://r4sky0.github.io/sphinx-java-autodoc/usage.html).
|
|
54
|
+
|
|
55
|
+
## Development
|
|
56
|
+
|
|
57
|
+
See [CONTRIBUTING.md](CONTRIBUTING.md). [MIT licensed](LICENSE).
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
# Security
|
|
2
2
|
|
|
3
|
-
Security fixes target the latest
|
|
4
|
-
|
|
3
|
+
Security fixes target the latest version published on
|
|
4
|
+
[PyPI](https://pypi.org/project/sphinx-java-autodoc/). Known limits are recorded in
|
|
5
5
|
`docs/compatibility.rst`.
|
|
6
6
|
|
|
7
7
|
Report vulnerabilities privately through
|
|
@@ -1,13 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
Compare with other tools
|
|
2
|
+
========================
|
|
3
3
|
|
|
4
4
|
Several tools put Java API documentation into Sphinx, and a plain Javadoc site is
|
|
5
|
-
always an option.
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
The other tools were assessed in October 2026 by reading their documentation and
|
|
9
|
-
source code, not by running them. If something here is out of date, please
|
|
10
|
-
`open an issue <https://github.com/r4sky0/sphinx-java-autodoc/issues>`_.
|
|
5
|
+
always an option. The other tools were assessed in October 2026 from their
|
|
6
|
+
documentation and source code, without running them. If something is out of date,
|
|
7
|
+
please `open an issue <https://github.com/r4sky0/sphinx-java-autodoc/issues>`_.
|
|
11
8
|
|
|
12
9
|
At a glance
|
|
13
10
|
-----------
|
|
@@ -0,0 +1,183 @@
|
|
|
1
|
+
Add dependencies and publish
|
|
2
|
+
============================
|
|
3
|
+
|
|
4
|
+
Extraction needs the same sources and dependencies as your Java compiler. The
|
|
5
|
+
extension never invokes Maven or Gradle, runs annotation processors or downloads
|
|
6
|
+
dependencies, so prepare those inputs before running Sphinx.
|
|
7
|
+
|
|
8
|
+
Choose where extraction runs
|
|
9
|
+
----------------------------
|
|
10
|
+
|
|
11
|
+
- **During Sphinx:** set ``java_sources`` and ``java_classpath`` in ``conf.py``.
|
|
12
|
+
The documentation builder needs JDK 25.
|
|
13
|
+
- **Before Sphinx:** run the ``sphinx-java-autodoc`` command in your Java build and
|
|
14
|
+
pass its XML to Sphinx with ``java_model``. The Sphinx job needs no JDK.
|
|
15
|
+
|
|
16
|
+
Dependencies and generated sources
|
|
17
|
+
----------------------------------
|
|
18
|
+
|
|
19
|
+
.. code-block:: python
|
|
20
|
+
|
|
21
|
+
java_sources = [
|
|
22
|
+
"../core/src/main/java",
|
|
23
|
+
"../client/src/main/java",
|
|
24
|
+
"../client/target/generated-sources/annotations",
|
|
25
|
+
]
|
|
26
|
+
java_classpath = ["../lib/dependency.jar", "../other-module/target/classes"]
|
|
27
|
+
java_sourcepath = ["../dependency-sources"]
|
|
28
|
+
java_generate = "api"
|
|
29
|
+
|
|
30
|
+
- ``java_sources`` takes several roots, so non-JPMS modules can share one site.
|
|
31
|
+
Leave out test sources unless they are part of your API.
|
|
32
|
+
- ``java_classpath`` lists JARs and class directories explicitly; wildcards are not
|
|
33
|
+
expanded. A missing dependency produces a compiler error naming the symbol.
|
|
34
|
+
- ``java_sourcepath`` adds dependency sources so their Javadoc can be inherited,
|
|
35
|
+
without generating pages for them. Its contents are part of the cache key.
|
|
36
|
+
- Generate sources (annotation processors, templates) in your build first.
|
|
37
|
+
Lombok-like AST transformations are not supported.
|
|
38
|
+
- JPMS ``module-info.java`` inputs are rejected; use non-modular source roots.
|
|
39
|
+
|
|
40
|
+
Extract before Sphinx
|
|
41
|
+
---------------------
|
|
42
|
+
|
|
43
|
+
With JDK 25, from your project root:
|
|
44
|
+
|
|
45
|
+
.. code-block:: console
|
|
46
|
+
|
|
47
|
+
sphinx-java-autodoc src/main/java --release 17 --warnings-as-errors \
|
|
48
|
+
--classpath-file build/classpath.txt --cache build/java-cache -o build/api.xml
|
|
49
|
+
|
|
50
|
+
Then, in ``docs/conf.py``, without ``java_sources``:
|
|
51
|
+
|
|
52
|
+
.. code-block:: python
|
|
53
|
+
|
|
54
|
+
extensions = ['sphinx_java_autodoc']
|
|
55
|
+
java_model = '../build/api.xml'
|
|
56
|
+
java_generate = 'api'
|
|
57
|
+
|
|
58
|
+
CLI paths are relative to the working directory. ``--classpath`` takes a
|
|
59
|
+
platform-separated path. ``--sourcepath`` and ``--exclude-package`` can repeat, and
|
|
60
|
+
``--encoding`` matches ``java_encoding``. If compilation or a
|
|
61
|
+
strict check fails, the previous output is kept. Your pipeline must rerun
|
|
62
|
+
extraction when sources change, since Sphinx only sees the model.
|
|
63
|
+
|
|
64
|
+
Maven
|
|
65
|
+
-----
|
|
66
|
+
|
|
67
|
+
Write the compile classpath with the
|
|
68
|
+
`dependency plugin <https://maven.apache.org/plugins/maven-dependency-plugin/build-classpath-mojo.html>`_,
|
|
69
|
+
then extract. With the repository's fixture:
|
|
70
|
+
|
|
71
|
+
.. code-block:: console
|
|
72
|
+
|
|
73
|
+
mvn -f examples/maven/pom.xml -DskipTests compile \
|
|
74
|
+
org.apache.maven.plugins:maven-dependency-plugin:3.11.0:build-classpath \
|
|
75
|
+
-Dmdep.includeScope=compile -Dmdep.outputFile=target/classpath.txt
|
|
76
|
+
sphinx-java-autodoc examples/standalone/src examples/build-consumer/src \
|
|
77
|
+
examples/maven/target/generated-sources/java-autodoc \
|
|
78
|
+
--classpath-file examples/maven/target/classpath.txt \
|
|
79
|
+
-o build/maven-api.xml --cache build/java-cache --warnings-as-errors
|
|
80
|
+
|
|
81
|
+
For your project, use ``src/main/java`` and your generated-source directories.
|
|
82
|
+
|
|
83
|
+
Gradle
|
|
84
|
+
------
|
|
85
|
+
|
|
86
|
+
Write ``sourceSets.main.compileClasspath.asPath`` to a UTF-8 file, then extract.
|
|
87
|
+
The fixture's ``examples/gradle/build.gradle`` has a ``writeJavaAutodocClasspath``
|
|
88
|
+
task for this:
|
|
89
|
+
|
|
90
|
+
.. code-block:: console
|
|
91
|
+
|
|
92
|
+
gradle -p examples/gradle classes writeJavaAutodocClasspath
|
|
93
|
+
sphinx-java-autodoc examples/standalone/src examples/build-consumer/src \
|
|
94
|
+
examples/gradle/build/generated/sources/java-autodoc \
|
|
95
|
+
--classpath-file examples/gradle/build/java-autodoc-classpath.txt \
|
|
96
|
+
-o build/gradle-api.xml --cache build/java-cache --warnings-as-errors
|
|
97
|
+
|
|
98
|
+
Both fixtures are verified by ``uv run --locked python tests/build_tools_check.py``;
|
|
99
|
+
see :doc:`compatibility` for the tested versions.
|
|
100
|
+
|
|
101
|
+
Publish the site from CI
|
|
102
|
+
------------------------
|
|
103
|
+
|
|
104
|
+
This GitHub Actions workflow builds on every push to ``main`` and deploys to
|
|
105
|
+
GitHub Pages. Set **Pages → Source** to **GitHub Actions** in the repository
|
|
106
|
+
settings, then save it as ``.github/workflows/docs.yml``:
|
|
107
|
+
|
|
108
|
+
.. code-block:: yaml
|
|
109
|
+
|
|
110
|
+
name: Documentation
|
|
111
|
+
on:
|
|
112
|
+
push:
|
|
113
|
+
branches: [main]
|
|
114
|
+
|
|
115
|
+
permissions:
|
|
116
|
+
contents: read
|
|
117
|
+
|
|
118
|
+
jobs:
|
|
119
|
+
build:
|
|
120
|
+
runs-on: ubuntu-latest
|
|
121
|
+
steps:
|
|
122
|
+
- uses: actions/checkout@v7
|
|
123
|
+
with:
|
|
124
|
+
persist-credentials: false
|
|
125
|
+
- uses: actions/setup-java@v6
|
|
126
|
+
with:
|
|
127
|
+
distribution: temurin
|
|
128
|
+
java-version: "25"
|
|
129
|
+
- uses: actions/setup-python@v7
|
|
130
|
+
with:
|
|
131
|
+
python-version: "3.12"
|
|
132
|
+
- run: python -m pip install sphinx-java-autodoc
|
|
133
|
+
# Prepare java_classpath inputs and generated sources here.
|
|
134
|
+
- run: sphinx-build -W --keep-going -n docs docs/_build/html
|
|
135
|
+
- uses: actions/upload-pages-artifact@v5
|
|
136
|
+
with:
|
|
137
|
+
path: docs/_build/html
|
|
138
|
+
|
|
139
|
+
deploy:
|
|
140
|
+
needs: build
|
|
141
|
+
runs-on: ubuntu-latest
|
|
142
|
+
permissions:
|
|
143
|
+
pages: write
|
|
144
|
+
id-token: write
|
|
145
|
+
environment:
|
|
146
|
+
name: github-pages
|
|
147
|
+
url: ${{ steps.deployment.outputs.page_url }}
|
|
148
|
+
steps:
|
|
149
|
+
- id: deployment
|
|
150
|
+
uses: actions/deploy-pages@v5
|
|
151
|
+
|
|
152
|
+
Each run builds into a clean directory, so removed types leave no stale pages.
|
|
153
|
+
The workflow passes ``actionlint`` but has not run in another repository.
|
|
154
|
+
|
|
155
|
+
Caching and parallel builds
|
|
156
|
+
---------------------------
|
|
157
|
+
|
|
158
|
+
Sphinx caches extraction under ``<doctreedir>/java-cache`` and keeps only the
|
|
159
|
+
current model. The CLI uses ``.java-autodoc-cache`` or ``--cache`` and never
|
|
160
|
+
removes old entries.
|
|
161
|
+
|
|
162
|
+
The cache key covers source and classpath contents, options, the JDK and the
|
|
163
|
+
extension version. Every build hashes these inputs, so edits are caught even when
|
|
164
|
+
timestamps are unchanged. Any change re-extracts the whole project and rereads
|
|
165
|
+
every Sphinx document.
|
|
166
|
+
|
|
167
|
+
``sphinx-build -j`` is supported. Separate Sphinx processes must not share a
|
|
168
|
+
generated-page directory.
|
|
169
|
+
|
|
170
|
+
Run the doclet directly
|
|
171
|
+
-----------------------
|
|
172
|
+
|
|
173
|
+
To run the bundled doclet without the Python wrapper's caching and safeguards.
|
|
174
|
+
Its ``--sphinx-exclude`` option takes excluded packages separated by commas:
|
|
175
|
+
|
|
176
|
+
.. code-block:: console
|
|
177
|
+
|
|
178
|
+
python -c "from sphinx_java_autodoc.extractor import DOCLET; print(DOCLET)"
|
|
179
|
+
javac -proc:none -encoding UTF-8 -d build/doclet /printed/path/SphinxDoclet.java
|
|
180
|
+
javadoc -quiet -encoding UTF-8 -protected \
|
|
181
|
+
-doclet sphinxjava.SphinxDoclet -docletpath build/doclet \
|
|
182
|
+
--sphinx-output build/api.xml -sourcepath src/main/java \
|
|
183
|
+
-classpath lib/dependency.jar com.example
|
|
@@ -1,16 +1,12 @@
|
|
|
1
1
|
Compatibility and limits
|
|
2
2
|
========================
|
|
3
3
|
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
What has been tested, and what is not supported. A configured CI job does not
|
|
5
|
+
count until it has passed.
|
|
6
6
|
|
|
7
7
|
Requirements and tested versions
|
|
8
8
|
--------------------------------
|
|
9
9
|
|
|
10
|
-
**Projects targeting Java 17, 21 and 25 are tested. Documentation extraction
|
|
11
|
-
requires JDK 25**, even when your library builds and runs on an older Java release.
|
|
12
|
-
Your library's own toolchain can stay as it is.
|
|
13
|
-
|
|
14
10
|
.. list-table::
|
|
15
11
|
:header-rows: 1
|
|
16
12
|
:widths: 25 30 45
|
|
@@ -47,17 +43,12 @@ Your library's own toolchain can stay as it is.
|
|
|
47
43
|
- Sphinx ``-j``
|
|
48
44
|
- ``-j 2``, with an inventory identical to ``-j 1``
|
|
49
45
|
|
|
50
|
-
Put JDK 25's ``java``, ``javac`` and ``javadoc`` on ``PATH``, or set ``java_jdk``
|
|
51
|
-
to its home directory. A site that only renders a pre-extracted model or consumes
|
|
52
|
-
another site's inventory needs no JDK.
|
|
53
|
-
|
|
54
46
|
Not tested
|
|
55
47
|
----------
|
|
56
48
|
|
|
57
49
|
* Other JDK runtimes, Sphinx releases, Firefox and WebKit, PDF/LaTeX and EPUB
|
|
58
50
|
builders.
|
|
59
|
-
* Large multi-module projects.
|
|
60
|
-
:doc:`performance`; its warnings prevent a claim of complete Javadoc fidelity.
|
|
51
|
+
* Large multi-module projects. :doc:`performance` records one single-library run.
|
|
61
52
|
* Availability of remote Javadoc sites behind ``java_external_javadoc`` URLs.
|
|
62
53
|
|
|
63
54
|
Known limits
|
|
@@ -71,9 +62,8 @@ Known limits
|
|
|
71
62
|
* Only declared members are shown. Non-overridden inherited methods stay on their
|
|
72
63
|
ancestor's page. Compiler-generated record and enum methods are listed, but the
|
|
73
64
|
standard doclet's generated prose for them is not synthesized.
|
|
74
|
-
*
|
|
75
|
-
|
|
76
|
-
declaration directives are not provided.
|
|
65
|
+
* Manual Java declaration directives are not provided; declarations come only
|
|
66
|
+
from the extracted model through the ``java:auto*`` directives.
|
|
77
67
|
* External links use the Javadoc 9+ URL structure; Javadoc 8 member anchors are not
|
|
78
68
|
supported. Roles mapped to external Javadoc without compiler metadata cannot
|
|
79
69
|
check that the symbol exists.
|
|
@@ -90,17 +80,12 @@ Evidence
|
|
|
90
80
|
--------
|
|
91
81
|
|
|
92
82
|
The `CI workflow <https://github.com/r4sky0/sphinx-java-autodoc/actions/workflows/ci.yml>`_
|
|
93
|
-
runs the operating system and Python matrix, the
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
|
|
98
|
-
locations, and confirm that extraction executes neither static initializers nor
|
|
99
|
-
annotation processors.
|
|
83
|
+
runs the operating system and Python matrix, the JDK and Sphinx integration tests
|
|
84
|
+
against the installed wheel, strict builds and Chromium checks in five themes. The
|
|
85
|
+
tests compare anchors with real standard-doclet output, check that the XML is
|
|
86
|
+
byte-identical across checkout locations, and check that extraction runs neither
|
|
87
|
+
static initializers nor annotation processors.
|
|
100
88
|
|
|
101
|
-
|
|
102
|
-
25.0.3, Python 3.12.13 and Sphinx 9.1.0 on macOS 26.4.1
|
|
103
|
-
|
|
104
|
-
classpath, extracted strictly, and passed a strict parallel Sphinx build with an
|
|
105
|
-
empty PATH. CI repeats the consumer check on Linux; its configured job alone is
|
|
106
|
-
not additional validation evidence.
|
|
89
|
+
The Maven and Gradle consumers last passed on 2026-10-11 with Maven 3.10.0,
|
|
90
|
+
Gradle 9.1.0, Temurin 25.0.3, Python 3.12.13 and Sphinx 9.1.0 on macOS 26.4.1
|
|
91
|
+
arm64, including a strict parallel Sphinx build with an empty ``PATH``.
|
|
@@ -5,7 +5,23 @@ from pathlib import Path
|
|
|
5
5
|
|
|
6
6
|
project = "Java autodoc"
|
|
7
7
|
release = distribution_version("sphinx-java-autodoc")
|
|
8
|
-
extensions = ["sphinx_java_autodoc", "sphinx.ext.intersphinx"]
|
|
8
|
+
extensions = ["sphinx_java_autodoc", "sphinx.ext.intersphinx", "sphinx.ext.linkcode"]
|
|
9
|
+
|
|
10
|
+
# The feature gallery documents the fixture API that the tests and browser checks use.
|
|
11
|
+
java_sources = ["../examples/standalone/src"]
|
|
12
|
+
java_generate = "gallery/api"
|
|
13
|
+
|
|
14
|
+
|
|
15
|
+
def linkcode_resolve(domain, info):
|
|
16
|
+
# shortcut: links follow main, so a pull request preview may point at older lines;
|
|
17
|
+
# pass the built commit in if previews need exact lines.
|
|
18
|
+
if domain == "java" and info["line"]:
|
|
19
|
+
return (
|
|
20
|
+
"https://github.com/r4sky0/sphinx-java-autodoc/blob/main/"
|
|
21
|
+
f"examples/standalone/src/{info['source']}#L{info['line']}"
|
|
22
|
+
)
|
|
23
|
+
return None
|
|
24
|
+
|
|
9
25
|
|
|
10
26
|
# The Java API shown here is the Commons Lang showcase, published next to these docs
|
|
11
27
|
# at showcase/commons-lang/<theme>/; guides link to the Furo version. Its inventory
|
|
@@ -1,9 +1,6 @@
|
|
|
1
1
|
How it works
|
|
2
2
|
============
|
|
3
3
|
|
|
4
|
-
For contributors and readers evaluating the implementation. To use the extension
|
|
5
|
-
in your library, start with :doc:`getting-started`.
|
|
6
|
-
|
|
7
4
|
Sphinx runs a small JDK doclet over your sources before reading documents. The
|
|
8
5
|
doclet uses the compiler's view of declarations, overloads and Javadoc links and
|
|
9
6
|
writes a versioned XML model. The extension turns that model into native Sphinx
|
|
@@ -17,15 +14,10 @@ dependencies, options and the JDK, so any change re-extracts the whole project.
|
|
|
17
14
|
Design records
|
|
18
15
|
--------------
|
|
19
16
|
|
|
20
|
-
These live in the repository:
|
|
21
|
-
|
|
22
17
|
* `Architecture decision and alternatives considered
|
|
23
18
|
<https://github.com/r4sky0/sphinx-java-autodoc/blob/main/docs/adr/0001-jdk-doclet-xml-sphinx-domain.md>`_
|
|
24
19
|
* `XML model schema
|
|
25
20
|
<https://github.com/r4sky0/sphinx-java-autodoc/blob/main/docs/schema.md>`_
|
|
26
|
-
* `Roadmap <https://github.com/r4sky0/sphinx-java-autodoc/blob/main/docs/roadmap.md>`_
|
|
27
|
-
|
|
28
|
-
Tested environments and known limits are on :doc:`compatibility`.
|
|
29
21
|
|
|
30
22
|
Contribute
|
|
31
23
|
----------
|
|
@@ -0,0 +1,65 @@
|
|
|
1
|
+
Javadoc comments
|
|
2
|
+
================
|
|
3
|
+
|
|
4
|
+
Comments are read from the compiler's comment trees and rendered as native Sphinx
|
|
5
|
+
content, so your theme styles them like any other page. Source comments are never
|
|
6
|
+
interpreted as reStructuredText, and no raw HTML is emitted.
|
|
7
|
+
|
|
8
|
+
HTML, inline tags and snippets
|
|
9
|
+
------------------------------
|
|
10
|
+
|
|
11
|
+
One class comment uses most of the supported content: paragraphs, emphasis, nested
|
|
12
|
+
lists, ``<pre>{@code ...}</pre>`` blocks, line breaks, external links, an inline
|
|
13
|
+
``{@snippet}``, a table with a caption, ``{@value}``, ``{@link}`` and
|
|
14
|
+
``{@linkplain}``, and the ``@see`` and ``@since`` tags.
|
|
15
|
+
|
|
16
|
+
.. literalinclude:: ../../examples/standalone/src/demo/Widget.java
|
|
17
|
+
:language: java
|
|
18
|
+
:start-at: /** A widget
|
|
19
|
+
:end-at: public class Widget
|
|
20
|
+
|
|
21
|
+
.. java:autoclass:: demo.Widget
|
|
22
|
+
:no-index:
|
|
23
|
+
|
|
24
|
+
Parameters, returns and exceptions
|
|
25
|
+
----------------------------------
|
|
26
|
+
|
|
27
|
+
``@param``, ``@return`` and ``@throws`` become fields. Type parameters get their own
|
|
28
|
+
field.
|
|
29
|
+
|
|
30
|
+
.. literalinclude:: ../../examples/standalone/src/demo/Widget.java
|
|
31
|
+
:language: java
|
|
32
|
+
:start-at: /** Builds a generic index.
|
|
33
|
+
:end-at: List<? extends T> values
|
|
34
|
+
|
|
35
|
+
.. java:automethod:: demo.Widget#buildIndex(java.util.List,java.util.Map)
|
|
36
|
+
:no-index:
|
|
37
|
+
|
|
38
|
+
API and implementation notes
|
|
39
|
+
----------------------------
|
|
40
|
+
|
|
41
|
+
The JDK's ``@apiNote``, ``@implSpec`` and ``@implNote`` tags use the standard
|
|
42
|
+
doclet's headings. ``@author`` and ``@version`` are left out, as the standard doclet
|
|
43
|
+
does by default.
|
|
44
|
+
|
|
45
|
+
.. literalinclude:: ../../examples/standalone/src/demo/Transformer.java
|
|
46
|
+
:language: java
|
|
47
|
+
:start-at: /** Transforms a value twice.
|
|
48
|
+
:end-at: default T twice
|
|
49
|
+
|
|
50
|
+
.. java:automethod:: demo.Transformer#twice(java.lang.Object)
|
|
51
|
+
:no-index:
|
|
52
|
+
|
|
53
|
+
Deprecation
|
|
54
|
+
-----------
|
|
55
|
+
|
|
56
|
+
``@deprecated`` produces the same notice as Sphinx's ``deprecated`` directive, and
|
|
57
|
+
the annotation stays in the signature.
|
|
58
|
+
|
|
59
|
+
.. literalinclude:: ../../examples/standalone/src/demo/Widget.java
|
|
60
|
+
:language: java
|
|
61
|
+
:start-at: /** Old entry point.
|
|
62
|
+
:end-at: public void old()
|
|
63
|
+
|
|
64
|
+
.. java:automethod:: demo.Widget#old()
|
|
65
|
+
:no-index:
|