diff --git a/packaging/gen-assets.sh b/packaging/gen-assets.sh index 83be172..5478b3e 100644 --- a/packaging/gen-assets.sh +++ b/packaging/gen-assets.sh @@ -28,12 +28,25 @@ if [ ! -f "$SVG" ]; then fi echo "==> rendering icon.svg → 1024x1024 icon.png" +# Renderer priority: rsvg-convert → Chrome/Chromium headless → sips. +# ⚡ v0.2.29 CI lesson (Build Release 31604108964): rsvg-convert (librsvg 2.58 on +# Ubuntu 24.04 / Homebrew / Windows) renders icon.svg 99.2% transparent — even +# the opaque background rect does not paint. The #705 opacity gate correctly +# caught it, but the script exited instead of falling back to the next +# renderer. Fix: each renderer's output is validated by the opacity check +# BEFORE being accepted; a blank render falls through to the next renderer. +# Only when ALL renderers produce blank output do we fail loudly. render_svg_to_png() { + local renderer_found=0 # 1) rsvg-convert (librsvg) — full SVG + filter support if command -v rsvg-convert >/dev/null 2>&1; then + renderer_found=1 echo " renderer: rsvg-convert" - rsvg-convert -w 1024 -h 1024 "$SVG" -o "$OUT/icon.png" - return 0 + if rsvg-convert -w 1024 -h 1024 "$SVG" -o "$OUT/icon.png" \ + && check_icon_opaque; then + return 0 + fi + echo " ⚠️ rsvg-convert produced a blank/transparent icon — falling back to Chrome headless" >&2 fi # 2) Chrome/Chromium headless --screenshot (full filter support) # Windows (Git Bash): convert /c/... → file:///C:/... so Chrome resolves the URL. @@ -58,6 +71,7 @@ render_svg_to_png() { "/c/Program Files/Google/Chrome/Application/chrome.exe" \ "/c/Program Files (x86)/Microsoft/Edge/Application/msedge.exe"; do if [ -n "$chrome" ] && command -v "$chrome" >/dev/null 2>&1 || [ -x "$chrome" ] 2>/dev/null; then + renderer_found=1 echo " renderer: $chrome (headless, HTML wrapper, opaque white bg)" HTML="$OUT/.icon-render.html" # cygpath the wrapper page URL too — on Windows Git Bash $HTML is an MSYS @@ -74,49 +88,46 @@ render_svg_to_png() {