From 4aa392adb830bfdd55e616b16734485c7a2dc4b3 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Sat, 29 Mar 2025 19:05:13 +0800 Subject: [PATCH 1/2] windows: Upload release binary So that the vcruntime DLL is built in and runs on freshly installed windows systems. Signed-off-by: Daniel Schaefer --- .github/workflows/ci.yml | 10 +++++++--- framework_tool/Cargo.toml | 1 + 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index da60cb70..2a261d25 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -91,20 +91,24 @@ jobs: - name: Setup Rust toolchain run: rustup show + # Build debug library first to fail fast - name: Build library (Windows) run: cargo build -p framework_lib --no-default-features --features "windows" - name: Build Windows tool - run: cargo build -p framework_tool --no-default-features --features "windows" + run: | + cargo build -p framework_tool --no-default-features --features "windows" + cargo build -p framework_tool --no-default-features --features "windows" --release - name: Check if Windows tool can start - run: cargo run --no-default-features --features "windows" -- --help + run: cargo run --no-default-features --features "windows" -- --help --release + # Upload release build so that vcruntime is statically linked - name: Upload Windows App uses: actions/upload-artifact@v4 with: name: framework_tool.exe - path: target/debug/framework_tool.exe + path: target/release/framework_tool.exe test: diff --git a/framework_tool/Cargo.toml b/framework_tool/Cargo.toml index f4d3bfa9..1a6d4dec 100644 --- a/framework_tool/Cargo.toml +++ b/framework_tool/Cargo.toml @@ -14,4 +14,5 @@ path = "../framework_lib" default-features = false [build-dependencies] +# Note: Only takes effect in release builds static_vcruntime = "2.0" From 8454d666a35527ecee9c6ffba716891d53ef8621 Mon Sep 17 00:00:00 2001 From: Daniel Schaefer Date: Thu, 10 Apr 2025 11:53:37 +0800 Subject: [PATCH 2/2] chromium_mod: First convert then slice More efficient. Highlighted by new clippy lint: ``` error: calling `as_bytes` after slicing a string --> framework_lib/src/chromium_ec/mod.rs:919:45 | 919 | request.name[..end].copy_from_slice(name[..end].as_bytes()); | ^^^^^^^^^^^^^^^^^^^^^^ help: try: `&name.as_bytes()[..end]` | = help: for further information visit https://rust-lang.github.io/rust-clippy/master/index.html#sliced_string_as_bytes = note: `-D clippy::sliced-string-as-bytes` implied by `-D warnings` = help: to override `-D warnings` add `#[allow(clippy::sliced_string_as_bytes)]` ``` Signed-off-by: Daniel Schaefer --- framework_lib/src/chromium_ec/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/framework_lib/src/chromium_ec/mod.rs b/framework_lib/src/chromium_ec/mod.rs index 05713c34..17702689 100644 --- a/framework_lib/src/chromium_ec/mod.rs +++ b/framework_lib/src/chromium_ec/mod.rs @@ -916,7 +916,7 @@ impl CrosEc { let mut request = EcRequestGpioGetV0 { name: [0; MAX_LEN] }; let end = MAX_LEN.min(name.len()); - request.name[..end].copy_from_slice(name[..end].as_bytes()); + request.name[..end].copy_from_slice(&name.as_bytes()[..end]); let res = request.send_command(self)?; Ok(res.val == 1)