update props to latest version
[maven-build-process.git] / Makefile
blobca2543acafa6e805c4d6b8d304f8ade41aef3547
1 # http://www.gnu.org/software/make/manual/make.html
2 # https://www.gnu.org/prep/standards/html_node/Makefile-Basics.html#Makefile-Basics
3 # http://clarkgrubb.com/makefile-style-guide
5 ############
6 # PROLOGUE #
7 ############
8 MAKEFLAGS += --warn-undefined-variables
9 SHELL = /bin/bash
10 .SHELLFLAGS := -eu -o pipefail -c
11 .DEFAULT_GOAL := all
12 .DELETE_ON_ERROR:
13 .SUFFIXES:
15 ######################
16 # INTERNAL VARIABLES #
17 ######################
18 TIMESTAMPED_VERSION := $(shell /bin/date "+%Y.%m.%d-%H%M%S")
19 CURRENT_DATE := $(shell /bin/date "+%Y-%m-%d")
20 USERNAME := $(shell id -u -n)
21 USERID := $(shell id -u)
22 GREEN := $(shell tput -Txterm setaf 2)
23 WHITE := $(shell tput -Txterm setaf 7)
24 YELLOW := $(shell tput -Txterm setaf 3)
25 RESET := $(shell tput -Txterm sgr0)
27 ######################
28 # INTERNAL FUNCTIONS #
29 ######################
30 HELP_FUN = \
31 %help; \
32 while(<>) { push @{$$help{$$2 // 'targets'}}, [$$1, $$3] if /^([a-zA-Z\-]+)\s*:.*\#\#(?:@([a-zA-Z\-]+))?\s(.*)$$/ }; \
33 print "usage: make [target]\n\n"; \
34 for (sort keys %help) { \
35 print "${WHITE}$$_:${RESET}\n"; \
36 for (@{$$help{$$_}}) { \
37 $$sep = " " x (32 - length $$_->[0]); \
38 print " ${YELLOW}$$_->[0]${RESET}$$sep${GREEN}$$_->[1]${RESET}\n"; \
39 }; \
40 print "\n"; }
42 ###############
43 # GOALS/RULES #
44 ###############
45 .PHONY: all
46 all: help
48 help: ##@other Show this help
49 @perl -e '$(HELP_FUN)' $(MAKEFILE_LIST)
51 .PHONY: install
52 install: ##@hacking Install all artifacts into local repository
53 mvn clean install
55 .PHONY: test
56 test: ##@hacking Run all tests
57 mvn test
59 .PHONY: display-dependency-updates
60 display-dependency-updates: ##@maintenance Display dependency updates in 'maven-boms'
61 mvn versions:display-dependency-updates \
62 --update-snapshots \
63 --projects maven-boms \
64 --also-make-dependents
66 .PHONY: display-plugin-updates
67 display-plugin-updates: ##@maintenance Display plugin updates in 'maven-parents'
68 mvn versions:display-plugin-updates \
69 --update-snapshots \
70 --projects maven-parents \
71 --also-make-dependents
73 .PHONY: display-property-updates
74 display-property-updates: ##@maintenance Display property updates in all modules
75 mvn versions:display-property-updates \
76 --update-snapshots
78 .PHONY: update-properties
79 update-properties: ##@maintenance Update all properties to their latest versions
80 mvn versions:update-properties \
81 --update-snapshots \
82 -DgenerateBackupPoms=false
83 git add pom.xml **/**/pom.xml
84 git commit -s -S -m 'Update properties to latest version'
86 .PHONY: sonar-analysis
87 sonar-analysis: ##@sebhoss Perform Sonarqube analysis
88 # http://docs.sonarqube.org/display/SONAR/Analyzing+with+SonarQube+Scanner+for+Maven
89 mvn clean install
90 mvn sonar:sonar \
91 -Dsonar.host.url=https://quality.metio.wtf/ \
92 -Dsonar.pitest.mode=reuseReport
94 .PHONY: docker-verify
95 docker-verify: create-build-environment ##@docker Verify project in pre-defined build environment
96 docker-compose \
97 -f build/docker/build-environment.yml \
98 run --rm verify-project
100 # see https://github.com/docker/docker/issues/10324 for NEXUS_HOST trick
101 .PHONY: create-build-environment
102 create-build-environment: ##@docker Creates a pre-defined build environment
103 docker-compose \
104 -f build/docker/build-environment.yml \
105 build maven-build-environment
107 .PHONY: sign-waiver
108 sign-waiver: ##@contributing Sign the WAIVER
109 gpg2 --no-version --armor --sign AUTHORS/WAIVER
110 mv AUTHORS/WAIVER.asc AUTHORS/WAIVER-signed-by-$(USERNAME)-$(CURRENT_DATE).asc
112 .PHONY: release-into-local-nexus
113 release-into-local-nexus: ##@release Release all artifacts into a local nexus
114 mvn versions:set \
115 -DnewVersion=$(TIMESTAMPED_VERSION) \
116 -DgenerateBackupPoms=false
117 -mvn clean deploy scm:tag \
118 -DpushChanges=false \
119 -DskipLocalStaging=true \
120 -Drelease=local
121 mvn versions:set \
122 -DnewVersion=9999.99.99-SNAPSHOT \
123 -DgenerateBackupPoms=false
125 .PHONY: release-into-sonatype-nexus
126 release-into-sonatype-nexus: ##@release Release all artifacts into Maven Central (through Sonatype OSSRH)
127 mvn versions:set \
128 -DnewVersion=$(TIMESTAMPED_VERSION) \
129 -DgenerateBackupPoms=false
130 -mvn clean pgp:sign deploy scm:tag \
131 -DpushChanges=false \
132 -Drelease=sonatype
133 -git push \
134 --tags \
135 origin master
136 mvn versions:set \
137 -DnewVersion=9999.99.99-SNAPSHOT \
138 -DgenerateBackupPoms=false