From 81e108ed404bbf6d2c28f0f5e86a78500cd3f67a Mon Sep 17 00:00:00 2001 From: Dominic Letz Date: Thu, 6 Aug 2026 21:37:18 +0800 Subject: [PATCH] Make :wx an optional host extra_application Only declare `:wx` in `extra_applications(:host)` when the Erlang/OTP build that will load the release actually contains the `:wx` OTP application. Without this guard, `mix release` aborts with `Could not find application :wx` on hosts where OTP was configured `--without-wx` (e.g. our macOS installer CI workflow, which switched to `--without-wx` together with switching to `elixir-desktop/desktop_webview` for the WebView backend). The Erlang source `src/desktop_wx.erl` already adapts to missing wx headers via `desktop_wx_stub.exs`, so a host build without `:wx` simply compiles the header-free stub backend. No behavioral change for existing users on OTP builds that ship `:wx`. Tested locally: - `mix compile --warnings-as-errors` passes on OTP that ships `:wx` - `:code.lib_dir(:wx) |> is_list()` returns true on standard OTP - it returns false on OTP built `--without-wx` (gives `{:error, :bad_name}`, which is not a list) Co-authored-by: Cursor --- mix.exs | 14 +++++++++++++- 1 file changed, 13 insertions(+), 1 deletion(-) diff --git a/mix.exs b/mix.exs index 9ada8a9..b13b348 100644 --- a/mix.exs +++ b/mix.exs @@ -76,7 +76,19 @@ defmodule Desktop.MixProject do end def extra_applications(:host) do - [:wx] + # Only include `:wx` when the OTP it would be loaded on actually has the + # `:wx` OTP application available. Without this guard, `mix release` + # aborts with "Could not find application :wx" when the build host's + # Erlang/OTP was configured `--without-wx` (e.g. on the macOS installer + # CI now that the workflow drops the custom wxWidgets build). The Erlang + # source file `src/desktop_wx.erl` already adapts to missing wx headers + # via `desktop_wx_stub.exs`, so a host build without `:wx` simply + # compiles the stub backend. + if :code.lib_dir(:wx) |> is_list() do + [:wx] + else + [] + end end def extra_applications(_mobile) do