Merge pull request #10109 from zmstone/0308-stop-releasing-schema.json-in-rel-package

0308 stop releasing schema.json in rel package
This commit is contained in:
Zaiming (Stone) Shi 2023-03-13 14:27:15 +01:00 committed by GitHub
commit 0c5ab5183a
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 18 additions and 9 deletions

View File

@ -146,8 +146,7 @@ dump_schema(Dir, SchemaModule, I18nFile) ->
fun(Lang) -> fun(Lang) ->
gen_config_md(Dir, I18nFile, SchemaModule, Lang), gen_config_md(Dir, I18nFile, SchemaModule, Lang),
gen_api_schema_json(Dir, I18nFile, Lang), gen_api_schema_json(Dir, I18nFile, Lang),
ExampleDir = filename:join(filename:dirname(filename:dirname(I18nFile)), "etc"), gen_example_conf(Dir, I18nFile, SchemaModule, Lang)
gen_example_conf(ExampleDir, I18nFile, SchemaModule, Lang)
end, end,
[en, zh] [en, zh]
), ),

12
build
View File

@ -92,7 +92,7 @@ log() {
} }
make_docs() { make_docs() {
local libs_dir1 libs_dir2 libs_dir3 local libs_dir1 libs_dir2 libs_dir3 docdir dashboard_www_static
libs_dir1="$("$FIND" "_build/$PROFILE/lib/" -maxdepth 2 -name ebin -type d)" libs_dir1="$("$FIND" "_build/$PROFILE/lib/" -maxdepth 2 -name ebin -type d)"
if [ -d "_build/default/lib/" ]; then if [ -d "_build/default/lib/" ]; then
libs_dir2="$("$FIND" "_build/default/lib/" -maxdepth 2 -name ebin -type d)" libs_dir2="$("$FIND" "_build/default/lib/" -maxdepth 2 -name ebin -type d)"
@ -112,12 +112,16 @@ make_docs() {
SCHEMA_MODULE='emqx_conf_schema' SCHEMA_MODULE='emqx_conf_schema'
;; ;;
esac esac
docdir="_build/docgen/$PROFILE"
dashboard_www_static='apps/emqx_dashboard/priv/www/static/'
mkdir -p "$docdir" "$dashboard_www_static"
# shellcheck disable=SC2086 # shellcheck disable=SC2086
erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \ erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \
"Dir = filename:join([apps, emqx_dashboard, priv, www, static]), \ "I18nFile = filename:join([apps, emqx_dashboard, priv, 'i18n.conf']), \
I18nFile = filename:join([apps, emqx_dashboard, priv, 'i18n.conf']), \ ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE, I18nFile), \
ok = emqx_conf:dump_schema(Dir, $SCHEMA_MODULE, I18nFile), \
halt(0)." halt(0)."
cp "$docdir"/bridge-api-*.json "$dashboard_www_static"
cp "$docdir"/hot-config-schema-*.json "$dashboard_www_static"
} }
assert_no_compile_time_only_deps() { assert_no_compile_time_only_deps() {

View File

@ -373,9 +373,11 @@ defmodule EMQXUmbrella.MixProject do
Path.join(etc, "certs") Path.join(etc, "certs")
) )
profile = System.get_env("MIX_ENV")
Mix.Generator.copy_file( Mix.Generator.copy_file(
"apps/emqx_dashboard/etc/emqx.conf.en.example", "_build/docgen/#{profile}/emqx.conf.en.example",
Path.join(etc, "emqx-example.conf"), Path.join(etc, "emqx.conf.example"),
force: overwrite? force: overwrite?
) )

View File

@ -462,7 +462,8 @@ etc_overlay(ReleaseType, Edition) ->
[ [
{mkdir, "etc/"}, {mkdir, "etc/"},
{copy, "{{base_dir}}/lib/emqx/etc/certs", "etc/"}, {copy, "{{base_dir}}/lib/emqx/etc/certs", "etc/"},
{copy, "apps/emqx_dashboard/etc/emqx.conf.en.example", "etc/emqx-example.conf"} {copy, "_build/docgen/" ++ name(Edition) ++ "/emqx.conf.en.example",
"etc/emqx.conf.example"}
] ++ ] ++
lists:map( lists:map(
fun fun
@ -598,3 +599,6 @@ list_dir(Dir) ->
false -> false ->
[] []
end. end.
name(ce) -> "emqx";
name(ee) -> "emqx-enterprise".