فهرست منبع

ci: build dialyzer PLT with quicer, jq and bcrypt

William Yang 3 سال پیش
والد
کامیت
282d1a6829
2فایلهای تغییر یافته به همراه28 افزوده شده و 12 حذف شده
  1. 14 1
      apps/emqx/rebar.config.script
  2. 14 11
      rebar.config.erl

+ 14 - 1
apps/emqx/rebar.config.script

@@ -26,6 +26,19 @@ end,
 Bcrypt = {bcrypt, {git, "https://github.com/emqx/erlang-bcrypt.git", {tag, "0.6.0"}}},
 Quicer = {quicer, {git, "https://github.com/emqx/quic.git", {tag, "0.0.104"}}}.
 
+Dialyzer = fun(Config) ->
+                   {dialyzer, OldDialyzerConfig} = lists:keyfind(dialyzer, 1, Config),
+                   {plt_extra_apps, OldExtra} = lists:keyfind(plt_extra_apps, 1, OldDialyzerConfig),
+                   Extra = OldExtra ++ [quicer || IsQuicSupp()],
+                   NewDialyzerConfig = [{plt_extra_apps, Extra} | OldDialyzerConfig],
+                   lists:keystore(
+                     dialyzer,
+                     1,
+                     Config,
+                     {dialyzer, NewDialyzerConfig}
+                    )
+           end.
+
 ExtraDeps = fun(C) ->
     {deps, Deps0} = lists:keyfind(deps, 1, C),
     {erl_opts, ErlOpts0} = lists:keyfind(erl_opts, 1, C),
@@ -43,4 +56,4 @@ ExtraDeps = fun(C) ->
     )
 end,
 
-ExtraDeps(CONFIG).
+Dialyzer(ExtraDeps(CONFIG)).

+ 14 - 11
rebar.config.erl

@@ -548,17 +548,20 @@ dialyzer(Config) ->
 
     AppsToExclude = AppNames -- KnownApps,
 
-    case length(AppsToAnalyse) > 0 of
-        true ->
-            lists:keystore(
-                dialyzer,
-                1,
-                Config,
-                {dialyzer, OldDialyzerConfig ++ [{exclude_apps, AppsToExclude}]}
-            );
-        false ->
-            Config
-    end.
+    Extra =
+        [bcrypt || provide_bcrypt_dep()] ++
+            [jq || is_jq_supported()] ++
+            [quicer || is_quicer_supported()],
+    NewDialyzerConfig =
+        OldDialyzerConfig ++
+            [{exclude_apps, AppsToExclude} || length(AppsToAnalyse) > 0] ++
+            [{plt_extra_apps, Extra} || length(Extra) > 0],
+    lists:keystore(
+        dialyzer,
+        1,
+        Config,
+        {dialyzer, NewDialyzerConfig}
+    ).
 
 coveralls() ->
     case {os:getenv("GITHUB_ACTIONS"), os:getenv("GITHUB_TOKEN")} of