This repository has been archived by the owner on Jan 15, 2021. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathMakefile
65 lines (46 loc) · 3 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
# see
# - https://suva.sh/posts/well-documented-makefiles/
# - https://medium.freecodecamp.org/want-to-know-the-easiest-way-to-save-time-use-make-eec453adf7fe
# TODO
# looks like this file should/could be split in three: https://stackoverflow.com/questions/17873044/how-to-make-makefile-find-target-in-subdirectory-makefile
.PHONY: all run test test-ui test-service clean clean-ui clean-service clean-arc42 check help
# use jq or node to get the version
ACCELERATOR_VERSION=$(shell jq -r .version ui/package.json)
JAVA_SRC = $(shell find service/sandbox-core/src)
TS_SRC = $(shell find ui/src -type f)
ARC42_SRC = $(shell find arc42/src)
PLANTUML_SRC = $(shell find arc42/diagrams -type f -name '*.puml')
DEPENDENCIES = jq npm plantuml asciidoctor docker-compose mvn
all: service/sandbox-core/target arc42/psd2-accelerator-arc42.html ## Build all components
run: all ## Run everything with docker-compose after building
docker-compose up --build
service/sandbox-core/target: service/pom.xml $(JAVA_SRC) ui/dist ## Build the jar
cd service && mvn -DskipTests clean package
ui/dist: ui/node_modules $(TS_SRC) ## Build the UI package (HTML/JS)
cd ui && npm run build
ui/node_modules: ui/package.json ui/package-lock.json ## Install NPM dependencies
cd ui && npm install
arc42/psd2-accelerator-arc42.html arc42/psd2-accelerator-deployment.html: arc42/images/generated $(ARC42_SRC) arc42/psd2-accelerator-arc42.adoc arc42/psd2-accelerator-deployment.adoc ui/package.json ## Generate arc42 html documentation
cd arc42 && asciidoctor -a acc-version=$(ACCELERATOR_VERSION) psd2-accelerator-arc42.adoc && asciidoctor -a acc-version=$(ACCELERATOR_VERSION) psd2-accelerator-deployment.adoc
arc42/images/generated: $(PLANTUML_SRC) ## Generate images from .puml files
# Note: Because plantuml doesnt update the images/generated timestamp we need to touch it afterwards
cd arc42 && mkdir -p images/generated && plantuml -o "../images/generated" diagrams/*.puml && touch images/generated
test: test-ui test-service ## Run all tests
#TODO: Add e2e tests as seperate target or inside test-ui
test-ui: ui/node_modules ## Run tests in UI
cd ui && npm run test-single-headless
test-service: service ## Run tests in service
cd service && mvn test
clean: clean-ui clean-service clean-arc42 ## Clean everything
clean-ui: ## Clean UI temp files
cd ui && rm -rf dist
clean-service: ## Clean service temp files
cd service && mvn clean
clean-arc42: ## Clean arc42 temp files
cd arc42 && rm -rf images/generated && rm -rf psd2-*.html
check: ## Check required dependencies ("@:" hides nothing to be done for...)
@: $(foreach exec,$(DEPENDENCIES),\
$(if $(shell command -v $(exec) 2> /dev/null ),$(info (OK) $(exec) is installed),$(info (FAIL) $(exec) is missing)))
# TODO this breaks on targets (= ignores) with slashes in the path
help: ## Display this help
@awk 'BEGIN {FS = ":.*##"; printf "\nUsage:\n make \033[36m<target>\033[0m\n\nTargets:\n"} /^[a-zA-Z0-9_\-\/\. ]+:.*?##/ { printf " \033[36m%-10s\033[0m %s\n", $$1, $$2 }' $(MAKEFILE_LIST)