From 75021b376eec95f8fa8c891134d2d200a0897867 Mon Sep 17 00:00:00 2001 From: Kjell Winblad Date: Tue, 20 Dec 2022 11:16:57 +0100 Subject: [PATCH] fix: do not start jq port programs when they are not needed The jq function in the rule engine uses the jq NIF implementation by default so there is often no need to start any jq port programs. Before this commit jq port programs were started anyway. This is fixed by not starting the jq application (the jq application is started automatically when the jq port implementation is activated). --- mix.exs | 4 ++-- rebar.config.erl | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-) diff --git a/mix.exs b/mix.exs index 11ef14eb1..91aaa1a2c 100644 --- a/mix.exs +++ b/mix.exs @@ -247,7 +247,7 @@ defmodule EMQXUmbrella.MixProject do ] ++ if(enable_quicer?(), do: [quicer: :permanent], else: []) ++ if(enable_bcrypt?(), do: [bcrypt: :permanent], else: []) ++ - if(enable_jq?(), do: [jq: :permanent], else: []) ++ + if(enable_jq?(), do: [jq: :load], else: []) ++ if(is_app(:observer), do: [observer: :load], else: [] @@ -518,7 +518,7 @@ defmodule EMQXUmbrella.MixProject do |> Path.join("RELEASES") |> File.open!([:write, :utf8], fn handle -> IO.puts(handle, "%% coding: utf-8") - :io.format(handle, '~tp.~n', [release_entry]) + :io.format(handle, ~c"~tp.~n", [release_entry]) end) release diff --git a/rebar.config.erl b/rebar.config.erl index 8c8f87fa8..055ef6045 100644 --- a/rebar.config.erl +++ b/rebar.config.erl @@ -398,7 +398,9 @@ relx_apps(ReleaseType, Edition) -> ] ++ [quicer || is_quicer_supported()] ++ [bcrypt || provide_bcrypt_release(ReleaseType)] ++ - [jq || is_jq_supported()] ++ + %% Started automatically when needed (only needs to be started when the + %% port implementation is used) + [{jq, load} || is_jq_supported()] ++ [{observer, load} || is_app(observer)] ++ relx_apps_per_edition(Edition).