Skip to content

Commit 7f4ae3d

Browse files
author
Maik Roland Damm
committed
feat: add macOS and Windows setup scripts for development environment
- Introduced `setup-macos.sh` for interactive setup on macOS, including checks for Xcode, Rust, Node.js, and Cargo tools. - Added `setup-windows.ps1` for Windows setup, utilizing winget for package management and ensuring necessary dependencies are installed. - Created `render_i18n_locales_from_en.py` script to regenerate localization files using deep-translator, with options for selective translation. - Updated `Cargo.toml` to use newer versions of dependencies including `reqwest`, `keyring`, and `cpal`. - Refactored keyring integration in `agent_settings.rs` to use `keyring_core`. - Enhanced `lib.rs` to initialize keyring stores based on the operating system. - Adjusted audio input rate handling in `recorder.rs` for improved compatibility.
1 parent e14897a commit 7f4ae3d

24 files changed

Lines changed: 2047 additions & 13 deletions

.env.release.example

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,8 @@
44
# --- Local build only (Linux / macOS / Windows on that machine) ---
55
# Nothing required. Either omit this file entirely or run:
66
# ./scripts/release.sh
7+
# scripts\release.cmd # Windows Command Prompt / PowerShell
8+
# ./scripts/release-macos.sh # explicit macOS launcher
79
# ./scripts/release.sh --linux-arch all # Linux: amd64 + arm64 deb/rpm (+ AppImage on native CPU)
810
# Unsigned is the default. Use --require-signing only with TAURI_SIGNING_PRIVATE_KEY below.
911
# macOS: universal build (Apple Silicon + Intel) is automatic.

Cargo.toml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,10 +13,10 @@ js-sys = "0.3"
1313
serde = { version = "1", features = ["derive"] }
1414
serde-wasm-bindgen = "0.6"
1515
serde_json = "1"
16-
gloo-timers = { version = "0.3", features = ["futures"] }
16+
gloo-timers = { version = "0.4", features = ["futures"] }
1717
console_error_panic_hook = "0.1.7"
1818
base64 = { version = "0.22", default-features = false, features = ["std"] }
19-
pulldown-cmark = "0.12"
19+
pulldown-cmark = "0.13"
2020
leptos_icons = "0.5"
2121
send_wrapper = "0.6"
2222
icondata = { version = "0.5", default-features = false, features = ["lucide"] }

README.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,19 @@ BLXCode is early-stage open source. Core desktop, workspace, memory, plans, task
7373

7474
## Quick Start
7575

76+
After cloning, run the setup script for your platform:
77+
78+
```bash
79+
./scripts/setup-linux.sh
80+
./scripts/setup-macos.sh
81+
```
82+
83+
```powershell
84+
powershell -ExecutionPolicy Bypass -File scripts/setup-windows.ps1
85+
```
86+
87+
Use `--check-only` to inspect missing prerequisites without installing anything, or `--with-bundle` to run `cargo tauri build` after the default checks.
88+
7689
### Prerequisites
7790

7891
- Rust stable and Cargo.

docs/developer/setup.md

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,19 @@ BLXCode is a two-crate Rust workspace:
99

1010
## Prerequisites
1111

12+
After cloning, you can let the platform setup script install/check the local toolchain and run the default verification:
13+
14+
```bash
15+
./scripts/setup-linux.sh
16+
./scripts/setup-macos.sh
17+
```
18+
19+
```powershell
20+
powershell -ExecutionPolicy Bypass -File scripts/setup-windows.ps1
21+
```
22+
23+
Useful options are `--check-only`, `--skip-system`, `--no-verify`, and `--with-bundle`.
24+
1225
Install:
1326

1427
- Rust stable.

docs/user/building.md

Lines changed: 17 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,7 +155,20 @@ Because BLXCode currently uses `"targets": "all"` in `src-tauri/tauri.conf.json`
155155

156156
## Release script
157157

158-
From the repository root, [`scripts/release.sh`](../../scripts/release.sh) automates version bumps, CHANGELOG updates, signed `cargo tauri build`, and GitHub release uploads.
158+
From the repository root, [`scripts/release.sh`](../../scripts/release.sh) automates version bumps, CHANGELOG updates, signed `cargo tauri build`, and GitHub release uploads. Windows also has native PowerShell and Command Prompt entrypoints:
159+
160+
```powershell
161+
powershell -ExecutionPolicy Bypass -File scripts/release.ps1 --platform windows
162+
scripts\release.cmd --platform windows
163+
scripts\release-windows.cmd
164+
```
165+
166+
macOS can use the generic Bash script or the explicit macOS launcher:
167+
168+
```bash
169+
./scripts/release.sh --platform macos
170+
./scripts/release-macos.sh
171+
```
159172

160173
On Linux (including Arch), the script sets `NO_STRIP=1` and `APPIMAGE_EXTRACT_AND_RUN=1` so AppImage bundling avoids linuxdeploy strip errors with `.relr.dyn` sections.
161174

@@ -175,12 +188,15 @@ Optional signing and upload variables are documented in [`.env.release.example`]
175188

176189
```bash
177190
./scripts/release.sh --help
191+
powershell -ExecutionPolicy Bypass -File scripts/release.ps1 --help
178192

179193
# Signed bundles + .sig (requires .env.release)
180194
./scripts/release.sh --require-signing
195+
scripts\release.cmd --require-signing
181196

182197
# New patch release: bump versions + CHANGELOG, build, draft upload
183198
./scripts/release.sh --bump patch --build --upload
199+
scripts\release.cmd --bump patch --build --upload
184200

185201
# Trigger CI for all platforms (after commit)
186202
./scripts/release.sh --bump patch --tag --push --no-build --commit

scripts/release-macos.sh

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
#!/usr/bin/env bash
2+
# macOS-focused launcher for the Bash release pipeline.
3+
set -euo pipefail
4+
5+
SCRIPT_DIR="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
6+
exec "$SCRIPT_DIR/release.sh" "$@" --platform macos

scripts/release-windows.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
setlocal
3+
set "SCRIPT_DIR=%~dp0"
4+
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%release.ps1" %* --platform windows
5+
exit /b %ERRORLEVEL%
6+

scripts/release-windows.ps1

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,5 @@
1+
# Windows-focused launcher for the PowerShell release pipeline.
2+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
3+
& powershell -NoProfile -ExecutionPolicy Bypass -File (Join-Path $ScriptDir "release.ps1") @args --platform windows
4+
exit $LASTEXITCODE
5+

scripts/release.cmd

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,6 @@
1+
@echo off
2+
setlocal
3+
set "SCRIPT_DIR=%~dp0"
4+
powershell -NoProfile -ExecutionPolicy Bypass -File "%SCRIPT_DIR%release.ps1" %*
5+
exit /b %ERRORLEVEL%
6+

scripts/release.ps1

Lines changed: 218 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,218 @@
1+
# BLXCode release: optional semver bump, signed tauri build, GitHub release upload.
2+
$ErrorActionPreference = "Stop"
3+
4+
$script:RELEASE_EXIT_USER = 1
5+
$script:RELEASE_EXIT_BUILD = 2
6+
7+
$script:RELEASE_DRY_RUN = 0
8+
$script:RELEASE_REQUIRE_SIGNING = 0
9+
$script:RELEASE_NO_CHANGELOG = 0
10+
$script:RELEASE_CLOBBER = 0
11+
$script:RELEASE_DO_BUILD = 0
12+
$script:RELEASE_DO_UPLOAD = 0
13+
$script:RELEASE_UPLOAD_ONLY = 0
14+
$script:RELEASE_DO_TAG = 0
15+
$script:RELEASE_DO_PUSH = 0
16+
$script:RELEASE_DO_COMMIT = 0
17+
$script:RELEASE_BUMP = ""
18+
$script:RELEASE_BUNDLES = ""
19+
$script:RELEASE_PLATFORM_OVERRIDE = ""
20+
$script:RELEASE_LINUX_ARCH = if ($env:RELEASE_LINUX_ARCH) { $env:RELEASE_LINUX_ARCH } else { "all" }
21+
$script:RELEASE_VERSION = ""
22+
$script:RELEASE_NO_BUILD = 0
23+
24+
$ScriptDir = Split-Path -Parent $MyInvocation.MyCommand.Path
25+
$ReleaseScriptDir = Join-Path $ScriptDir "release"
26+
27+
. (Join-Path $ReleaseScriptDir "common.ps1")
28+
. (Join-Path $ReleaseScriptDir "changelog.ps1")
29+
. (Join-Path $ReleaseScriptDir "version.ps1")
30+
. (Join-Path $ReleaseScriptDir "linux_targets.ps1")
31+
. (Join-Path $ReleaseScriptDir "build.ps1")
32+
. (Join-Path $ReleaseScriptDir "upload.ps1")
33+
34+
function Show-ReleaseUsage {
35+
@"
36+
Usage: powershell -ExecutionPolicy Bypass -File scripts/release.ps1 [options]
37+
38+
Build signed Tauri bundles for the current host.
39+
Optionally bump version, rewrite CHANGELOG, tag, push, and upload to GitHub.
40+
41+
Options:
42+
--bump patch|minor|major Bump version in Cargo.toml + tauri.conf.json + CHANGELOG
43+
--no-changelog Skip CHANGELOG rewrite on bump
44+
--build Run cargo tauri build (default when not --upload-only / --no-build)
45+
--no-build Skip build
46+
--bundles LIST Pass to cargo tauri build --bundles (e.g. msi)
47+
--tag Create annotated git tag v{version}
48+
--push git push + push tag (requires --tag)
49+
--commit Commit version + CHANGELOG files
50+
--upload Upload bundle artifacts to GitHub release
51+
--upload-only Only upload (no bump/build/tag)
52+
--clobber Replace existing release assets with same name
53+
--require-signing Require TAURI_SIGNING_PRIVATE_KEY
54+
--allow-unsigned Alias for default unsigned build (no-op)
55+
--platform linux|macos|windows
56+
--linux-arch native|amd64|arm64|all
57+
Linux only: deb/rpm/AppImage per arch (default: all)
58+
--dry-run Print planned actions only
59+
-h, --help Show this help
60+
61+
Examples:
62+
scripts\release.cmd
63+
powershell -ExecutionPolicy Bypass -File scripts\release.ps1 --platform windows
64+
powershell -ExecutionPolicy Bypass -File scripts\release.ps1 --bump patch --build --upload
65+
"@
66+
}
67+
68+
$i = 0
69+
while ($i -lt $args.Count) {
70+
switch ($args[$i]) {
71+
"--bump" {
72+
if ($i + 1 -ge $args.Count) { throw "--bump requires patch|minor|major" }
73+
$script:RELEASE_BUMP = $args[$i + 1]
74+
$i += 2
75+
continue
76+
}
77+
"--no-changelog" { $script:RELEASE_NO_CHANGELOG = 1; $i++; continue }
78+
"--build" { $script:RELEASE_DO_BUILD = 1; $i++; continue }
79+
"--no-build" { $script:RELEASE_DO_BUILD = 0; $script:RELEASE_NO_BUILD = 1; $i++; continue }
80+
"--bundles" {
81+
if ($i + 1 -ge $args.Count) { throw "--bundles requires a list" }
82+
$script:RELEASE_BUNDLES = $args[$i + 1]
83+
$i += 2
84+
continue
85+
}
86+
"--tag" { $script:RELEASE_DO_TAG = 1; $i++; continue }
87+
"--push" { $script:RELEASE_DO_PUSH = 1; $i++; continue }
88+
"--commit" { $script:RELEASE_DO_COMMIT = 1; $i++; continue }
89+
"--upload" { $script:RELEASE_DO_UPLOAD = 1; $i++; continue }
90+
"--upload-only" { $script:RELEASE_UPLOAD_ONLY = 1; $script:RELEASE_DO_UPLOAD = 1; $i++; continue }
91+
"--clobber" { $script:RELEASE_CLOBBER = 1; $i++; continue }
92+
"--require-signing" { $script:RELEASE_REQUIRE_SIGNING = 1; $i++; continue }
93+
"--allow-unsigned" { $i++; continue }
94+
"--platform" {
95+
if ($i + 1 -ge $args.Count) { throw "--platform requires linux|macos|windows" }
96+
$script:RELEASE_PLATFORM_OVERRIDE = $args[$i + 1]
97+
$i += 2
98+
continue
99+
}
100+
"--linux-arch" {
101+
if ($i + 1 -ge $args.Count) { throw "--linux-arch requires native|amd64|arm64|all" }
102+
$script:RELEASE_LINUX_ARCH = $args[$i + 1]
103+
$i += 2
104+
continue
105+
}
106+
"--dry-run" { $script:RELEASE_DRY_RUN = 1; $i++; continue }
107+
"-h" { Show-ReleaseUsage; exit 0 }
108+
"--help" { Show-ReleaseUsage; exit 0 }
109+
default { throw "Unknown option: $($args[$i]) (use --help)" }
110+
}
111+
}
112+
113+
Initialize-ReleaseCommon $ReleaseScriptDir
114+
Write-ReleaseInfo "Git remote: $script:RELEASE_GIT_REMOTE | GitHub: $script:RELEASE_GH_REPO"
115+
116+
if ($script:RELEASE_UPLOAD_ONLY -eq 1) {
117+
$script:RELEASE_DO_BUILD = 0
118+
} elseif ($script:RELEASE_NO_BUILD -ne 1 -and $script:RELEASE_DO_BUILD -eq 0 -and $script:RELEASE_DO_TAG -eq 0 -and -not $script:RELEASE_BUMP) {
119+
$script:RELEASE_DO_BUILD = 1
120+
} elseif ($script:RELEASE_BUMP -and $script:RELEASE_NO_BUILD -ne 1 -and $script:RELEASE_DO_BUILD -eq 0 -and $script:RELEASE_UPLOAD_ONLY -ne 1) {
121+
$script:RELEASE_DO_BUILD = 1
122+
}
123+
124+
if ($script:RELEASE_DO_PUSH -eq 1 -and $script:RELEASE_DO_TAG -ne 1) {
125+
Stop-Release "--push requires --tag"
126+
}
127+
128+
$script:RELEASE_VERSION = Read-ReleaseVersion
129+
$platform = Get-ReleasePlatform
130+
Write-ReleaseInfo "Project version: $script:RELEASE_VERSION (platform: $platform)"
131+
132+
Import-ReleaseEnv
133+
134+
$tagCurrent = "v$script:RELEASE_VERSION"
135+
if (Test-ReleaseGhReleaseExists $tagCurrent) {
136+
Write-ReleaseInfo "GitHub release $tagCurrent already exists"
137+
} elseif (Test-ReleaseRemoteTagExists $tagCurrent) {
138+
Write-ReleaseInfo "Remote tag $tagCurrent already exists"
139+
}
140+
141+
if ($script:RELEASE_UPLOAD_ONLY -eq 1) {
142+
$script:RELEASE_BUMP = ""
143+
$script:RELEASE_DO_TAG = 0
144+
$script:RELEASE_DO_BUILD = 0
145+
}
146+
147+
if ($script:RELEASE_BUMP) {
148+
Invoke-ReleaseBumpVersion $script:RELEASE_BUMP
149+
$tagCurrent = "v$script:RELEASE_VERSION"
150+
if ((Test-ReleaseGhReleaseExists $tagCurrent) -or (Test-ReleaseRemoteTagExists $tagCurrent)) {
151+
Stop-Release "Release $tagCurrent already exists on GitHub after bump"
152+
}
153+
}
154+
155+
if ($script:RELEASE_DO_BUILD -eq 1) {
156+
Invoke-ReleasePrepareDeps
157+
try {
158+
Invoke-ReleaseBuild
159+
} catch {
160+
Write-ReleaseError $_.Exception.Message
161+
exit $script:RELEASE_EXIT_BUILD
162+
}
163+
Write-ReleaseInfo "Build artifacts (v$script:RELEASE_VERSION):"
164+
Show-ReleaseArtifacts $script:RELEASE_VERSION
165+
}
166+
167+
if ($script:RELEASE_DO_COMMIT -eq 1) {
168+
if ($script:RELEASE_DRY_RUN -eq 1) {
169+
Write-ReleaseInfo "Would: git commit version + CHANGELOG"
170+
} else {
171+
& git add CHANGELOG.md Cargo.toml src-tauri/Cargo.toml src-tauri/tauri.conf.json
172+
$releaseStatus = (& git status --porcelain scripts/release.sh scripts/release/ .gitignore docs/user/building.md scripts/release.ps1 scripts/release.cmd 2>$null)
173+
if ($releaseStatus) {
174+
& git add scripts/release.sh scripts/release/ .gitignore docs/user/building.md scripts/release.ps1 scripts/release.cmd
175+
}
176+
& git commit -m "chore: release v$script:RELEASE_VERSION"
177+
if ($LASTEXITCODE -ne 0) { Stop-Release "git commit failed" }
178+
Write-ReleaseInfo "Committed release files"
179+
}
180+
}
181+
182+
if ($script:RELEASE_DO_TAG -eq 1) {
183+
Write-ReleaseGitDirtyWarn
184+
if ((Test-ReleaseRemoteTagExists $tagCurrent) -or (Test-ReleaseLocalTagExists $tagCurrent)) {
185+
Write-ReleaseWarn "Tag $tagCurrent already exists; skipping git tag (use --upload to add assets)"
186+
} elseif ($script:RELEASE_DRY_RUN -eq 1) {
187+
Write-ReleaseInfo "Would: git tag -a $tagCurrent -m `"BLXCode $script:RELEASE_VERSION`""
188+
} else {
189+
& git tag -a $tagCurrent -m "BLXCode $script:RELEASE_VERSION"
190+
if ($LASTEXITCODE -ne 0) { Stop-Release "git tag failed" }
191+
Write-ReleaseInfo "Created tag $tagCurrent"
192+
}
193+
}
194+
195+
if ($script:RELEASE_DO_PUSH -eq 1) {
196+
if ($script:RELEASE_DRY_RUN -eq 1) {
197+
Write-ReleaseInfo "Would: git push $script:RELEASE_GIT_REMOTE && git push $script:RELEASE_GIT_REMOTE $tagCurrent"
198+
} else {
199+
& git push $script:RELEASE_GIT_REMOTE
200+
if ($LASTEXITCODE -ne 0) { Stop-Release "git push failed" }
201+
if (Test-ReleaseLocalTagExists $tagCurrent) {
202+
if (-not (Test-ReleaseRemoteTagExists $tagCurrent)) {
203+
& git push $script:RELEASE_GIT_REMOTE $tagCurrent
204+
if ($LASTEXITCODE -ne 0) { Stop-Release "git tag push failed" }
205+
Write-ReleaseInfo "Pushed tag $tagCurrent to $script:RELEASE_GIT_REMOTE"
206+
} else {
207+
Write-ReleaseInfo "Tag $tagCurrent already on $script:RELEASE_GIT_REMOTE; skipping tag push"
208+
}
209+
}
210+
}
211+
}
212+
213+
if ($script:RELEASE_DO_UPLOAD -eq 1) {
214+
Invoke-ReleaseUploadArtifacts $script:RELEASE_VERSION
215+
}
216+
217+
Write-ReleaseInfo "Done."
218+

0 commit comments

Comments
 (0)