fix: restrict Windows-specific code to x86_64 and update scripts

Updated Rust code to apply Windows-specific logic only on x86_64 targets using #[cfg(all(windows, target_arch = "x86_64"))]. Modified dev:tauri script in package.json to remove CLEAN=true and added CLEAN=true to beforeDevCommand in tauri.conf.json for consistency. Minor formatting changes in tauri.conf.json.
This commit is contained in:
Louis 2025-06-27 23:24:53 +07:00
parent 2bdbce2e40
commit d264220245
No known key found for this signature in database
GPG Key ID: 44FA9F4D33C37DE2
4 changed files with 6 additions and 9 deletions

View File

@ -20,7 +20,7 @@
"test:e2e:darwin": "echo 'E2E tests are not supported on macOS yet due to WebDriver limitations'", "test:e2e:darwin": "echo 'E2E tests are not supported on macOS yet due to WebDriver limitations'",
"test:e2e": "run-script-os", "test:e2e": "run-script-os",
"dev:web": "yarn workspace @janhq/web-app dev", "dev:web": "yarn workspace @janhq/web-app dev",
"dev:tauri": "CLEAN=true yarn build:icon && yarn copy:assets:tauri && tauri dev", "dev:tauri": "yarn build:icon && yarn copy:assets:tauri && tauri dev",
"copy:assets:tauri": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\"", "copy:assets:tauri": "cpx \"pre-install/*.tgz\" \"src-tauri/resources/pre-install/\"",
"download:lib": "node ./scripts/download-lib.mjs", "download:lib": "node ./scripts/download-lib.mjs",
"download:bin": "node ./scripts/download-bin.mjs", "download:bin": "node ./scripts/download-bin.mjs",

View File

@ -29,7 +29,7 @@ pub async fn cleanup_processes(state: State<'_, AppState>) {
} }
} }
#[cfg(windows)] #[cfg(all(windows, target_arch = "x86_64"))]
{ {
use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT}; use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT};
use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::Foundation::BOOL;

View File

@ -133,7 +133,7 @@ pub async fn load_llama_model(
// Optional: Redirect stdio if needed (e.g., for logging within Jan) // Optional: Redirect stdio if needed (e.g., for logging within Jan)
// command.stdout(Stdio::piped()); // command.stdout(Stdio::piped());
// command.stderr(Stdio::piped()); // command.stderr(Stdio::piped());
#[cfg(windows)] #[cfg(all(windows, target_arch = "x86_64"))]
{ {
command.creation_flags(CREATE_NEW_PROCESS_GROUP); command.creation_flags(CREATE_NEW_PROCESS_GROUP);
} }
@ -196,7 +196,7 @@ pub async fn unload_llama_model(
} }
} }
#[cfg(windows)] #[cfg(all(windows, target_arch = "x86_64"))]
{ {
use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT}; use windows_sys::Win32::System::Console::{GenerateConsoleCtrlEvent, CTRL_C_EVENT};
use windows_sys::Win32::Foundation::BOOL; use windows_sys::Win32::Foundation::BOOL;

View File

@ -6,7 +6,7 @@
"build": { "build": {
"frontendDist": "../web-app/dist", "frontendDist": "../web-app/dist",
"devUrl": "http://localhost:1420", "devUrl": "http://localhost:1420",
"beforeDevCommand": "cross-env IS_TAURI=true yarn dev:web", "beforeDevCommand": "cross-env IS_TAURI=true CLEAN=true yarn dev:web",
"beforeBuildCommand": "cross-env IS_TAURI=true yarn build:web" "beforeBuildCommand": "cross-env IS_TAURI=true yarn build:web"
}, },
"app": { "app": {
@ -90,10 +90,7 @@
"resources/lib/", "resources/lib/",
"binaries/**/*" "binaries/**/*"
], ],
"externalBin": [ "externalBin": ["resources/bin/bun", "resources/bin/uv"],
"resources/bin/bun",
"resources/bin/uv"
],
"linux": { "linux": {
"appimage": { "appimage": {
"bundleMediaFramework": false, "bundleMediaFramework": false,