-
Notifications
You must be signed in to change notification settings - Fork 3
/
Makefile
111 lines (89 loc) · 3.9 KB
/
Makefile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
# Make Akka SDK for Java documentation
SHELL_DIR := $(shell dirname $(realpath $(lastword $(MAKEFILE_LIST))))
ROOT_DIR := ${SHELL_DIR}
TARGET_DIR := ${ROOT_DIR}/target/site
upstream := akka/akka-sdk
branch := docs/current
sources := src build/src/managed
src_managed := docs/src-managed
java_managed_attachments := ${src_managed}/modules/java/attachments
java_managed_examples := ${src_managed}/modules/java/examples
managed_partials := ${src_managed}/modules/ROOT/partials
antora_docker_image := local/antora-doc
antora_docker_image_tag := latest
BASE_PATH := $(shell git rev-parse --show-prefix)
.SILENT:
build: managed local open
clean:
rm -rf "docs/src/modules/java/attachments"
rm -rf "docs/src/modules/java/examples"
rm -rf "docs/src/modules/ROOT/partials/attributes.adoc"
# above can eventually be removed, left for a smooth transition to managed files
rm -rf "${src_managed}"
rm -rf target/site
docker-image:
(cd ${ROOT_DIR}/docs/antora-docker; docker build -t ${antora_docker_image}:${antora_docker_image_tag} .)
prepare:
mkdir -p "${src_managed}"
cp docs/src/antora.yml "${src_managed}"
managed: prepare attributes apidocs examples bundles
attributes: prepare
mkdir -p "${managed_partials}"
echo "// generated from Makefile" \
> "${managed_partials}/attributes.adoc"
docs/bin/version.sh | xargs -0 printf ":akka-javasdk-version: %s" \
> "${managed_partials}/attributes.adoc"
echo ":akka-cli-version: 3.0.8" >> "${managed_partials}/attributes.adoc"
echo ":akka-cli-min-version: 3.0.4" >> "${managed_partials}/attributes.adoc"
# see https://adoptium.net/marketplace/
echo ":java-version: 21" \
>> "${managed_partials}/attributes.adoc"
# see https://maven.apache.org/docs/history.html
echo ":minimum_maven_version: 3.9" \
>> "${managed_partials}/attributes.adoc"
# see https://docs.docker.com/engine/release-notes/27/
echo ":minimum_docker_version: 27" \
>> "${managed_partials}/attributes.adoc"
apidocs: prepare
mkdir -p "${java_managed_attachments}"
sbt akka-javasdk/doc akka-javasdk-testkit/doc
rsync -a akka-javasdk/target/api/ "${java_managed_attachments}/api/"
rsync -a akka-javasdk-testkit/target/api/ "${java_managed_attachments}/testkit/"
docs/bin/version.sh > "${java_managed_attachments}/latest-version.txt"
examples: prepare
mkdir -p "${java_managed_examples}"
rsync -a --exclude-from=docs/.examplesignore samples/* "${java_managed_examples}/"
bundles:
./docs/bin/bundle.sh --zip "${java_managed_attachments}/shopping-cart-quickstart.zip" samples/shopping-cart-quickstart
./docs/bin/bundle.sh --zip "${java_managed_attachments}/customer-registry-quickstart.zip" samples/event-sourced-customer-registry
./docs/bin/bundle.sh --zip "${java_managed_attachments}/choreography-saga-quickstart.zip" samples/choreography-saga-quickstart
./docs/bin/bundle.sh --zip "${java_managed_attachments}/workflow-quickstart.zip" samples/transfer-workflow-compensation
done:
@echo "Generated docs at ${TARGET_DIR}/index.html"
open:
open "${TARGET_DIR}/index.html"
local: docker-image examples antora-local done
prod: docker-image managed antora-prod done
antora-local:
docker run \
-v ${ROOT_DIR}:/antora \
--rm \
-t ${antora_docker_image}:${antora_docker_image_tag} \
--cache-dir=.cache/antora --stacktrace --log-failure-level=error \
docs/antora-playbook-local.yml
antora-prod:
docker run \
-v ${ROOT_DIR}:/antora \
--rm \
-t ${antora_docker_image}:${antora_docker_image_tag} \
--cache-dir=.cache/antora --stacktrace --log-level error --log-failure-level=fatal \
docs/antora-playbook-prod.yml
validate-links:
docker run \
-v ${ROOT_DIR}:/antora \
--rm \
--entrypoint /bin/sh \
-t ${antora_docker_image}:${antora_docker_image_tag} \
-c "cd /antora/${BASE_PATH} && find src -name '*.adoc' -print0 | xargs -0 -n1 asciidoc-link-check --progress --config config/validate-links.json"
deploy: clean managed
bin/deploy.sh --module java --upstream ${upstream} --branch ${branch} ${sources}