Просмотр исходного кода

refactor: stop generating static hot-conf and bridges schema files

Zaiming (Stone) Shi 2 лет назад
Родитель
Сommit
55c488fa95
2 измененных файлов с 2 добавлено и 32 удалено
  1. 0 27
      apps/emqx_conf/src/emqx_conf.erl
  2. 2 5
      build

+ 0 - 27
apps/emqx_conf/src/emqx_conf.erl

@@ -150,7 +150,6 @@ dump_schema(Dir, SchemaModule) ->
     lists:foreach(
         fun(Lang) ->
             ok = gen_config_md(Dir, SchemaModule, Lang),
-            ok = gen_api_schema_json(Dir, Lang),
             ok = gen_schema_json(Dir, SchemaModule, Lang)
         end,
         ["en", "zh"]
@@ -177,28 +176,6 @@ gen_schema_json(Dir, SchemaModule, Lang) ->
     IoData = emqx_utils_json:encode(JsonMap, [pretty, force_utf8]),
     ok = file:write_file(SchemaJsonFile, IoData).
 
-%% TODO: delete this function when we stop generating this JSON at build time.
-gen_api_schema_json(Dir, Lang) ->
-    gen_api_schema_json_hotconf(Dir, Lang),
-    gen_api_schema_json_bridge(Dir, Lang).
-
-%% TODO: delete this function when we stop generating this JSON at build time.
-gen_api_schema_json_hotconf(Dir, Lang) ->
-    File = schema_filename(Dir, "hot-config-schema-", Lang),
-    IoData = hotconf_schema_json(),
-    ok = write_api_schema_json_file(File, IoData).
-
-%% TODO: delete this function when we stop generating this JSON at build time.
-gen_api_schema_json_bridge(Dir, Lang) ->
-    File = schema_filename(Dir, "bridge-api-", Lang),
-    IoData = bridge_schema_json(),
-    ok = write_api_schema_json_file(File, IoData).
-
-%% TODO: delete this function when we stop generating this JSON at build time.
-write_api_schema_json_file(File, IoData) ->
-    io:format(user, "===< Generating: ~s~n", [File]),
-    file:write_file(File, IoData).
-
 %% TODO: move this function to emqx_dashboard when we stop generating this JSON at build time.
 hotconf_schema_json() ->
     SchemaInfo = #{title => <<"EMQX Hot Conf API Schema">>, version => <<"0.1.0">>},
@@ -209,10 +186,6 @@ bridge_schema_json() ->
     SchemaInfo = #{title => <<"EMQX Data Bridge API Schema">>, version => <<"0.1.0">>},
     gen_api_schema_json_iodata(emqx_bridge_api, SchemaInfo).
 
-schema_filename(Dir, Prefix, Lang) ->
-    Filename = Prefix ++ Lang ++ ".json",
-    filename:join([Dir, Filename]).
-
 %% TODO: remove it and also remove hocon_md.erl and friends.
 %% markdown generation from schema is a failure and we are moving to an interactive
 %% viewer like swagger UI.

+ 2 - 5
build

@@ -92,7 +92,7 @@ log() {
 }
 
 make_docs() {
-    local libs_dir1 libs_dir2 libs_dir3 docdir dashboard_www_static
+    local libs_dir1 libs_dir2 libs_dir3 docdir
     libs_dir1="$("$FIND" "_build/$PROFILE/lib/" -maxdepth 2 -name ebin -type d)"
     if [ -d "_build/default/lib/" ]; then
         libs_dir2="$("$FIND" "_build/default/lib/" -maxdepth 2 -name ebin -type d)"
@@ -113,14 +113,11 @@ make_docs() {
             ;;
     esac
     docdir="_build/docgen/$PROFILE"
-    dashboard_www_static='apps/emqx_dashboard/priv/www/static/'
-    mkdir -p "$docdir" "$dashboard_www_static"
+    mkdir -p "$docdir"
     # shellcheck disable=SC2086
     erl -noshell -pa $libs_dir1 $libs_dir2 $libs_dir3 -eval \
         "ok = emqx_conf:dump_schema('$docdir', $SCHEMA_MODULE), \
          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() {