-
Notifications
You must be signed in to change notification settings - Fork 11
/
Makefile
executable file
·64 lines (49 loc) · 2.46 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
CWD = $(shell pwd)
POM = -f pom.xml
# Maven Clean Install Skip ; skip tests, javadoc, scaladoc, etc
MS = mvn -DskipTests -Dmaven.javadoc.skip=true -Dskip
MCIS = $(MS) clean install
MCCS = $(MS) clean compile
VER = $(error specify VER=releasefile-name e.g. VER=1.9.7-rc2)
loud = echo "@@" $(1);$(1)
# Source: https://stackoverflow.com/questions/4219255/how-do-you-get-the-list-of-targets-in-a-makefile
.PHONY: help
.ONESHELL:
help: ## Show these help instructions
@sed -rn 's/^([a-zA-Z_-]+):.*?## (.*)$$/"\1" "\2"/p' < $(MAKEFILE_LIST) | xargs printf "make %-20s# %s\n"
distjar: ## Create only the standalone jar-with-dependencies of rpt
$(MCCS) $(POM) package -Pstandalone,dist -pl :lsq-pkg-uberjar-cli -am $(ARGS)
file=`find '$(CWD)/lsq-pkg-parent/lsq-pkg-uberjar-cli/target' -name '*-jar-with-dependencies.jar'`
printf '\nCreated package:\n\n%s\n\n' "$$file"
rpm-rebuild: ## Rebuild the rpm package (minimal build of only required modules)
$(MCIS) $(POM) -Prpm -am -pl :lsq-pkg-rpm-cli $(ARGS)
rpm-reinstall: ## Reinstall rpm (requires prior build)
@p1=`find lsq-pkg-parent/lsq-pkg-rpm-cli/target | grep '\.rpm$$'`
sudo rpm -U "$$p1"
rpm-rere: rpm-rebuild rpm-reinstall ## Rebuild and reinstall rpm package
deb-rebuild: ## Rebuild the deb package (minimal build of only required modules)
$(MCIS) $(POM) -Pdeb -am -pl :lsq-pkg-deb-cli $(ARGS)
deb-reinstall: ## Reinstall deb (requires prior build)
@p1=`find lsq-pkg-parent/lsq-pkg-deb-cli/target | grep '\.deb$$'`
sudo dpkg -i "$$p1"
deb-rere: deb-rebuild deb-reinstall ## Rebuild and reinstall deb package
docker: ## Build Docker image
$(MCIS) $(POM) -am -pl :lsq-pkg-docker-cli $(ARGS)
cd lsq-pkg-parent/lsq-pkg-docker-cli && $(MS) jib:dockerBuild && cd ../..
release-bundle: ## Create files for Github upload
@set -eu
ver=$(VER)
$(call loud,$(MAKE) deb-rebuild)
p1=`find lsq-pkg-parent/lsq-pkg-deb-cli/target | grep '\.deb$$'`
$(call loud,cp "$$p1" "rpt-$${ver/-/\~}.deb")
$(call loud,$(MAKE) rpm-rebuild)
p1=`find lsq-pkg-parent/lsq-pkg-rpm-cli/target | grep '\.rpm$$'`
$(call loud,cp "$$p1" "rpt-$$ver.rpm")
$(call loud,$(MAKE) distjar)
file=`find '$(CWD)/lsq-pkg-parent/lsq-pkg-uberjar-cli/target' -name '*-jar-with-dependencies.jar'`
$(call loud,cp "$$file" "rpt-$$ver.jar")
$(call loud,$(MAKE) docker)
$(call loud,docker tag aksw/rpt aksw/rpt:$$ver)
$(call loud,gh release create v$$ver "rpt-$${ver/-/\~}.deb" "rpt-$$ver.rpm" "rpt-$$ver.jar")
$(call loud,docker push aksw/rpt:$$ver)
$(call loud,docker push aksw/rpt)