Repository navigation
Stage aumid_nif.dll and bake opaque splash - #28
Conversation
Co-authored-by: Cursor <cursoragent@cursor.com>
There was a problem hiding this comment.
Cursor Bugbot has reviewed your changes using default effort and found 1 potential issue.
Bugbot Autofix prepared a fix for the issue found in the latest run.
- ✅ Fixed: NIF staging skips apps without priv
- Staging now finds the AppUserModelId app via lib/*/ebin and creates priv/native/windows, so a Mix release that omitted an empty priv directory still receives aumid_nif.dll.
Preview (8f0a7e4d39)
diff --git a/lib/package.ex b/lib/package.ex
--- a/lib/package.ex
+++ b/lib/package.ex
@@ -187,11 +187,26 @@
raise "package.splash_icon not found: #{path}"
end
- # Keep a PNG next to the host for the Windows splash (GDI+ loads PNG).
- # Resize for a crisp splash mark without shipping a multi‑MB source asset.
+ # Bake onto the splash window gray (#dcdcdc) at the draw size (128) so
+ # transparent gutters cannot show as vertical bands on the host UI.
# Force-overwrite: Mix :assemble may already have copied priv/splash.png
# into the release, and priv_import! skips existing files.
- cmd!("magick", ["convert", "-resize", "256x256", path, "splash.png"])
+ cmd!("magick", [
+ "convert",
+ "-size",
+ "128x128",
+ "xc:#dcdcdc",
+ path,
+ "-resize",
+ "128x128",
+ "-gravity",
+ "center",
+ "-compose",
+ "over",
+ "-composite",
+ "splash.png"
+ ])
+
dst = Path.join(priv(pkg), "splash.png")
File.mkdir_p!(priv(pkg))
File.cp!("splash.png", dst)
diff --git a/lib/package/windows.ex b/lib/package/windows.ex
--- a/lib/package/windows.ex
+++ b/lib/package/windows.ex
@@ -38,6 +38,7 @@
host_dest = Path.join(package_root, host_name)
File.cp!(host_bin, host_dest)
IO.puts("Host-first Windows/#{host_name} <- #{host_bin}")
+ maybe_stage_aumid_nif!(host_bin, path)
# Explorer/taskbar use the host PE icon. copy_extra_files embeds the icon into
# the renamed erts erl.exe, but the native host is a separate copy and must
@@ -137,6 +138,31 @@
end
end
+ # Out-of-tree host builds often emit aumid_nif.dll beside DesktopWebView.exe.
+ # BEAM loads it from :code.priv_dir of the app that owns
+ # DesktopWebview.AppUserModelId. Mix omits an empty priv directory, and
+ # :code.priv_dir still points there, so find the app by its ebin beam and
+ # create priv/native/windows.
+ defp maybe_stage_aumid_nif!(host_bin, release_path) do
+ nif_src = Path.join(Path.dirname(host_bin), "aumid_nif.dll")
+
+ if File.exists?(nif_src) do
+ dests =
+ for ebin <- Path.wildcard(Path.join(release_path, "lib/*/ebin")),
+ File.exists?(Path.join(ebin, "Elixir.DesktopWebview.AppUserModelId.beam")),
+ do: Path.join(Path.dirname(ebin), "priv/native/windows")
+
+ for dest_dir <- Enum.uniq(dests) do
+ File.mkdir_p!(dest_dir)
+ dest = Path.join(dest_dir, "aumid_nif.dll")
+ File.cp!(nif_src, dest)
+ IO.puts("Host-first Windows/aumid_nif.dll <- #{nif_src} -> #{dest}")
+ end
+
+ :ok
+ end
+ end
+
# Host and BEAM must call SetCurrentProcessExplicitAppUserModelID with the
# same value (package.identifier) so Task Manager groups them. The host reads
# this from ini; BEAM gets it via EDW_APP_USER_MODEL_ID from the host.You can send follow-ups to the cloud agent here.
Reviewed by Cursor Bugbot for commit 3c8c805. Configure here.
| File.exists?( | ||
| Path.join(release_priv, "../ebin/Elixir.DesktopWebview.AppUserModelId.beam") | ||
| ), | ||
| do: Path.join(release_priv, "native/windows") |
There was a problem hiding this comment.
NIF staging skips apps without priv
Medium Severity
maybe_stage_aumid_nif! discovers the AppUserModelId app by globbing lib/*/priv and only then checking for the beam file. Mix releases omit priv when that app has none yet, which is likely for out-of-tree host builds whose NIF is the sibling this function is meant to copy. If aumid_nif.dll exists beside the host but priv does not, the wildcard is empty, staging is skipped with no log, and the packaged BEAM never gets the NIF.
Reviewed by Cursor Bugbot for commit 3c8c805. Configure here.
Mix releases omit an empty priv directory, so globbing lib/*/priv skipped the out-of-tree sibling NIF. Search lib/*/ebin and create priv/native/windows.


Summary
aumid_nif.dllfrom besideDESKTOP_HOST_BINARYinto the AppUserModelId app release privTest plan
lib/desktop_webview-*/priv/native/windowssplash.pngis opaque 128x128 on#dcdcdcNote
Low Risk
Build-time packaging and splash image processing only; no runtime auth or data-path changes.
Overview
Windows splash assets now composite the configured
splash_icononto a 128×128#dcdcdccanvas (centered overlay) instead of a plain 256×256 resize, so transparent gutters do not show as vertical bands in the native host splash.For host-first Windows builds, packaging copies
aumid_nif.dllfrom beside the native host binary into each release libpriv/native/windowsthat shipsDesktopWebview.AppUserModelId, so BEAM can load the NIF when the host binary is built out-of-tree.Reviewed by Cursor Bugbot for commit 3c8c805. Configure here.