chore: port ensure-rebar3.sh from 4.x
This commit is contained in:
parent
73ac588255
commit
b05b77bcbc
3
Makefile
3
Makefile
|
@ -1,5 +1,4 @@
|
||||||
$(shell $(CURDIR)/scripts/git-hooks-init.sh)
|
$(shell $(CURDIR)/scripts/git-hooks-init.sh)
|
||||||
REBAR_VERSION = 3.16.1-emqx-1
|
|
||||||
REBAR = $(CURDIR)/rebar3
|
REBAR = $(CURDIR)/rebar3
|
||||||
BUILD = $(CURDIR)/build
|
BUILD = $(CURDIR)/build
|
||||||
SCRIPTS = $(CURDIR)/scripts
|
SCRIPTS = $(CURDIR)/scripts
|
||||||
|
@ -36,7 +35,7 @@ all: $(REBAR) $(PROFILES)
|
||||||
|
|
||||||
.PHONY: ensure-rebar3
|
.PHONY: ensure-rebar3
|
||||||
ensure-rebar3:
|
ensure-rebar3:
|
||||||
@$(SCRIPTS)/ensure-rebar3.sh $(REBAR_VERSION)
|
@$(SCRIPTS)/ensure-rebar3.sh
|
||||||
|
|
||||||
.PHONY: ensure-hex
|
.PHONY: ensure-hex
|
||||||
ensure-hex:
|
ensure-hex:
|
||||||
|
|
|
@ -2,7 +2,21 @@
|
||||||
|
|
||||||
set -euo pipefail
|
set -euo pipefail
|
||||||
|
|
||||||
VERSION="$1"
|
## rebar3 tag 3.18.0-emqx-1 is compiled using otp24.1.5.
|
||||||
|
## we have to use an otp24-compiled rebar3 because the defination of record #application{}
|
||||||
|
## in systools.hrl is changed in otp24.
|
||||||
|
case ${OTP_VSN} in
|
||||||
|
23*)
|
||||||
|
VERSION="3.16.1-emqx-1"
|
||||||
|
;;
|
||||||
|
24*)
|
||||||
|
VERSION="3.18.0-emqx-1"
|
||||||
|
;;
|
||||||
|
*)
|
||||||
|
echo "Unsupporetd Erlang/OTP version $OTP_VSN"
|
||||||
|
exit 1
|
||||||
|
;;
|
||||||
|
esac
|
||||||
|
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
||||||
|
@ -10,7 +24,8 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
|
||||||
DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download'
|
DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download'
|
||||||
|
|
||||||
download() {
|
download() {
|
||||||
curl --silent --show-error -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3
|
echo "downloading rebar3 ${VERSION}"
|
||||||
|
curl -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3
|
||||||
}
|
}
|
||||||
|
|
||||||
# get the version number from the second line of the escript
|
# get the version number from the second line of the escript
|
||||||
|
|
Loading…
Reference in New Issue