commit
b846ae5e30
|
@ -0,0 +1,36 @@
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
%% Copyright (c) 2021 EMQ Technologies Co., Ltd. All Rights Reserved.
|
||||||
|
%%
|
||||||
|
%% Licensed under the Apache License, Version 2.0 (the "License");
|
||||||
|
%% you may not use this file except in compliance with the License.
|
||||||
|
%% You may obtain a copy of the License at
|
||||||
|
%%
|
||||||
|
%% http://www.apache.org/licenses/LICENSE-2.0
|
||||||
|
%%
|
||||||
|
%% Unless required by applicable law or agreed to in writing, software
|
||||||
|
%% distributed under the License is distributed on an "AS IS" BASIS,
|
||||||
|
%% WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||||
|
%% See the License for the specific language governing permissions and
|
||||||
|
%% limitations under the License.
|
||||||
|
%%--------------------------------------------------------------------
|
||||||
|
|
||||||
|
-ifndef(EMQX_RELEASE_HRL).
|
||||||
|
-define(EMQX_RELEASE_HRL, true).
|
||||||
|
|
||||||
|
%% NOTE: this is the release version which is not always the same
|
||||||
|
%% as the emqx app version defined in emqx.app.src
|
||||||
|
%% App (plugin) versions are bumped independently.
|
||||||
|
%% e.g. EMQX_RELEASE being 4.3.1 does no always imply emqx app
|
||||||
|
%% should be 4.3.1, as it might be the case that only one of the
|
||||||
|
%% plugins had a bug to fix. So for a hot beam upgrade, only the app
|
||||||
|
%% with beam files changed needs an upgrade.
|
||||||
|
|
||||||
|
%% NOTE: The version string prefix should be:
|
||||||
|
%% 'v' for opensource edition
|
||||||
|
%% 'e' for enterprise edition
|
||||||
|
|
||||||
|
%% NOTE: This version number should be manually bumped for each release
|
||||||
|
|
||||||
|
-define(EMQX_RELEASE, "v4.3-beta.1").
|
||||||
|
|
||||||
|
-endif.
|
13
pkg-vsn.sh
13
pkg-vsn.sh
|
@ -1,20 +1,15 @@
|
||||||
#!/usr/bin/env bash
|
#!/usr/bin/env bash
|
||||||
set -e -u
|
set -euo pipefail
|
||||||
|
|
||||||
# This script prints the release version for emqx
|
# This script prints the release version for emqx
|
||||||
|
|
||||||
# ensure dir
|
# ensure dir
|
||||||
cd -P -- "$(dirname -- "$0")"
|
cd -P -- "$(dirname -- "$0")"
|
||||||
|
|
||||||
case $(uname) in
|
RELEASE="$(grep -E 'define.+EMQX_RELEASE,' include/emqx_release.hrl | cut -d '"' -f2)"
|
||||||
*Darwin*) SED="sed -E";;
|
|
||||||
*) SED="sed -r";;
|
|
||||||
esac
|
|
||||||
|
|
||||||
# comment SUFFIX out when finalising RELEASE
|
if [ -d .git ] && ! git describe --tags --match "${RELEASE}" --exact >/dev/null 2>&1; then
|
||||||
RELEASE="$(grep -oE '\{vsn, (.*)\}' src/emqx.app.src | $SED 's/\{vsn, (.*)\}/\1/g' | $SED 's/\"//g')"
|
SUFFIX="-$(git rev-parse HEAD | cut -b1-8)"
|
||||||
if [ -d .git ] && ! git describe --tags --match "v${RELEASE}" --exact >/dev/null 2>&1; then
|
|
||||||
SUFFIX="-$(git rev-parse HEAD | cut -b1-8)"
|
|
||||||
fi
|
fi
|
||||||
|
|
||||||
echo "${RELEASE}${SUFFIX:-}"
|
echo "${RELEASE}${SUFFIX:-}"
|
||||||
|
|
|
@ -294,8 +294,7 @@ get_vsn() ->
|
||||||
false -> os:cmd("./pkg-vsn.sh");
|
false -> os:cmd("./pkg-vsn.sh");
|
||||||
Vsn -> Vsn
|
Vsn -> Vsn
|
||||||
end,
|
end,
|
||||||
Vsn2 = re:replace(PkgVsn, "v", "", [{return ,list}]),
|
re:replace(PkgVsn, "\n", "", [{return ,list}]).
|
||||||
re:replace(Vsn2, "\n", "", [{return ,list}]).
|
|
||||||
|
|
||||||
maybe_dump(Config) ->
|
maybe_dump(Config) ->
|
||||||
is_debug() andalso file:write_file("rebar.config.rendered", [io_lib:format("~p.\n", [I]) || I <- Config]),
|
is_debug() andalso file:write_file("rebar.config.rendered", [io_lib:format("~p.\n", [I]) || I <- Config]),
|
||||||
|
|
|
@ -1,7 +1,7 @@
|
||||||
{application, emqx,
|
{application, emqx,
|
||||||
[{description, "EMQ X Broker"},
|
[{description, "EMQ X Broker"},
|
||||||
{id, "emqx"},
|
{id, "emqx"},
|
||||||
{vsn, "4.3-beta.1"}, % strict semver, bump manually!
|
{vsn, "4.3.0"}, % strict semver, bump manually!
|
||||||
{modules, []},
|
{modules, []},
|
||||||
{registered, []},
|
{registered, []},
|
||||||
{applications, [kernel,stdlib,gproc,gen_rpc,esockd,cowboy,sasl,os_mon]},
|
{applications, [kernel,stdlib,gproc,gen_rpc,esockd,cowboy,sasl,os_mon]},
|
||||||
|
|
|
@ -20,10 +20,13 @@
|
||||||
|
|
||||||
-export([ start/2
|
-export([ start/2
|
||||||
, stop/1
|
, stop/1
|
||||||
|
, get_release/0
|
||||||
]).
|
]).
|
||||||
|
|
||||||
-define(APP, emqx).
|
-define(APP, emqx).
|
||||||
|
|
||||||
|
-include("emqx_release.hrl").
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Application callbacks
|
%% Application callbacks
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
|
@ -57,8 +60,19 @@ print_banner() ->
|
||||||
|
|
||||||
print_vsn() ->
|
print_vsn() ->
|
||||||
{ok, Descr} = application:get_key(description),
|
{ok, Descr} = application:get_key(description),
|
||||||
{ok, Vsn} = application:get_key(vsn),
|
io:format("~s ~s is running now!~n", [Descr, get_release()]).
|
||||||
io:format("~s ~s is running now!~n", [Descr, Vsn]).
|
|
||||||
|
-ifdef(TEST).
|
||||||
|
%% When testing, the 'cover' compiler stripps aways compile info
|
||||||
|
get_release() -> ?EMQX_RELEASE.
|
||||||
|
-else.
|
||||||
|
%% Otherwise print the build number,
|
||||||
|
%% which may have a git commit in its suffix.
|
||||||
|
get_release() ->
|
||||||
|
{_, Vsn} = lists:keyfind(emqx_vsn, 1, ?MODULE:module_info(compile)),
|
||||||
|
?EMQX_RELEASE ++ _ = Vsn, %% assert
|
||||||
|
Vsn.
|
||||||
|
-endif.
|
||||||
|
|
||||||
%%--------------------------------------------------------------------
|
%%--------------------------------------------------------------------
|
||||||
%% Autocluster
|
%% Autocluster
|
||||||
|
|
Loading…
Reference in New Issue