2016-08-31 17:56:24 +00:00
|
|
|
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
|
2017-10-10 21:02:17 +00:00
|
|
|
SUBMODULES = schemes/swag build_utils
|
2016-08-31 17:56:24 +00:00
|
|
|
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
|
|
|
|
2017-05-03 10:56:08 +00:00
|
|
|
COMPOSE_HTTP_TIMEOUT := 300
|
|
|
|
export COMPOSE_HTTP_TIMEOUT
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
UTILS_PATH := build_utils
|
|
|
|
TEMPLATES_PATH := .
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# Name of the service
|
2017-11-02 16:01:41 +00:00
|
|
|
SERVICE_NAME := capi-v2
|
2016-09-05 12:21:44 +00:00
|
|
|
# Service image default tag
|
|
|
|
SERVICE_IMAGE_TAG ?= $(shell git rev-parse HEAD)
|
|
|
|
# The tag for service image to be pushed with
|
|
|
|
SERVICE_IMAGE_PUSH_TAG ?= $(SERVICE_IMAGE_TAG)
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# Base image for the service
|
2019-07-03 08:11:31 +00:00
|
|
|
BASE_IMAGE_NAME := service-erlang
|
2019-11-07 13:25:05 +00:00
|
|
|
BASE_IMAGE_TAG := da0ab769f01b650b389d18fc85e7418e727cbe96
|
2016-09-05 12:21:44 +00:00
|
|
|
|
2019-11-07 13:25:05 +00:00
|
|
|
BUILD_IMAGE_TAG := 4536c31941b9c27c134e8daf0fd18848809219c9
|
2016-09-05 12:21:44 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
CALL_ANYWHERE := \
|
|
|
|
submodules \
|
2018-05-07 15:50:57 +00:00
|
|
|
all compile xref lint dialyze test cover \
|
2017-07-31 13:59:37 +00:00
|
|
|
start devrel release clean distclean \
|
|
|
|
generate regenerate swag_server.regenerate swag_client.regenerate
|
2016-09-05 12:21:44 +00:00
|
|
|
|
|
|
|
CALL_W_CONTAINER := $(CALL_ANYWHERE)
|
|
|
|
|
2018-05-07 15:50:57 +00:00
|
|
|
.PHONY: $(CALL_W_CONTAINER) all
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
all: compile
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
|
|
|
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
$(SUBTARGETS): %/.git: %
|
|
|
|
git submodule update --init $<
|
|
|
|
touch $@
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
submodules: $(SUBTARGETS)
|
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
generate: swag_server.generate swag_client.generate
|
|
|
|
|
|
|
|
regenerate: swag_server.regenerate swag_client.regenerate
|
2017-02-27 13:40:13 +00:00
|
|
|
|
2018-05-07 15:50:57 +00:00
|
|
|
compile: submodules generate
|
2016-08-31 17:56:24 +00:00
|
|
|
$(REBAR) compile
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
xref:
|
|
|
|
$(REBAR) xref
|
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
lint: generate
|
2016-09-05 12:21:44 +00:00
|
|
|
elvis rock
|
|
|
|
|
|
|
|
dialyze:
|
|
|
|
$(REBAR) dialyzer
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
start: submodules
|
|
|
|
$(REBAR) run
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
devrel: submodules
|
|
|
|
$(REBAR) release
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2018-10-05 13:22:10 +00:00
|
|
|
release: submodules generate
|
2016-09-05 12:21:44 +00:00
|
|
|
$(REBAR) as prod release
|
2016-08-31 17:56:24 +00:00
|
|
|
|
|
|
|
clean:
|
2016-10-26 13:39:32 +00:00
|
|
|
$(REBAR) cover -r
|
2016-08-31 17:56:24 +00:00
|
|
|
$(REBAR) clean
|
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
distclean: swag_server.distclean swag_client.distclean
|
2017-02-09 09:50:35 +00:00
|
|
|
$(REBAR) clean
|
2017-05-26 09:18:44 +00:00
|
|
|
rm -rf _build
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
cover:
|
|
|
|
$(REBAR) cover
|
|
|
|
|
2016-09-05 12:21:44 +00:00
|
|
|
# CALL_W_CONTAINER
|
2017-07-31 13:59:37 +00:00
|
|
|
test: submodules generate
|
2017-03-28 13:54:33 +00:00
|
|
|
$(REBAR) do eunit, ct
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-02-27 13:40:13 +00:00
|
|
|
# Swagger stuff
|
|
|
|
SWAGGER_CODEGEN = $(call which, swagger-codegen)
|
|
|
|
SWAGGER_SCHEME_PATH = schemes/swag
|
2017-06-16 11:03:25 +00:00
|
|
|
SWAGGER_SCHEME = $(SWAGGER_SCHEME_PATH)/swagger.yaml
|
2017-02-27 13:40:13 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
$(SWAGGER_SCHEME): $(SWAGGER_SCHEME_PATH)/.git
|
|
|
|
|
|
|
|
# Swagger server
|
|
|
|
SWAG_SERVER_PREFIX = swag_server
|
|
|
|
SWAG_SERVER_APP_PATH = apps/$(SWAG_SERVER_PREFIX)
|
|
|
|
SWAG_SERVER_APP_TARGET = $(SWAG_SERVER_APP_PATH)/rebar.config
|
2017-02-27 13:40:13 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
swag_server.generate: $(SWAG_SERVER_APP_TARGET)
|
2017-02-27 13:40:13 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
swag_server.distclean:
|
|
|
|
rm -rf $(SWAG_SERVER_APP_PATH)
|
2016-08-31 17:56:24 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
swag_server.regenerate: swag_server.distclean swag_server.generate
|
|
|
|
|
|
|
|
$(SWAG_SERVER_APP_TARGET): $(SWAGGER_SCHEME)
|
2017-06-16 11:03:25 +00:00
|
|
|
$(SWAGGER_CODEGEN) generate \
|
|
|
|
-i $(SWAGGER_SCHEME) \
|
|
|
|
-l erlang-server \
|
2017-07-31 13:59:37 +00:00
|
|
|
-o $(SWAG_SERVER_APP_PATH) \
|
2017-06-16 11:03:25 +00:00
|
|
|
--additional-properties \
|
2017-07-31 13:59:37 +00:00
|
|
|
packageName=$(SWAG_SERVER_PREFIX)
|
2017-02-09 09:50:35 +00:00
|
|
|
|
2017-07-31 13:59:37 +00:00
|
|
|
# Swagger client
|
|
|
|
SWAG_CLIENT_PREFIX = swag_client
|
|
|
|
SWAG_CLIENT_APP_PATH = apps/$(SWAG_CLIENT_PREFIX)
|
|
|
|
SWAG_CLIENT_APP_TARGET = $(SWAG_CLIENT_APP_PATH)/rebar.config
|
|
|
|
|
|
|
|
swag_client.generate: $(SWAG_CLIENT_APP_TARGET)
|
|
|
|
|
|
|
|
swag_client.distclean:
|
|
|
|
rm -rf $(SWAG_CLIENT_APP_PATH)
|
|
|
|
|
|
|
|
swag_client.regenerate: swag_client.distclean swag_client.generate
|
|
|
|
|
|
|
|
$(SWAG_CLIENT_APP_TARGET): $(SWAGGER_SCHEME)
|
|
|
|
$(SWAGGER_CODEGEN) generate \
|
|
|
|
-i $(SWAGGER_SCHEME) \
|
|
|
|
-l erlang-client \
|
|
|
|
-o $(SWAG_CLIENT_APP_PATH) \
|
|
|
|
--additional-properties \
|
|
|
|
packageName=$(SWAG_CLIENT_PREFIX)
|