Skip to content

Commit 9ad06d0

Browse files
committed
chore(release): macos and linux bundle fixes
1 parent d790437 commit 9ad06d0

File tree

7 files changed

+66
-27
lines changed

7 files changed

+66
-27
lines changed

.github/workflows/release.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,9 @@ jobs:
1414
matrix:
1515
settings:
1616
- platform: "macos-latest"
17-
args: "--target x86_64-apple-darwin"
17+
args: "--target x86_64-apple-darwin --verbose"
1818
- platform: "macos-latest"
19-
args: "--target aarch64-apple-darwin"
19+
args: "--target aarch64-apple-darwin --verbose"
2020
- platform: "ubuntu-22.04"
2121
args: ""
2222
- platform: "windows-latest"

buildScripts/compressBinary.mjs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,21 +3,27 @@ import fs from "fs";
33
import path from "path";
44

55
function findBinary(dir) {
6-
const files = fs.readdirSync(dir);
7-
for (const file of files) {
8-
const filePath = path.join(dir, file);
9-
const stat = fs.statSync(filePath);
10-
console.log(file);
11-
if (stat.isDirectory()) {
12-
// ignore
13-
} else if (file === "devbox" || file === "devbox.exe") {
14-
return filePath;
6+
// Recursively search for the native binary (handles arch-specific subdirs)
7+
try {
8+
const entries = fs.readdirSync(dir, { withFileTypes: true });
9+
for (const entry of entries) {
10+
const filePath = path.join(dir, entry.name);
11+
if (entry.isDirectory()) {
12+
const found = findBinary(filePath);
13+
if (found) return found;
14+
} else if (entry.isFile() && (entry.name === "devbox" || entry.name === "devbox.exe")) {
15+
return filePath;
16+
}
1517
}
18+
} catch (err) {
19+
// directory may not exist, ignore and continue
1620
}
1721
return null;
1822
}
1923

20-
const targetDir = path.join(".", "src-tauri", "target", "release");
24+
// search under src-tauri/target (not just target/release) to support
25+
// arch-specific paths like target/x86_64-apple-darwin/release
26+
const targetDir = path.join(".", "src-tauri", "target");
2127
const binaryPath = findBinary(targetDir);
2228

2329
if (binaryPath) {

src-tauri/Cargo.toml

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -64,3 +64,6 @@ incremental = false
6464

6565
[target.'cfg(not(any(target_os = "android", target_os = "ios")))'.dependencies]
6666
tauri-plugin-updater = "2"
67+
68+
[package.metadata]
69+
tauri = { icon = ["icons/icon.ico", "icons/icon.png", "icons/icon.icns"] }

src-tauri/LICENSE

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
MIT License
2+
3+
Copyright (c) 2025 smithg09
4+
5+
Permission is hereby granted, free of charge, to any person obtaining a copy
6+
of this software and associated documentation files (the "Software"), to deal
7+
in the Software without restriction, including without limitation the rights
8+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9+
copies of the Software, and to permit persons to whom the Software is
10+
furnished to do so, subject to the following conditions:
11+
12+
The above copyright notice and this permission notice shall be included in all
13+
copies or substantial portions of the Software.
14+
15+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21+
SOFTWARE.

src-tauri/icons/icon.ico

111 KB
Binary file not shown.

src-tauri/src/main.rs

Lines changed: 19 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,15 +44,21 @@ fn main() {
4444
println!("Error: {:?}", res.err());
4545
}
4646
// Create window with transparency enabled
47-
let window = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html".into()))
48-
.title("")
49-
.inner_size(1100.0, 800.0)
50-
.resizable(true)
51-
.min_inner_size(850.0, 600.0)
52-
.fullscreen(false)
53-
.transparent(true)
54-
.title_bar_style(tauri::TitleBarStyle::Overlay)
55-
.build()?;
47+
let builder = {
48+
let b = WebviewWindowBuilder::new(app, "main", WebviewUrl::App("index.html".into()))
49+
.title("")
50+
.inner_size(1100.0, 800.0)
51+
.resizable(true)
52+
.min_inner_size(850.0, 600.0)
53+
.fullscreen(false)
54+
.transparent(true);
55+
// Only set title_bar_style on platforms that support it (macOS, Windows).
56+
#[cfg(any(target_os = "macos", target_os = "windows"))]
57+
let b = b.title_bar_style(tauri::TitleBarStyle::Overlay);
58+
b
59+
};
60+
61+
let window = builder.build()?;
5662

5763
// Apply macOS translucent vibrancy effect immediately
5864
#[cfg(target_os = "macos")]
@@ -61,12 +67,14 @@ fn main() {
6167
.expect("Unsupported platform! 'apply_vibrancy' is only supported on macOS");
6268
}
6369

64-
// Handle window close events for macOS
65-
#[cfg(target_os = "macos")]
70+
// Handle window close events on desktop (macOS, Windows, Linux)
71+
// On close, hide the window instead of exiting the app.
72+
#[cfg(any(target_os = "macos", target_os = "windows", target_os = "linux"))]
6673
{
6774
let window_clone = window.clone();
6875
window.on_window_event(move |event| {
6976
if let WindowEvent::CloseRequested { api, .. } = event {
77+
// hide() and prevent_close() are cross-platform; keep vibrancy mac-only.
7078
window_clone.hide().unwrap();
7179
api.prevent_close();
7280
}

src-tauri/tauri.conf.json

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,17 +2,18 @@
22
"bundle": {
33
"targets": "all",
44
"active": true,
5+
"icon": [
6+
"icons/icon.png",
7+
"icons/icon.icns",
8+
"icons/icon.ico"
9+
],
510
"windows": {
611
"timestampUrl": "",
712
"certificateThumbprint": null,
813
"digestAlgorithm": "sha256"
914
},
1015
"resources": [],
1116
"externalBin": [],
12-
"icon": [
13-
"icons/icon.png",
14-
"icons/icon.icns"
15-
],
1617
"copyright": "",
1718
"category": "DeveloperTool",
1819
"shortDescription": "Developer Utilities",

0 commit comments

Comments
 (0)