diff --git a/Makefile b/Makefile index 61bd06ba2..1eb5a05e8 100644 --- a/Makefile +++ b/Makefile @@ -1,5 +1,5 @@ $(shell $(CURDIR)/scripts/git-hooks-init.sh) -REBAR_VERSION = 3.14.3-emqx-8 +REBAR_VERSION = 3.18.0-emqx-1 REBAR = $(CURDIR)/rebar3 BUILD = $(CURDIR)/build SCRIPTS = $(CURDIR)/scripts diff --git a/scripts/ensure-rebar3.sh b/scripts/ensure-rebar3.sh index e19af1283..71a7f39ea 100755 --- a/scripts/ensure-rebar3.sh +++ b/scripts/ensure-rebar3.sh @@ -3,6 +3,7 @@ set -euo pipefail VERSION="$1" +REBAR3_FILENAME="${REBAR3_FILENAME:-rebar3}" # ensure dir cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." @@ -10,7 +11,11 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.." DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download' download() { - curl -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3 + curl -f -L "${DOWNLOAD_URL}/${VERSION}/${REBAR3_FILENAME}" -o ./rebar3 +} + +version_gt() { + test "$(echo "$@" | tr " " "n" | sort -V | head -n 1)" != "$1"; } # get the version number from the second line of the escript @@ -24,5 +29,10 @@ if [ -f 'rebar3' ] && [ "$(version)" = "$VERSION" ]; then exit 0 fi +if version_gt "${OTP_VSN}" "24.0.0"; then + echo "$OTP_VSN is greater than 24.0.0" + REBAR3_FILENAME="rebar3_otp24.1.5" +fi + download chmod +x ./rebar3