-
Notifications
You must be signed in to change notification settings - Fork 7
/
Copy pathMakefile
47 lines (37 loc) · 1.27 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
.DEFAULT_GOAL := help
SHELL := /bin/bash
SDKMAN := $(HOME)/.sdkman/bin/sdkman-init.sh
CURRENT_USER_NAME := $(shell whoami)
JAVA_VER := 19-tem
MAVEN_VER := 3.9.1
SDKMAN_EXISTS := @printf "sdkman"
#help: @ List available tasks on this project
help:
@clear
@echo "Usage: make COMMAND"
@echo
@echo "Commands :"
@echo
@grep -E '[a-zA-Z\.\-]+:.*?@ .*$$' $(MAKEFILE_LIST)| tr -d '#' | awk 'BEGIN {FS = ":.*?@ "}; {printf "\033[32m%-9s\033[0m - %s\n", $$1, $$2}'
build-deps-check:
@. $(SDKMAN)
ifndef SDKMAN_DIR
@curl -s "https://get.sdkman.io?rcupdate=false" | bash
@source $(SDKMAN)
ifndef SDKMAN_DIR
SDKMAN_EXISTS := @echo "SDKMAN_VERSION is undefined" && exit 1
endif
endif
@. $(SDKMAN) && echo N | sdk install java $(JAVA_VER) && sdk use java $(JAVA_VER)
@. $(SDKMAN) && echo N | sdk install maven $(MAVEN_VER) && sdk use maven $(MAVEN_VER)
#check-env: @ Check environment variables and installed tools
check-env: build-deps-check
@printf "\xE2\x9C\x94 "
$(SDKMAN_EXISTS)
@printf "\n"
#build: @ Build project
build: check-env
@. $(SDKMAN) && sdk use java $(JAVA_VER) && sdk use maven $(MAVEN_VER) && mvn clean package install -Dmaven.test.skip=true
#test: @ Run project tests
test: build
@. $(SDKMAN) && sdk use java $(JAVA_VER) && sdk use maven $(MAVEN_VER) && mvn test