Repository navigation
Expand file tree
/
Copy pathMakefile
More file actions
95 lines (75 loc) · 3.42 KB
/
Copy pathMakefile
File metadata and controls
95 lines (75 loc) · 3.42 KB
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
# Uncomment for verbose debug output
#__ORIGINAL_SHELL:=$(SHELL)
#SHELL=$(warning [[ Building $@$(if $<, (from $<))$(if $?, ($? newer)) ]] )$(TIME) $(__ORIGINAL_SHELL)
GH_PAGES=gh_pages
BRANCHES=master 2.5.x 2.4.x 1.6.x
PLAYBOOK=antora-playbook.yml
REMOTE_REPO ?= https://github.com/MorphiaOrg/morphia.git
BENCHMARK_DATA=https://raw.githubusercontent.com/MorphiaOrg/morphia/benchmark-data/mappers/data.js
default: site sync
$(GH_PAGES): .PHONY
@[ ! -d $@ ] && git clone ${REMOTE_REPO} -b gh-pages --depth 1 --no-single-branch $(GH_PAGES) || true
@git -C $@ reset --hard --quiet && git -C $@ pull --all --quiet
build/morphia: .PHONY
@[ ! -d $@ ] && git clone ${REMOTE_REPO} --depth 1 --no-single-branch build/morphia || true
@git -C $@ pull --all --quiet
package-lock.json: package.json
@npm run clean-install
versions.list: Makefile bin/syncVersions.kt
@echo Extracting versions
@make -s build/morphia
@> versions.list
@for BRANCH in $(BRANCHES); \
do \
git -C build/morphia checkout $$BRANCH --quiet || echo checkout failed for $$BRANCH ; \
git -C build/morphia pull --rebase --quiet || echo update failed for $$BRANCH ; \
jbang bin/syncVersions.kt $$BRANCH >> versions.list ; \
done;
@git -C build/morphia checkout master --quiet || echo checkout failed for $$BRANCH
@BRANCH=`echo $(BRANCHES) | cut -d' ' -f 2` ; \
git -C build/morphia checkout $$BRANCH --quiet || echo checkout failed for $$BRANCH ; \
VERSION=`jbang bin/syncVersions.kt $$BRANCH onlyminor` ; \
sed -i $@ -e "s|../morphia/.*/index.html|../morphia/$$VERSION/index.html|"
antora-playbook.yml: Makefile .PHONY
@sed antora-playbook-template.yml \
-e "s/branches: \[.*\] ### morphia branches/branches: [ `echo $(BRANCHES) | sed -e 's/ /, /g'` ] ### morphia branches/" > $@
local: antora-playbook.yml
@sed -i -e 's!^ - url: https://github.com/MorphiaOrg/\(.*\)! - url: ../\1!' antora-playbook.yml
Makefile-javadoc: versions.list bin/generate-makefile.sh Makefile
@bash ./bin/generate-makefile.sh
javadocs: Makefile Makefile-javadoc
@$(MAKE) -f Makefile-javadoc alldocs
$(GH_PAGES)/index.html: $(GH_PAGES) build/site/index.html
@cd $(GH_PAGES) ; \
rsync -Cra --delete --exclude=CNAME --exclude=.git ../build/site/ . ; \
git add .
push:
@cd $(GH_PAGES) ; \
git commit -a -m "pushing docs updates" ; \
git pull --rebase ; \
git push ${REMOTE_REPO}
site: versions.list package-lock.json javadocs
@make -s $(PLAYBOOK)
@npm run build
@touch build/site/.nojekyll
@cp home/modules/ROOT/pages/*.html build/site/landing
@make -s benchmarks
benchmarks: .PHONY
@mkdir -p build/site/benchmarks
@cp benchmarks/index.html benchmarks/benchmarks.js build/site/benchmarks/
@rm -f build/site/benchmarks/data.json build/benchmark-data.json
@# data.js is a script assigning window.BENCHMARK_DATA; publish only the JSON so the page never executes it.
@curl -sfL $(BENCHMARK_DATA) \
| sed -e '1s/^[[:space:]]*window\.BENCHMARK_DATA[[:space:]]*=[[:space:]]*//' -e '$$s/;[[:space:]]*$$//' \
> build/benchmark-data.json \
&& jq -e '.entries | type == "object"' build/benchmark-data.json > /dev/null 2>&1 \
&& mv build/benchmark-data.json build/site/benchmarks/data.json \
|| { echo "WARNING: could not fetch valid benchmark data from $(BENCHMARK_DATA)" ; rm -f build/benchmark-data.json ; }
sync: $(GH_PAGES)/index.html
publish: site sync push
clean:
@rm -rf antora-playbook.yml versions.list Makefile-javadoc
mrclean: clean
@rm -rf build $(GH_PAGES)
@npm run clean
.PHONY: