Merge pull request #6843 from terry-xiaoyu/rebar3_relup_otp24

fix(build): relup for otp24 failed
This commit is contained in:
Shawn 2022-01-25 11:37:30 +08:00 committed by GitHub
commit 1661c203e4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 14 additions and 3 deletions

View File

@ -1,5 +1,4 @@
$(shell $(CURDIR)/scripts/git-hooks-init.sh)
REBAR_VERSION = 3.14.3-emqx-8
REBAR = $(CURDIR)/rebar3
BUILD = $(CURDIR)/build
SCRIPTS = $(CURDIR)/scripts
@ -31,7 +30,7 @@ all: $(REBAR) $(PROFILES)
.PHONY: ensure-rebar3
ensure-rebar3:
@$(SCRIPTS)/fail-on-old-otp-version.escript
@$(SCRIPTS)/ensure-rebar3.sh $(REBAR_VERSION)
@$(SCRIPTS)/ensure-rebar3.sh
$(REBAR): ensure-rebar3

View File

@ -2,7 +2,7 @@
set -euo pipefail
VERSION="$1"
VERSION="3.14.3-emqx-8"
# ensure dir
cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
@ -10,9 +10,14 @@ cd -P -- "$(dirname -- "${BASH_SOURCE[0]}")/.."
DOWNLOAD_URL='https://github.com/emqx/rebar3/releases/download'
download() {
echo "downloading rebar3 ${VERSION}"
curl -f -L "${DOWNLOAD_URL}/${VERSION}/rebar3" -o ./rebar3
}
version_gte() {
test "$(printf '%s\n' "$1" "$2" | sort -V | head -n 1)" = "$2"
}
# get the version number from the second line of the escript
# because command `rebar3 -v` tries to load rebar.config
# which is slow and may print some logs
@ -20,6 +25,13 @@ version() {
head -n 2 ./rebar3 | tail -n 1 | tr ' ' '\n' | grep -E '^.+-emqx-.+'
}
if version_gte "${OTP_VSN}" "24.0"; then
## 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.
VERSION="3.18.0-emqx-1"
fi
if [ -f 'rebar3' ] && [ "$(version)" = "$VERSION" ]; then
exit 0
fi