فهرست منبع

build: workaround for windows build

William Yang 3 سال پیش
والد
کامیت
45e2605485
6فایلهای تغییر یافته به همراه30 افزوده شده و 16 حذف شده
  1. 20 12
      apps/emqx/rebar.config.script
  2. 5 0
      apps/emqx/src/emqx_quic_connection.erl
  3. 0 1
      apps/emqx/src/emqx_quic_stream.erl
  4. 1 1
      apps/emqx_connector/rebar.config
  5. 2 1
      mix.exs
  6. 2 1
      rebar.config.erl

+ 20 - 12
apps/emqx/rebar.config.script

@@ -13,26 +13,34 @@ IsWin32 = fun() ->
 end,
 
 IsMacOS = fun() ->
-               {unix, darwin} =:= os:type()
-          end,
+    {unix, darwin} =:= os:type()
+end,
 
 IsQuicSupp = fun() ->
-                not (IsCentos6() orelse IsWin32()
-                     orelse IsMacOS() orelse
-                     false =/= os:getenv("BUILD_WITHOUT_QUIC")
-                    )
-                orelse "1" == os:getenv("BUILD_WITH_QUIC")
-             end,
+    not (IsCentos6() orelse IsWin32() orelse
+        IsMacOS() orelse
+        false =/= os:getenv("BUILD_WITHOUT_QUIC")) orelse
+        "1" == os:getenv("BUILD_WITH_QUIC")
+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.11"}}}.
 
 ExtraDeps = fun(C) ->
     {deps, Deps0} = lists:keyfind(deps, 1, C),
-    Deps =
-        Deps0 ++ [Bcrypt || not IsWin32()] ++
-            [Quicer || IsQuicSupp()],
-    lists:keystore(deps, 1, C, {deps, Deps})
+    {erl_opts, ErlOpts0} = lists:keyfind(erl_opts, 1, C),
+    IsQuic = IsQuicSupp(),
+    New = [
+        {deps, Deps0 ++ [Bcrypt || not IsWin32()] ++ [Quicer || IsQuic]},
+        {erl_opts, ErlOpts0 ++ [{d, 'BUILD_WITHOUT_QUIC'} || not IsQuic]}
+    ],
+    lists:foldl(
+        fun({Key, _Val} = KV, Acc) ->
+            lists:keystore(Key, 1, Acc, KV)
+        end,
+        C,
+        New
+    )
 end,
 
 ExtraDeps(CONFIG).

+ 5 - 0
apps/emqx/src/emqx_quic_connection.erl

@@ -15,7 +15,12 @@
 %%--------------------------------------------------------------------
 
 -module(emqx_quic_connection).
+
+-ifndef(BUILD_WITHOUT_QUIC).
 -include_lib("quicer/include/quicer.hrl").
+-else.
+-define(QUIC_CONNECTION_SHUTDOWN_FLAG_NONE, 0).
+-endif.
 
 %% Callbacks
 -export([

+ 0 - 1
apps/emqx/src/emqx_quic_stream.erl

@@ -16,7 +16,6 @@
 
 %% MQTT/QUIC Stream
 -module(emqx_quic_stream).
--include_lib("quicer/include/quicer.hrl").
 
 %% emqx transport Callbacks
 -export([

+ 1 - 1
apps/emqx_connector/rebar.config

@@ -21,7 +21,7 @@
     %% eredis_cluster's dependency getting resolved earlier.
     %% Here we pin 1.5.2 to avoid surprises in the future.
     {poolboy, {git, "https://github.com/emqx/poolboy.git", {tag, "1.5.2"}}},
-    {emqtt, {git, "https://github.com/emqx/emqtt", {tag, "1.5.1"}}}
+    {emqtt, {git, "https://github.com/qzhuyan/emqtt", {branch, "dev/william/bump-quicer"}}}
 ]}.
 
 {shell, [

+ 2 - 1
mix.exs

@@ -58,7 +58,8 @@ defmodule EMQXUmbrella.MixProject do
       {:ecpool, github: "emqx/ecpool", tag: "0.5.2"},
       {:replayq, "0.3.4", override: true},
       {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4", override: true},
-      {:emqtt, github: "emqx/emqtt", tag: "1.5.1", override: true},
+      # {:emqtt, github: "emqx/emqtt", tag: "1.5.1", override: true},
+      {:emqtt, github: "qzhuyan/emqtt", branch: "dev/william/bump-quicer", override: true},
       {:rulesql, github: "emqx/rulesql", tag: "0.1.4"},
       {:observer_cli, "1.7.1"},
       {:system_monitor, github: "ieQu1/system_monitor", tag: "3.0.3"},

+ 2 - 1
rebar.config.erl

@@ -138,7 +138,8 @@ common_compile_opts(Edition, Vsn) ->
         {compile_info, [{emqx_vsn, Vsn}]},
         {d, 'EMQX_RELEASE_EDITION', Edition}
     ] ++
-        [{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1"].
+        [{d, 'EMQX_BENCHMARK'} || os:getenv("EMQX_BENCHMARK") =:= "1"] ++
+        [{d, 'BUILD_WITHOUT_QUIC'} || not is_quicer_supported()].
 
 prod_compile_opts(Edition, Vsn) ->
     [