From 8a561e82c9f4b0ff1e7680b7706719a67b952d4d Mon Sep 17 00:00:00 2001 From: radtriste Date: Thu, 22 Dec 2022 15:05:41 +0100 Subject: [PATCH] KOGITO-8400 Setup Makefile --- Makefile | 75 +++++++++++++++++++++++++++++++++++++++++++++++++++++++ README.md | 4 +-- 2 files changed, 77 insertions(+), 2 deletions(-) create mode 100644 Makefile diff --git a/Makefile b/Makefile new file mode 100644 index 000000000000..176decc09366 --- /dev/null +++ b/Makefile @@ -0,0 +1,75 @@ +mvn_opts= +mvn_cmd=mvn $(mvn_opts) + +default: help + +.PHONY: build +## Build the project +build: + $(mvn_cmd) clean install + +.PHONY: quick-build +## Perform a quick build of the project +quick-build: + $(mvn_cmd) clean install -Dquickly + +.PHONY: test +## Launch full testing +test: + $(mvn_cmd) clean verify + +.PHONY: quick-test +## Launch unit testing +quick-test: + $(mvn_cmd) clean verify -DquickTests + +.PHONY: deploy +## Deploy the project +deploy: + $(mvn_cmd) deploy + +.PHONY: clean +## Clean the project +clean: + $(mvn_cmd) clean + +.PHONY: mvn +## Execute a Maven command with project configuration. Needs the `cmd` argument set +mvn: + $(mvn_cmd) ${cmd} + +## Update the quarkus version. Needs the `quarkus_version` argument set +update-quarkus: + export BUILD_MVN_OPTS=${mvn_opts} && .ci/environments/common/update_quarkus.sh ${quarkus_version} + $(MAKE) show-diff + +## Prepare the repository for a specific environment. Needs the `environment` argument set +prepare-env: + export BUILD_MVN_OPTS=${mvn_opts} && .ci/environments/update.sh ${environment} + +## Show project dependencies +tree: + $(mvn_cmd) dependency:tree + +## Show Git diff +show-diff: + git status + git diff + +## This help screen +help: + @printf "Available targets:\n\n" + @awk '/^[a-zA-Z\-_0-9%:\\]+/ { \ + helpMessage = match(lastLine, /^## (.*)/); \ + if (helpMessage) { \ + helpCommand = $$1; \ + helpMessage = substr(lastLine, RSTART + 3, RLENGTH); \ + gsub("\\\\", "", helpCommand); \ + gsub(":+$$", "", helpCommand); \ + printf " \x1b[32;01m%-35s\x1b[0m %s\n", helpCommand, helpMessage; \ + } \ + } \ + { lastLine = $$0 }' $(MAKEFILE_LIST) + @printf "\n" + @printf "All Maven commands can include some maven options via the \`mvn_opts\` argument !" + @printf "\n" diff --git a/README.md b/README.md index fb960f6199e2..b5f526392c0e 100644 --- a/README.md +++ b/README.md @@ -26,8 +26,8 @@ There are two ways to activate such profile during maven build: The following two commands will execute tests on machine with locale different than _en_US_: -1. `mvn clean verify -Ptest-en` -2. `mvn clean verify -DTestEn` +1. `make test -Ptest-en` +2. `make test -DTestEn`