Sfoglia il codice sorgente

build: work with new emqx app location

Zaiming Shi 4 anni fa
parent
commit
c573474ec6
4 ha cambiato i file con 14 aggiunte e 14 eliminazioni
  1. 7 5
      rebar.config.erl
  2. 0 3
      scripts/find-apps.sh
  3. 1 4
      scripts/find-suites.sh
  4. 6 2
      scripts/split-config.escript

+ 7 - 5
rebar.config.erl

@@ -351,7 +351,7 @@ etc_overlay(ReleaseType) ->
                 [community_plugin_etc_overlays(App) || App <- relx_plugin_apps_extra()],
                 [community_plugin_etc_overlays(App) || App <- relx_plugin_apps_extra()],
     [ {mkdir, "etc/"}
     [ {mkdir, "etc/"}
     , {mkdir, "etc/plugins"}
     , {mkdir, "etc/plugins"}
-    , {template, "etc/BUILT_ON", "releases/{{release_version}}/BUILT_ON"}
+    , {template, "{{base_dir}}/lib/emqx/etc/BUILT_ON", "releases/{{release_version}}/BUILT_ON"}
     , {copy, "{{base_dir}}/lib/emqx/etc/certs","etc/"}
     , {copy, "{{base_dir}}/lib/emqx/etc/certs","etc/"}
     ] ++
     ] ++
     lists:map(
     lists:map(
@@ -368,18 +368,20 @@ extra_overlay(edge) ->
     [].
     [].
 emqx_etc_overlay(cloud) ->
 emqx_etc_overlay(cloud) ->
     emqx_etc_overlay_common() ++
     emqx_etc_overlay_common() ++
-    [ {"etc/emqx_cloud/vm.args","etc/vm.args"}
+    [ {"{{base_dir}}/lib/emqx/etc/emqx_cloud/vm.args","etc/vm.args"}
     ];
     ];
 emqx_etc_overlay(edge) ->
 emqx_etc_overlay(edge) ->
     emqx_etc_overlay_common() ++
     emqx_etc_overlay_common() ++
-    [ {"etc/emqx_edge/vm.args","etc/vm.args"}
+    [ {"{{base_dir}}/lib/emqx/etc/emqx_edge/vm.args","etc/vm.args"}
     ].
     ].
 
 
 emqx_etc_overlay_common() ->
 emqx_etc_overlay_common() ->
-    ["etc/acl.conf", "etc/emqx.conf", "etc/ssl_dist.conf",
+    [{"{{base_dir}}/lib/emqx/etc/acl.conf", "etc/acl.conf"},
+     {"{{base_dir}}/lib/emqx/etc/emqx.conf", "etc/emqx.conf"},
+     {"{{base_dir}}/lib/emqx/etc/ssl_dist.conf", "etc/ssl_dist.conf"},
      %% TODO: check why it has to end with .paho
      %% TODO: check why it has to end with .paho
      %% and why it is put to etc/plugins dir
      %% and why it is put to etc/plugins dir
-     {"etc/acl.conf.paho", "etc/plugins/acl.conf.paho"}].
+     {"{{base_dir}}/lib/emqx/etc/acl.conf.paho", "etc/plugins/acl.conf.paho"}].
 
 
 plugin_etc_overlays(App0) ->
 plugin_etc_overlays(App0) ->
     App = atom_to_list(App0),
     App = atom_to_list(App0),

+ 0 - 3
scripts/find-apps.sh

@@ -10,9 +10,6 @@ find_app() {
     find "${appdir}" -mindepth 1 -maxdepth 1 -type d
     find "${appdir}" -mindepth 1 -maxdepth 1 -type d
 }
 }
 
 
-# append emqx application first
-echo 'emqx'
-
 find_app 'apps'
 find_app 'apps'
 if [ -f 'EMQX_ENTERPRISE' ]; then
 if [ -f 'EMQX_ENTERPRISE' ]; then
     find_app 'lib-ee'
     find_app 'lib-ee'

+ 1 - 4
scripts/find-suites.sh

@@ -8,8 +8,5 @@ set -euo pipefail
 # ensure dir
 # ensure dir
 cd -P -- "$(dirname -- "$0")/.."
 cd -P -- "$(dirname -- "$0")/.."
 
 
-TESTDIR="test"
-if [ "$1" != "emqx" ]; then
-    TESTDIR="$1/test"
-fi
+TESTDIR="$1/test"
 find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | xargs | tr ' ' ','
 find "${TESTDIR}" -name "*_SUITE.erl" 2>/dev/null | xargs | tr ' ' ','

+ 6 - 2
scripts/split-config.escript

@@ -13,7 +13,7 @@
 -define(BASE, <<"emqx">>).
 -define(BASE, <<"emqx">>).
 
 
 main(_) ->
 main(_) ->
-    {ok, Bin} = file:read_file("etc/emqx.conf"),
+    {ok, Bin} = file:read_file(conf_file()),
     Lines = binary:split(Bin, <<"\n">>, [global]),
     Lines = binary:split(Bin, <<"\n">>, [global]),
     Sections0 = parse_sections(Lines),
     Sections0 = parse_sections(Lines),
     {value, _, Sections1} = lists:keytake(<<"modules">>, 1, Sections0),
     {value, _, Sections1} = lists:keytake(<<"modules">>, 1, Sections0),
@@ -24,6 +24,10 @@ main(_) ->
     end, IncludeNames),
     end, IncludeNames),
     ok = dump_sections([{N, Base ++ Includes}| Sections2]).
     ok = dump_sections([{N, Base ++ Includes}| Sections2]).
 
 
+etc_dir() -> filename:join(["apps", "emqx", "etc"]).
+
+conf_file() -> filename:join([etc_dir(), "emqx.conf"]).
+
 parse_sections(Lines) ->
 parse_sections(Lines) ->
     {ok, P} = re:compile("#+\s*CONFIG_SECTION_(BGN|END)\s*=\s*([^\s-]+)\s*="),
     {ok, P} = re:compile("#+\s*CONFIG_SECTION_(BGN|END)\s*=\s*([^\s-]+)\s*="),
     Parser =
     Parser =
@@ -57,7 +61,7 @@ parse_sections([Line | Lines], Parse, Section, Sections) ->
 
 
 dump_sections([]) -> ok;
 dump_sections([]) -> ok;
 dump_sections([{Name, Lines0} | Rest]) ->
 dump_sections([{Name, Lines0} | Rest]) ->
-    Filename = filename:join(["etc", iolist_to_binary([Name, ".conf.seg"])]),
+    Filename = filename:join([etc_dir(), iolist_to_binary([Name, ".conf.seg"])]),
     Lines = [[L, "\n"] || L <- Lines0],
     Lines = [[L, "\n"] || L <- Lines0],
     ok = file:write_file(Filename, Lines),
     ok = file:write_file(Filename, Lines),
     dump_sections(Rest).
     dump_sections(Rest).