-
Notifications
You must be signed in to change notification settings - Fork 9
/
Copy pathMakefile
94 lines (71 loc) · 2.75 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
DOCKER := $(if $(LRN_SDK_NO_DOCKER),,$(shell which docker))
JAVA_DIST = eclipse-temurin
JAVA_VERSION = 11
IMAGE = $(JAVA_DIST)-maven:$(JAVA_VERSION)
TARGETS = build dist install \
test test-unit test-integration-env \
version-check version-check-message \
quickstart-assessment quickstart-clean \
clean
.PHONY: $(TARGETS)
ifneq (,$(DOCKER))
# Re-run the make command in a container
DKR = docker container run -t --rm \
-v $(CURDIR):/srv/sdk/java:z,delegated \
-v lrn-sdk-java_cache:/root/.m2/repository \
-w /srv/sdk/java \
-e LRN_SDK_NO_DOCKER=1 \
-e ENV -e REGION -e VER \
$(if $(findstring dev,$(ENV)),--net host) \
$(IMAGE)
$(TARGETS): $(if $(shell docker image ls -q --filter reference=$(IMAGE)),,docker-build)
$(DKR) make -e MAKEFLAGS="$(MAKEFLAGS)" $@
docker-build:
docker image build --progress plain --build-arg JAVA_DIST=$(JAVA_DIST) --build-arg JAVA_VERSION=$(JAVA_VERSION) -t $(IMAGE) .
.PHONY: docker-build
else
# Data API settings
ENV = prod
REGION = .learnosity.com
VER = v1
# Dev cycle targets
build:
mvn compile
test: test-unit test-integration-env
test-unit:
mvn test $(MVN_OPTS)
test-integration-env:
ENV=$(ENV) REGION=$(REGION) VER=$(VER) mvn integration-test $(MVN_OPTS)
clean:
mvn clean
dist: version-check test-integration-env
mvn package
PROJECT_VERSION_CMD = mvn help:evaluate -Dexpression=project.version -q -DforceStdout
PKG_VER = v$(shell $(PROJECT_VERSION_CMD))
GIT_TAG = $(shell git describe --tags)
VERSION_MISMATCH = For a release build, the package version number $(PKG_VER) must match the git tag $(GIT_TAG).
version-check-message:
@echo Checking git and project versions ...
version-check: version-check-message
@echo $(GIT_TAG) | grep -qw "$(PKG_VER)" || (echo $(VERSION_MISMATCH); exit 1)
install:
mvn install
# The following targets are for the Quickstart Assessment Demo
quickstart-assessment: docs/quickstart/assessment/webapps/quickstart-*.war demo-run-message
docs/quickstart/assessment/webapps/quickstart-%.war: docs/quickstart/assessment/target/quickstart-%.war
mkdir -p docs/quickstart/assessment/webapps
cp docs/quickstart/assessment/target/quickstart-*.war docs/quickstart/assessment/webapps
docs/quickstart/assessment/target/quickstart-%.war: install
cd docs/quickstart/assessment && mvn package
demo-run-message:
@echo -e '\033[0;32m** Demo package complete **\033[0m'
@echo Now copy docs/quickstart/assessment/webapps/quickstart*.war to the webapps
@echo directory of a servlet container like Jetty or Tomcat, or use Docker:
@echo
@echo 'docker container run --rm -d -v $$(pwd)/docs/quickstart/assessment/webapps:/var/lib/jetty/webapps -p 9280:8080 jetty:11.0.7-jdk11'
@echo
.PHONY: demo-run-message
quickstart-clean:
cd docs/quickstart/assessment && mvn clean
rm -rf docs/quickstart/assessment/webapps
endif