mirror of
https://github.com/valitydev/capi-v2.git
synced 2024-11-06 10:05:21 +00:00
2dcb9c1294
* CAPI-25 Add initial project structure. Add mock-backend and basic tests. Add new building with Jenkins and add real backend handler.
89 lines
1.9 KiB
Makefile
89 lines
1.9 KiB
Makefile
REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
|
|
SUBMODULES = schemes/swag apps/cp_proto/damsel build_utils
|
|
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
|
|
|
|
SWAGGER_CODEGEN ?= $(call which, swagger-codegen)
|
|
SWAGGER_SCHEME = schemes/swag/swagger.yaml
|
|
SWAGGER_APP_PATH = apps/swagger
|
|
SWAGGER_APP_TARGET = $(SWAGGER_APP_PATH)/rebar.config
|
|
|
|
UTILS_PATH := build_utils
|
|
TEMPLATES_PATH := .
|
|
|
|
# Name of the service
|
|
SERVICE_NAME := capi
|
|
# 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)
|
|
|
|
# Base image for the service
|
|
BASE_IMAGE_NAME := service_erlang
|
|
BASE_IMAGE_TAG := 170b7dd12d62431303f8bb514abe2b43468223a1
|
|
|
|
BUILD_IMAGE_TAG := 753126790c9ecd763840d9fe58507335af02b875
|
|
|
|
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze test start devrel release clean distclean
|
|
|
|
CALL_W_CONTAINER := $(CALL_ANYWHERE)
|
|
|
|
.PHONY: $(CALL_W_CONTAINER) all
|
|
|
|
all: compile
|
|
|
|
-include $(UTILS_PATH)/make_lib/utils_container.mk
|
|
-include $(UTILS_PATH)/make_lib/utils_image.mk
|
|
|
|
$(SUBTARGETS): %/.git: %
|
|
git submodule update --init $<
|
|
touch $@
|
|
|
|
submodules: $(SUBTARGETS)
|
|
|
|
rebar-update:
|
|
$(REBAR) update
|
|
|
|
compile: submodules $(SWAGGER_APP_TARGET) rebar-update
|
|
$(REBAR) compile
|
|
|
|
xref:
|
|
$(REBAR) xref
|
|
|
|
lint: compile
|
|
elvis rock
|
|
|
|
dialyze:
|
|
$(REBAR) dialyzer
|
|
|
|
start: submodules
|
|
$(REBAR) run
|
|
|
|
devrel: submodules
|
|
$(REBAR) release
|
|
|
|
release: distclean
|
|
$(REBAR) as prod release
|
|
|
|
clean:
|
|
$(REBAR) clean
|
|
|
|
distclean:
|
|
$(REBAR) clean -a
|
|
rm -rfv _build _builds _cache _steps _temp
|
|
|
|
# CALL_W_CONTAINER
|
|
test: submodules
|
|
$(REBAR) ct
|
|
|
|
# Shitty generation. Will be replaced when a container with swagger-codegen appear
|
|
define swagger_regenerate
|
|
rm -rf $(SWAGGER_APP_PATH)
|
|
$(SWAGGER_CODEGEN) generate -i $(SWAGGER_SCHEME) -l erlang-server -o $(SWAGGER_APP_PATH)
|
|
endef
|
|
|
|
$(SWAGGER_APP_TARGET): $(SWAGGER_SCHEME)
|
|
$(call swagger_regenerate)
|
|
|
|
swagger_regenerate:
|
|
$(call swagger_regenerate)
|