mirror of
https://github.com/tauri-apps/tauri.git
synced 2026-04-01 10:01:07 +02:00
feat(bundler): cache bundling tools in a common dir for all projects (#4305)
* feat(bundler): cache bundling tools in a common dir for all projects
* fix changefile
* fix linux
* linux again
* again
* again
* omg I could've reboot into my linux system
* I rebooted into my linux
* fix linux one more time
* finally
* -nc
* cleanup gitignores
* Revert "-nc"
This reverts commit 8d821c6c37.
* use -N on appimage's wget calls
Co-authored-by: Lucas Nogueira <lucas@tauri.studio>
This commit is contained in:
5
.changes/bundler-cache-bundle-tools.md
Normal file
5
.changes/bundler-cache-bundle-tools.md
Normal file
@@ -0,0 +1,5 @@
|
||||
---
|
||||
"tauri-bundler": patch
|
||||
---
|
||||
|
||||
Cache bundling tools in a directory shared by all tauri projects. Usually in `$XDG_HOME/.cache/tauri` on Linux and `$HOME\AppData\Local\tauri` on Windows.
|
||||
1
core/tests/app-updater/.gitignore
vendored
1
core/tests/app-updater/.gitignore
vendored
@@ -1 +0,0 @@
|
||||
WixTools/
|
||||
|
||||
1
examples/api/src-tauri/.gitignore
vendored
1
examples/api/src-tauri/.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
1
examples/resources/src-tauri/.gitignore
vendored
1
examples/resources/src-tauri/.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
1
examples/sidecar/src-tauri/.gitignore
vendored
1
examples/sidecar/src-tauri/.gitignore
vendored
@@ -2,4 +2,3 @@
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
binaries/
|
||||
WixTools
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
@@ -1,7 +1,6 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
# These are backup files generated by rustfmt
|
||||
**/*.rs.bk
|
||||
|
||||
1
examples/updater/src-tauri/.gitignore
vendored
1
examples/updater/src-tauri/.gitignore
vendored
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -37,6 +37,7 @@ walkdir = "2"
|
||||
handlebars = "4.3"
|
||||
tempfile = "3.3.0"
|
||||
log = { version = "0.4.17", features = [ "kv_unstable" ] }
|
||||
dirs-next = "2.0"
|
||||
|
||||
[target."cfg(target_os = \"windows\")".dependencies]
|
||||
attohttpc = "0.19"
|
||||
@@ -50,7 +51,6 @@ zip = "0.6"
|
||||
|
||||
[target."cfg(target_os = \"macos\")".dependencies]
|
||||
time = { version = "0.3", features = [ "formatting" ] }
|
||||
dirs-next = "2.0"
|
||||
|
||||
[target."cfg(any(target_os = \"macos\", target_os = \"windows\"))".dependencies]
|
||||
regex = "1"
|
||||
|
||||
@@ -55,6 +55,16 @@ pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
sh_map.insert("app_name", settings.main_binary_name());
|
||||
sh_map.insert("app_name_uppercase", &upcase_app_name);
|
||||
sh_map.insert("appimage_filename", &appimage_filename);
|
||||
let tauri_tools_path = dirs_next::cache_dir().map_or_else(
|
||||
|| output_path.to_path_buf(),
|
||||
|mut p| {
|
||||
p.push("tauri");
|
||||
p
|
||||
},
|
||||
);
|
||||
std::fs::create_dir_all(&tauri_tools_path)?;
|
||||
let tauri_tools_path_str = tauri_tools_path.to_string_lossy();
|
||||
sh_map.insert("tauri_tools_path", &tauri_tools_path_str);
|
||||
let larger_icon = icons
|
||||
.iter()
|
||||
.filter(|i| i.width == i.height)
|
||||
|
||||
@@ -35,8 +35,8 @@ 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 -O AppRun https://github.com/AppImage/AppImageKit/releases/download/continuous/AppRun-${ARCH} || wget -q -4 -O AppRun https://github.com/AppImage/AppImageKit/releases/download/12/AppRun-${ARCH}
|
||||
chmod +x AppRun
|
||||
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"
|
||||
|
||||
cp "{{icon_path}}" .DirIcon
|
||||
ln -s "{{icon_path}}" "{{app_name}}.png"
|
||||
@@ -45,10 +45,10 @@ ln -s "usr/share/applications/{{app_name}}.desktop" "{{app_name}}.desktop"
|
||||
|
||||
cd ..
|
||||
|
||||
wget -q -4 -O linuxdeploy-plugin-gtk.sh "https://raw.githubusercontent.com/tauri-apps/linuxdeploy-plugin-gtk/master/linuxdeploy-plugin-gtk.sh"
|
||||
wget -q -4 -O linuxdeploy-${ARCH}.AppImage https://github.com/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${linuxdeploy_arch}.AppImage
|
||||
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/linuxdeploy/linuxdeploy/releases/download/continuous/linuxdeploy-${linuxdeploy_arch}.AppImage
|
||||
|
||||
chmod +x linuxdeploy-plugin-gtk.sh
|
||||
chmod +x linuxdeploy-${ARCH}.AppImage
|
||||
chmod +x "{{tauri_tools_path}}/linuxdeploy-plugin-gtk.sh"
|
||||
chmod +x "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage"
|
||||
|
||||
OUTPUT="{{appimage_filename}}" ./linuxdeploy-${ARCH}.AppImage --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk --output appimage
|
||||
OUTPUT="{{appimage_filename}}" "{{tauri_tools_path}}/linuxdeploy-${ARCH}.AppImage" --appimage-extract-and-run --appdir "{{app_name}}.AppDir" --plugin gtk --output appimage
|
||||
|
||||
@@ -11,7 +11,8 @@ use std::{self, path::PathBuf};
|
||||
/// Runs all of the commands to build the MSI installer.
|
||||
/// Returns a vector of PathBuf that shows where the MSI was created.
|
||||
pub fn bundle_project(settings: &Settings) -> crate::Result<Vec<PathBuf>> {
|
||||
let wix_path = PathBuf::from("./WixTools");
|
||||
let mut wix_path = dirs_next::cache_dir().unwrap();
|
||||
wix_path.push("tauri/WixTools");
|
||||
|
||||
if !wix_path.exists() {
|
||||
wix::get_and_extract_wix(&wix_path)?;
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
node_modules/
|
||||
target/
|
||||
WixTools
|
||||
Cargo.lock
|
||||
Cargo.lock
|
||||
|
||||
@@ -1,3 +1,2 @@
|
||||
node_modules/
|
||||
target/
|
||||
WixTools
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
@@ -1,4 +1,3 @@
|
||||
# Generated by Cargo
|
||||
# will have compiled files and executables
|
||||
/target/
|
||||
WixTools
|
||||
|
||||
Reference in New Issue
Block a user