Skip to content

Commit 71d8ffc

Browse files
authored
Fix broken Dokka API Doc links on brand new website (google#2533)
1 parent a7ae309 commit 71d8ffc

File tree

8 files changed

+36
-16
lines changed

8 files changed

+36
-16
lines changed

.gitignore

+4
Original file line numberDiff line numberDiff line change
@@ -90,3 +90,7 @@ lint/tmp/
9090
# Note: The docs/ directory is our SOURCE (in MD),
9191
# and the site/ directory is our TARGET (in HTML)
9292
site/
93+
# but the Dokka API Doc is generated into docs/
94+
# (which is slightly confusing, but helps mkdocs to validate links)
95+
# so we ignore that here, as it's a built artifact that should not be committed
96+
docs/use/api/*/**

build-docs.bash

+5-8
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,12 @@ set -euox pipefail
2020
rm -rf site/
2121
mkdir -p site/
2222

23+
# We need to generate the Dokka API Doc into docs/use/api/ *before* running mkdocs,
24+
# so that it can validate the links to it and make sure that they are not broken.
25+
./gradlew dokkaHtml
26+
2327
# "install --deploy" is better than "sync", because it checks that the Pipfile.lock
2428
# is up-to-date with the Pipfile before installing. If it's not, it will fail the
2529
# installation. This is useful for ensuring strict dependency control during CI.
2630
pipenv install --deploy
27-
pipenv run mkdocs build
28-
29-
./gradlew dokkaHtml
30-
mkdir -p site/api/
31-
mv docs/data-capture site/api/
32-
mv docs/engine site/api/
33-
mv docs/knowledge site/api/
34-
mv docs/workflow site/api/
31+
pipenv run mkdocs build --strict

datacapture/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -123,7 +123,7 @@ dependencies {
123123

124124
tasks.dokkaHtml.configure {
125125
outputDirectory.set(
126-
file("../docs/${Releases.DataCapture.artifactId}/${Releases.DataCapture.version}"),
126+
file("../docs/use/api/${Releases.DataCapture.artifactId}/${Releases.DataCapture.version}"),
127127
)
128128
suppressInheritedMembers.set(true)
129129
dokkaSourceSets {

docs/use/api.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# API
22

3-
* [Engine](/api/engine/1.0.0/)
4-
* [Data Capture](/data-capture/1.1.0/)
5-
* [Workflow](/api/workflow/0.1.0-alpha04/)
6-
* [Knowledge](/api/knowledge/0.1.0-alpha03/)
3+
* [Engine](api/engine/1.0.0/index.html)
4+
* [Data Capture](api/data-capture/1.1.0/index.html)
5+
* [Workflow](api/workflow/0.1.0-alpha04/index.html)
6+
* [Knowledge](api/knowledge/0.1.0-alpha03/index.html)

engine/build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -158,7 +158,9 @@ dependencies {
158158
}
159159

160160
tasks.dokkaHtml.configure {
161-
outputDirectory.set(file("../docs/${Releases.Engine.artifactId}/${Releases.Engine.version}"))
161+
outputDirectory.set(
162+
file("../docs/use/api/${Releases.Engine.artifactId}/${Releases.Engine.version}"),
163+
)
162164
suppressInheritedMembers.set(true)
163165
dokkaSourceSets {
164166
named("main") {

knowledge/build.gradle.kts

+1-1
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ dependencies {
113113

114114
tasks.dokkaHtml.configure {
115115
outputDirectory.set(
116-
file("../docs/${Releases.Knowledge.artifactId}/${Releases.Knowledge.version}"),
116+
file("../docs/use/api/${Releases.Knowledge.artifactId}/${Releases.Knowledge.version}"),
117117
)
118118
suppressInheritedMembers.set(true)
119119
dokkaSourceSets {

mkdocs.yaml

+15
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ edit_uri: blob/master/docs/
55
copyright: Copyright 2024 The Android FHIR SDK Authors
66

77
nav:
8+
- Home: index.md
89
- Users:
910
- API: use/api.md
1011
- Contributors:
@@ -36,3 +37,17 @@ plugins:
3637
- git-revision-date-localized
3738
- minify:
3839
minify_html: true
40+
41+
# https://www.mkdocs.org/user-guide/configuration/#validation
42+
# Nota Bene: There is no "error" level in MkDocs, but the build-docs.bash script
43+
# uses "mkdocs build --strict", which cause MkDocs to abort the build on any warnings.
44+
validation:
45+
nav:
46+
not_found: warn
47+
absolute_links: warn
48+
omitted_files: warn
49+
links:
50+
anchors: warn
51+
not_found: warn
52+
absolute_links: warn
53+
unrecognized_links: warn

workflow/build.gradle.kts

+3-1
Original file line numberDiff line numberDiff line change
@@ -122,7 +122,9 @@ dependencies {
122122
}
123123

124124
tasks.dokkaHtml.configure {
125-
outputDirectory.set(file("../docs/${Releases.Workflow.artifactId}/${Releases.Workflow.version}"))
125+
outputDirectory.set(
126+
file("../docs/use/api/${Releases.Workflow.artifactId}/${Releases.Workflow.version}"),
127+
)
126128
suppressInheritedMembers.set(true)
127129
dokkaSourceSets {
128130
named("main") {

0 commit comments

Comments
 (0)