mirror of
https://github.com/valitydev/fraudbusters-proto.git
synced 2024-11-06 02:25:16 +00:00
81 lines
1.8 KiB
Makefile
81 lines
1.8 KiB
Makefile
THRIFT = $(or $(shell which thrift), $(error "`thrift' executable missing"))
|
|
REBAR = $(shell which rebar3 2>/dev/null || which ./rebar3)
|
|
SUBMODULES = build_utils
|
|
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
|
|
|
UTILS_PATH := build_utils
|
|
TEMPLATES_PATH := .
|
|
|
|
# Name of the service
|
|
SERVICE_NAME := fraudbusters-proto
|
|
|
|
# Build image tag to be used
|
|
BUILD_IMAGE_TAG := ea4aa042f482551d624fd49a570d28488f479e93
|
|
CALL_ANYWHERE := \
|
|
all submodules compile clean distclean \
|
|
java.compile java.deploy
|
|
|
|
CALL_W_CONTAINER := $(CALL_ANYWHERE)
|
|
|
|
all: compile
|
|
|
|
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
|
|
|
.PHONY: $(CALL_W_CONTAINER)
|
|
|
|
# CALL_ANYWHERE
|
|
$(SUBTARGETS): %/.git: %
|
|
git submodule update --init $<
|
|
touch $@
|
|
|
|
submodules: $(SUBTARGETS)
|
|
|
|
compile:
|
|
$(REBAR) compile
|
|
|
|
clean:
|
|
$(REBAR) clean
|
|
|
|
distclean:
|
|
$(REBAR) clean -a
|
|
rm -rfv _build
|
|
|
|
# Java
|
|
|
|
ifdef SETTINGS_XML
|
|
DOCKER_RUN_OPTS = -v $(SETTINGS_XML):$(SETTINGS_XML)
|
|
DOCKER_RUN_OPTS += -e SETTINGS_XML=$(SETTINGS_XML)
|
|
endif
|
|
|
|
ifdef LOCAL_BUILD
|
|
DOCKER_RUN_OPTS += -v $$HOME/.m2:/home/$(UNAME)/.m2:rw
|
|
endif
|
|
|
|
COMMIT_HASH := $(shell git --no-pager log -1 --pretty=format:"%h")
|
|
NUMBER_COMMITS := $(shell git rev-list --count HEAD)
|
|
|
|
JAVA_PKG_VERSION := 1.$(NUMBER_COMMITS)-$(COMMIT_HASH)
|
|
|
|
ifdef BRANCH_NAME
|
|
ifeq "$(findstring epic,$(BRANCH_NAME))" "epic"
|
|
JAVA_PKG_VERSION := $(JAVA_PKG_VERSION)-epic
|
|
endif
|
|
endif
|
|
|
|
MVN = mvn -s $(SETTINGS_XML) -Dpath_to_thrift="$(THRIFT)" -Dcommit.number="$(NUMBER_COMMITS)"
|
|
|
|
java.compile: java.settings
|
|
$(MVN) compile
|
|
|
|
java.deploy: java.settings
|
|
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
|
|
$(MVN) deploy
|
|
|
|
java.install: java.settings
|
|
$(MVN) clean && \
|
|
$(MVN) versions:set versions:commit -DnewVersion="$(JAVA_PKG_VERSION)" && \
|
|
$(MVN) install
|
|
|
|
java.settings:
|
|
$(if $(SETTINGS_XML),, echo "SETTINGS_XML not defined"; exit 1)
|