Skip to content

Commit f3709eb

Browse files
committed
Use shell script for building docs
1 parent 5453a85 commit f3709eb

File tree

3 files changed

+41
-16
lines changed

3 files changed

+41
-16
lines changed

Dockerfile

+16-7
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,13 @@
1-
FROM gradle:8.13-jdk21 as build-docs
1+
#FROM gradle:8.13-jdk21 as build-docs
2+
#
3+
#WORKDIR /build/docs
4+
#
5+
#COPY . ./
6+
#
7+
#RUN ./gradlew dokkaHtml
28

3-
WORKDIR /build/docs
49

5-
COPY . ./
610

7-
RUN ./gradlew dokkaHtml
811

912
#FROM node:lts-alpine AS serve-docs
1013
#
@@ -15,10 +18,16 @@ RUN ./gradlew dokkaHtml
1518
#EXPOSE 8081
1619
#CMD ["http-server", ".", "--proxy", "http://localhost:8081"]
1720

18-
FROM busybox:1.37.0
21+
22+
23+
24+
FROM busybox:1.37.0 as build
1925
ENV PORT=8000
2026

21-
COPY --from=build-docs /build/docs/* /www/
27+
WORKDIR /app/javadocs
28+
29+
COPY . ./
30+
COPY --from=build ./build/javadocs /app/javadocs
2231
EXPOSE $PORT
2332

24-
CMD trap "exit 0;" TERM INT; httpd -v -p $PORT -h /www -f & wait
33+
CMD trap "exit 0;" TERM INT; httpd -v -p $PORT -h /www -f & wait

build.gradle.kts

+6-9
Original file line numberDiff line numberDiff line change
@@ -129,7 +129,6 @@ tasks {
129129
val docVersionsDir = projectDir.resolve("build/javadocs")
130130
val currentVersion = project.version.toString()
131131
val currentDocsDir = docVersionsDir.resolve(currentVersion)
132-
outputs.upToDateWhen { docVersionsDir.exists() }
133132

134133
outputDirectory.set(file(currentDocsDir))
135134

@@ -194,20 +193,18 @@ tasks {
194193
// \-- older
195194
//
196195
// The "older" directory contains all old versions, so we want to
197-
// delete the top-level older versions and move everything inside the
198-
// latest directory to the top level so the GitHub actions workflow
199-
// doesn't need to figure out the correct version name
196+
// delete the top-level older versions.
200197

201198
docVersionsDir.listFiles()?.forEach {
202199
if (it.name != version)
203200
it.deleteRecursively()
204201
}
205202

206-
val latestVersionDir = docVersionsDir.listFiles()!!.single()
207-
latestVersionDir.listFiles()!!.forEach {
208-
it.renameTo(File(it.parentFile.parentFile, it.name))
209-
}
210-
latestVersionDir.deleteRecursively()
203+
// val latestVersionDir = docVersionsDir.listFiles()!!.single()
204+
// latestVersionDir.listFiles()!!.forEach {
205+
// it.renameTo(File(it.parentFile.parentFile, it.name))
206+
// }
207+
// latestVersionDir.deleteRecursively()
211208
}
212209
}
213210
}

scripts/buildDocs.sh

+19
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,19 @@
1+
#!/bin/bash
2+
3+
#JAVADOCS_ARCHIVE_PATH="/apps/storage/javadocs-archive"
4+
JAVADOCS_ARCHIVE_PATH="../javadocs-archive"
5+
BUILD_DIR="./build/javadocs"
6+
7+
if [[ -d "$JAVADOCS_ARCHIVE_PATH" ]]; then
8+
cp -r "$JAVADOCS_ARCHIVE_PATH" .
9+
fi
10+
11+
./gradlew dokkaHtml
12+
13+
# Copy build docs back into archive folder
14+
output_dir=$(find "$BUILD_DIR" -mindepth 1 -maxdepth 1 -type d | head -n 1)
15+
cp -r "$output_dir" "$JAVADOCS_ARCHIVE_PATH"
16+
17+
# Remove the version name from the hierarchy so the Dockerfile doesn't need to worry about it
18+
cp -r "$output_dir"/* "$BUILD_DIR"
19+
rm -rf "$output_dir"

0 commit comments

Comments
 (0)