Procházet zdrojové kódy

fix(bundler): cache appimage bundle tools (#4790)

Co-authored-by: Lucas Fernandes Nogueira <lucas@tauri.studio>
Brian Li před 3 roky
rodič
revize
024620529e

+ 6 - 0
.changes/cache-appimage-tools.md

@@ -0,0 +1,6 @@
+---
+"tauri-bundler": patch
+---
+
+Avoid re-downloading AppImage build tools on every build.
+

+ 9 - 9
tooling/bundler/src/bundle/linux/templates/appimage

@@ -47,12 +47,12 @@ find /usr/lib* -name WebKitNetworkProcess -exec mkdir -p "$(dirname '{}')" \; -e
 find /usr/lib* -name WebKitWebProcess -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
 find /usr/lib* -name libwebkit2gtkinjectedbundle.so -exec mkdir -p "$(dirname '{}')" \; -exec cp --parents '{}' "." \; || true
 
-wget -q -4 -N -O "{{tauri_tools_path}}/AppRun" https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -N -O "{{tauri_tools_path}}/AppRun" https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH}
-chmod +x "{{tauri_tools_path}}/AppRun"
+( cd "{{tauri_tools_path}}" && ( wget -q -4 -N https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -N https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH} ) )
+chmod +x "{{tauri_tools_path}}/AppRun-${ARCH}"
 
 # We need AppRun to be installed as {{app_name}}.AppDir/AppRun.
 # Otherwise the linuxdeploy scripts will default to symlinking our main bin instead and will crash on trying to launch.
-cp "{{tauri_tools_path}}/AppRun" .
+cp "{{tauri_tools_path}}/AppRun-${ARCH}" AppRun
 
 cp "{{icon_path}}" .DirIcon
 ln -s "{{icon_path}}" "{{app_name}}.png"
@@ -63,18 +63,18 @@ cd ..
 
 if [[ "$APPIMAGE_BUNDLE_GSTREAMER" != "0" ]]; then
   gst_plugin="--plugin gstreamer"
-  wget -q -4 -N -O linuxdeploy-plugin-gstreamer.sh "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gstreamer/master/linuxdeploy-plugin-gstreamer.sh"
+  wget -q -4 -N "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gstreamer/master/linuxdeploy-plugin-gstreamer.sh"
   chmod +x linuxdeploy-plugin-gstreamer.sh
 else
   gst_plugin=""
 fi
 
-wget -q -4 -N -O "{{tauri_tools_path}}/linuxdeploy-plugin-gtk.sh" https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh
-wget -q -4 -N -O "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage" https://github.com/tauri-apps/binary-releases/releases/download/linuxdeploy/linuxdeploy-${linuxdeploy_arch}.AppImage
+( cd "{{tauri_tools_path}}" && wget -q -4 -N https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh )
+( cd "{{tauri_tools_path}}" && wget -q -4 -N https://github.com/tauri-apps/binary-releases/releases/download/linuxdeploy/linuxdeploy-${linuxdeploy_arch}.AppImage )
 
 chmod +x "{{tauri_tools_path}}/linuxdeploy-plugin-gtk.sh"
-chmod +x "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage"
+chmod +x "{{tauri_tools_path}}/linuxdeploy-${linuxdeploy_arch}.AppImage"
 
-dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of="{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage"
+dd if=/dev/zero bs=1 count=3 seek=8 conv=notrunc of="{{tauri_tools_path}}/linuxdeploy-${linuxdeploy_arch}.AppImage"
 
-OUTPUT="{{appimage_filename}}" "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage" --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk ${gst_plugin} --output appimage
+OUTPUT="{{appimage_filename}}" "{{tauri_tools_path}}/linuxdeploy-${linuxdeploy_arch}.AppImage" --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk ${gst_plugin} --output appimage