Skip to content

Commit

Permalink
fix: windows build
Browse files Browse the repository at this point in the history
  • Loading branch information
Xtr126 committed Nov 28, 2023
1 parent c25f081 commit 20061c6
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 11 deletions.
11 changes: 9 additions & 2 deletions .github/workflows/build-preview.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,13 +27,20 @@ jobs:
steps:
- name: Checkout
uses: actions/checkout@v3

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Set up Node
uses: actions/setup-node@v3
uses: actions/setup-node@v4
with:
node-version: 20
cache: 'pnpm'
- name: Install dependencies

- name: Install frontend dependencies
run: pnpm install

- name: Build
run: pnpm run build --base=/Android-x86-installer/
- name: Setup Pages
Expand Down
16 changes: 13 additions & 3 deletions .github/workflows/tauri.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
name: 'publish'
on:
workflow_dispatch:
push:
paths:
- '**.yml'

jobs:
publish-tauri:
Expand All @@ -12,7 +15,7 @@ jobs:
strategy:
fail-fast: false
matrix:
platform: [ubuntu-22.04]
platform: [ubuntu-22.04, windows-latest]

runs-on: ${{ matrix.platform }}
steps:
Expand All @@ -22,6 +25,14 @@ jobs:
with:
node-version: 20
cache: 'pnpm'

- uses: pnpm/action-setup@v2
with:
version: 8

- name: Install frontend dependencies
run: pnpm install

- name: install Rust stable
uses: dtolnay/rust-toolchain@stable

Expand All @@ -35,6 +46,7 @@ jobs:
run: echo "VCPKG_ROOT=$VCPKG_INSTALLATION_ROOT" >> $GITHUB_ENV

- name: Cache vcpkg
if: matrix.platform == 'windows-latest'
uses: actions/cache@v3
with:
path: |
Expand All @@ -58,8 +70,6 @@ jobs:
restore-keys: |
${{ runner.os }}-${{runner.arch}}-cargo-
- name: install frontend dependencies
run: pnpm install
- uses: tauri-apps/tauri-action@v0
env:
Expand Down
15 changes: 9 additions & 6 deletions src-tauri/src/qemu_install.rs
Original file line number Diff line number Diff line change
@@ -1,6 +1,4 @@
use std::path::Path;
use std::os::unix::fs::OpenOptionsExt;
use std::fs;

#[tauri::command]
pub fn install_qemu(
Expand Down Expand Up @@ -70,10 +68,15 @@ fi
"#);

let script_path = Path::new(&install_dir).join("start_android.sh");
// make file executable
fs::OpenOptions::new().create(true).write(true).mode(0o770)
.open(script_path.clone()).unwrap();

// make script executable
#[cfg(linux)] {
let mut options = fs::OpenOptions::new();
std::os::unix::fs::OpenOptionsExt::mode(&mut options, 0o770);
options.create(true).write(true).open(script_path.clone()).unwrap();
}

std::fs::write(script_path, contents).map_err(|err| err.to_string())?;
Ok(format!("qemu script written to {install_dir}/start_android.sh
-m {memsize_mb} -smp {cpus} res: {x_res}x{y_res} -display {display_type} use-gl={use_gl} input: {device_type} {input_type} serial_console: {enable_serial_console} e2fsck: {perform_e2fsck} forwardport: {forward_port} {forward_port_no} override_sdl_videodriver: {override_sdl_videodriver} {sdl_videodriver} "))
}
}

0 comments on commit 20061c6

Please sign in to comment.