diff --git a/.gitignore b/.gitignore index 6c5c0f547..6ae33d8f9 100644 --- a/.gitignore +++ b/.gitignore @@ -34,3 +34,4 @@ Mnesia.*/ *.DS_Store _checkouts rebar.config.rendered +/rebar3 diff --git a/Makefile b/Makefile index 4fcabf260..b047ea8ef 100644 --- a/Makefile +++ b/Makefile @@ -1,4 +1,5 @@ -REBAR = $(CURDIR)/rebar3 +REBAR_VERSION = 3.13.2-emqx-1 +REBAR = ./rebar3 PROFILE ?= emqx PROFILES := emqx emqx-edge @@ -10,6 +11,12 @@ default: $(REBAR) $(PROFILE) .PHONY: all all: $(REBAR) $(PROFILES) +.PHONY: ensure-rebar3 +ensure-rebar3: + @./ensure-rebar3.sh $(REBAR_VERSION) + +$(REBAR): ensure-rebar3 + .PHONY: distclean distclean: @rm -rf _build @@ -27,11 +34,15 @@ endif $(PROFILES:%=build-%): $(REBAR) $(REBAR) as $(@:build-%=%) compile +# rebar clean .PHONY: clean $(PROFILES:%=clean-%) -clean: $(PROFILES:%=clean-%) +clean: $(PROFILES:%=clean-%) clean-stamps $(PROFILES:%=clean-%): $(REBAR) - @rm -rf _build/$(@:clean-%=%) - @rm -rf _build/$(@:clean-%=%)+test + $(REBAR) as $(@:clean-%=%) clean + +.PHONY: clean-stamps +clean-stamps: + find -L _build -name '.stamp' -type f | xargs rm -f .PHONY: deps-all deps-all: $(REBAR) $(PROFILES:%=deps-%) $(PKG_PROFILES:%=deps-%) diff --git a/ensure-rebar3.sh b/ensure-rebar3.sh new file mode 100755 index 000000000..5eaaca164 --- /dev/null +++ b/ensure-rebar3.sh @@ -0,0 +1,20 @@ +#!/bin/bash + +set -euo pipefail + +VERSION="$1" + +download() { + curl -L "https://s3-us-west-2.amazonaws.com/packages.emqx/rebar/rebar3-${VERSION}" -o ./rebar3 +} + +version() { + ./rebar3 -v | grep -v '===' | grep 'rebar.*Erlang' | awk '{print $2}' +} + +if [ -f 'rebar3' ] && [ "$(version)" == "$VERSION" ]; then + exit 0 +fi + +download +chmod +x ./rebar3 diff --git a/rebar.config b/rebar.config index 221d75ce6..57928cef0 100644 --- a/rebar.config +++ b/rebar.config @@ -162,11 +162,11 @@ , {template, "data/loaded_plugins.tmpl", "data/loaded_plugins"} , {template, "data/loaded_modules.tmpl", "data/loaded_modules"} , {template,"data/emqx_vars","releases/emqx_vars"} - , {copy,"{{lib_dirs}}/cuttlefish/cuttlefish","bin/"} + , {copy,"_checkouts/cuttlefish/cuttlefish","bin/"} , {copy,"bin/*","bin/"} , {template,"etc/*.conf","etc/"} , {template,"etc/emqx.d/*.conf","etc/emqx.d/"} - , {copy,"{{lib_dirs}}/emqx/priv/emqx.schema","releases/{{rel_vsn}}/"} + , {copy,"_checkouts/emqx/priv/emqx.schema","releases/{{rel_vsn}}/"} , {copy, "etc/certs","etc/"} , "${RELUP_OVERLAYS}" ] @@ -179,7 +179,7 @@ , {copy,"bin/emqx_ctl","bin/emqx_ctl-{{rel_vsn}}"} , {copy,"bin/install_upgrade.escript", "bin/install_upgrade.escript-{{rel_vsn}}"} , {copy,"bin/nodetool","bin/nodetool-{{rel_vsn}}"} - , {copy,"{{lib_dirs}}/cuttlefish/cuttlefish","bin/cuttlefish-{{rel_vsn}}"} + , {copy,"_checkouts/cuttlefish/cuttlefish","bin/cuttlefish-{{rel_vsn}}"} ] }, diff --git a/rebar3 b/rebar3 deleted file mode 100755 index be1577243..000000000 Binary files a/rebar3 and /dev/null differ