From b76334ea01f52f10cb4057905203b669d3e1397d Mon Sep 17 00:00:00 2001 From: x1001100011 Date: Sun, 17 Oct 2021 21:04:46 -0700 Subject: [PATCH] feat: patch after merge master branch --- apps/emqx/mix.exs | 3 ++- apps/emqx/src/emqx_alarm_handler.erl | 1 - apps/emqx_exhook/mix.exs | 26 ++++++++++++++++++++++ apps/emqx_limiter/mix.exs | 32 ++++++++++++++++++++++++++++ mix.lock | 1 + 5 files changed, 61 insertions(+), 2 deletions(-) create mode 100644 apps/emqx_limiter/mix.exs diff --git a/apps/emqx/mix.exs b/apps/emqx/mix.exs index 6651c6cc4..02910e09a 100644 --- a/apps/emqx/mix.exs +++ b/apps/emqx/mix.exs @@ -35,7 +35,8 @@ defmodule EMQX.MixProject do {:hocon, github: "emqx/hocon"}, {:pbkdf2, github: "emqx/erlang-pbkdf2", tag: "2.0.4"}, {:snabbkaffe, github: "kafka4beam/snabbkaffe", tag: "0.14.0"}, - {:jiffy, github: "emqx/jiffy", tag: "1.0.5"} + {:jiffy, github: "emqx/jiffy", tag: "1.0.5"}, + {:lc, github: "qzhuyan/lc", tag: "0.1.1"} ] end end diff --git a/apps/emqx/src/emqx_alarm_handler.erl b/apps/emqx/src/emqx_alarm_handler.erl index 4cf699895..f02f59721 100644 --- a/apps/emqx/src/emqx_alarm_handler.erl +++ b/apps/emqx/src/emqx_alarm_handler.erl @@ -22,7 +22,6 @@ -include("logger.hrl"). -include_lib("lc/include/lc.hrl"). - %% gen_event callbacks -export([ init/1 , handle_event/2 diff --git a/apps/emqx_exhook/mix.exs b/apps/emqx_exhook/mix.exs index af7c10ea4..af0769157 100644 --- a/apps/emqx_exhook/mix.exs +++ b/apps/emqx_exhook/mix.exs @@ -10,6 +10,8 @@ defmodule EMQXExhook.MixProject do deps_path: "../../deps", lockfile: "../../mix.lock", elixir: "~> 1.12", + compilers: [:protos | Mix.compilers()], + aliases: ["compile.protos": &protos/1], start_permanent: Mix.env() == :prod, deps: deps(), description: "EMQ X Extension for Hook" @@ -30,4 +32,28 @@ defmodule EMQXExhook.MixProject do {:grpc, github: "emqx/grpc-erl", tag: "0.6.2"} ] end + + defp protos(_args) do + app_path = Path.expand("..", __ENV__.file) + config = [ + :use_packages, + :maps, + :strings_as_binaries, + rename: {:msg_name, :snake_case}, + rename: {:msg_fqname, :base_name}, + i: '.', + report_errors: false, + o: app_path |> Path.join("src") |> to_charlist(), + module_name_prefix: 'emqx_', + module_name_suffix: '_pb' + ] + + app_path + |> Path.join("priv/protos/*.proto") + |> Path.wildcard() + |> Enum.map(&to_charlist/1) + |> Enum.each(&:gpb_compile.file(&1, config)) + + :ok + end end diff --git a/apps/emqx_limiter/mix.exs b/apps/emqx_limiter/mix.exs new file mode 100644 index 000000000..7060ed7bc --- /dev/null +++ b/apps/emqx_limiter/mix.exs @@ -0,0 +1,32 @@ +defmodule EMQXLimiter.MixProject do + use Mix.Project + + def project do + [ + app: :emqx_limiter, + version: "1.0.0", + build_path: "../../_build", + config_path: "../../config/config.exs", + deps_path: "../../deps", + lockfile: "../../mix.lock", + elixir: "~> 1.12", + start_permanent: Mix.env() == :prod, + deps: deps(), + description: "EMQ X Hierachical Limiter" + ] + end + + def application do + [ + registered: [:emqx_limiter_sup], + mod: {:emqx_limiter_app, []}, + extra_applications: [:logger] + ] + end + + defp deps do + [ + {:emqx, in_umbrella: true, runtime: false} + ] + end +end diff --git a/mix.lock b/mix.lock index 0aa53b223..f854336ca 100644 --- a/mix.lock +++ b/mix.lock @@ -25,6 +25,7 @@ "jiffy": {:git, "https://github.com/emqx/jiffy.git", "baa1f4e750ae3c5c9e54f9c2e52280b7fc24a8d9", [tag: "1.0.5"]}, "jose": {:hex, :jose, "1.11.2", "f4c018ccf4fdce22c71e44d471f15f723cb3efab5d909ab2ba202b5bf35557b3", [:mix, :rebar3], [], "hexpm", "98143fbc48d55f3a18daba82d34fe48959d44538e9697c08f34200fa5f0947d2"}, "jsx": {:hex, :jsx, "3.1.0", "d12516baa0bb23a59bb35dccaf02a1bd08243fcbb9efe24f2d9d056ccff71268", [:rebar3], [], "hexpm", "0c5cc8fdc11b53cc25cf65ac6705ad39e54ecc56d1c22e4adb8f5a53fb9427f3"}, + "lc": {:git, "https://github.com/qzhuyan/lc.git", "6f38a748af0993bb4e440a0f9223d6aa7b90b86b", [tag: "0.1.1"]}, "lwm2m_coap": {:git, "https://github.com/emqx/lwm2m-coap.git", "495f3c62fae153040c89f9a0ba5344789ff5acc8", [tag: "v2.0.0"]}, "minirest": {:git, "https://github.com/emqx/minirest.git", "60c1a5a1f5df00a662cb34cf4101c7a21ffe08f9", [tag: "1.2.4"]}, "mysql": {:git, "https://github.com/emqx/mysql-otp.git", "bdabac44cc8836a9e23897b7e1b77c7df7e04f70", [tag: "1.7.1"]},