url-shortener/Makefile
Toporkov Igor 1b31deb9f7
MSPF-396: update to erlang 21 (#13)
* MSPF-396: update to erlang 21 (#12)

* Setup to run on local machine

* Migrated to new erlang/cowboy with dependencies

* Updated dependecies & fixed wrong error handling

* Removed redundant dependecy and hid generated apps

* Removed extra cors module, added Options to handler

* Fixed middleware misplacement, and properly implemented handler behaviour

* cleaned up

* returned to url instead of http in private repos

* Returned to using cowboy_cors as CORS app, fixed typing, added epic branches rules for Jenkins

* added missing dependency, divided net_opts option

* Updated cors policy, added cors tests

* Reverted unnessesary Jenkinsfile changes

* Suppresed jesse warnings

* Updated build image tag

* Switched to using new jesse and parse_trans

* Bumped utils and image tags, updated registry

* bumped base image

* bumped build_utils, removed registry redefinition

* Refreshed outdated config (#14)

* bumped erlang-health, fixed lager crash

* Upgraded lager, restored redirection, refreshed config

* Refreshed deprecated ranch opts passing

* Switched to master branches

* Bumped build image
2019-04-03 17:20:56 +03:00

103 lines
2.3 KiB
Makefile

REBAR := $(shell which rebar3 2>/dev/null || which ./rebar3)
SUBMODULES = schemes/swag-url-shortener build_utils
SUBTARGETS = $(patsubst %,%/.git,$(SUBMODULES))
UTILS_PATH := build_utils
TEMPLATES_PATH := .
# Name of the service
SERVICE_NAME := url-shortener
# 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 := bdb3e60ddc70044bae1aa581d260d3a9803a2477
# Build image tag to be used
BUILD_IMAGE_TAG := a166721af4f3454345d443bc681b91962d259d40
CALL_ANYWHERE := all submodules rebar-update compile xref lint dialyze start devrel release clean distclean
CALL_W_CONTAINER := $(CALL_ANYWHERE) test
all: compile
-include $(UTILS_PATH)/make_lib/utils_container.mk
-include $(UTILS_PATH)/make_lib/utils_image.mk
.PHONY: $(CALL_W_CONTAINER)
# CALL_ANYWHERE
$(SUBTARGETS): %/.git: %
git submodule update --init $<
touch $@
submodules: $(SUBTARGETS)
rebar-update:
$(REBAR) update
compile: submodules rebar-update generate
$(REBAR) compile
xref: submodules
$(REBAR) xref
lint:
elvis rock
dialyze:
$(REBAR) dialyzer
start: submodules
$(REBAR) run
devrel: submodules
$(REBAR) release
release: submodules generate
$(REBAR) as prod release
clean::
$(REBAR) clean
distclean::
$(REBAR) clean -a
rm -rf _build
# CALL_W_CONTAINER
test: submodules generate
$(REBAR) ct
# Swagger stuff
SWAGGER_CODEGEN = $(call which, swagger-codegen)
SWAGGER_SCHEME_PATH = schemes/swag-url-shortener
SWAGGER_SCHEME = $(SWAGGER_SCHEME_PATH)/swagger.yaml
$(SWAGGER_SCHEME): $(SWAGGER_SCHEME_PATH)/.git
SWAGGER_SERVER_PATH = apps/swag_server
SWAGGER_CLIENT_PATH = apps/swag_client
generate:: swag.server.generate swag.client.generate
swag.server.generate: $(SWAGGER_SERVER_PATH)
swag.client.generate: $(SWAGGER_CLIENT_PATH)
distclean:: swag.server.distclean swag.client.distclean
swag.server.distclean:
rm -rf $(SWAGGER_SERVER_PATH)
swag.client.distclean:
rm -rf $(SWAGGER_CLIENT_PATH)
$(SWAGGER_SERVER_PATH) $(SWAGGER_CLIENT_PATH): $(SWAGGER_SCHEME)
$(SWAGGER_CODEGEN) generate \
-i $^ \
-l $(if $(findstring server,$@),erlang-server,erlang-client) \
-o $@ \
--additional-properties packageName=$(notdir $(basename $@))