Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions changelog.d/8354-fmt-after-8337.md
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
Apply `cargo fmt` to `optimized_libs/{no_auto,tests}.rs` after #8337, which landed from a fork branch that could not be amended in place.
20 changes: 7 additions & 13 deletions crates/perry/src/commands/compile/optimized_libs/no_auto.rs
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@ use std::process::Command;

use crate::OutputFormat;

use super::super::library_search::{
android_cross_env, find_harmonyos_sdk, harmonyos_cross_env,
};
use super::super::library_search::{android_cross_env, find_harmonyos_sdk, harmonyos_cross_env};
use super::super::{
find_perry_workspace_root, is_android_target, is_windows_target, rust_target_triple,
CompilationContext,
Expand Down Expand Up @@ -89,15 +87,15 @@ fn build_wasm_host_runtime(
}

if matches!(format, OutputFormat::Text) {
println!(
" wasm-host (no-auto): rebuilding perry-runtime-static with wasm-host feature"
);
println!(" wasm-host (no-auto): rebuilding perry-runtime-static with wasm-host feature");
}

// Use a dedicated target dir so the prebuilt libperry_runtime.a in
// target/release is not overwritten. Cargo's incremental cache makes
// repeat builds a no-op.
let wasm_host_target_dir = workspace_root.join("target").join("perry-wasm-host-runtime");
let wasm_host_target_dir = workspace_root
.join("target")
.join("perry-wasm-host-runtime");

let mut cargo_cmd = Command::new("cargo");
cargo_cmd
Expand Down Expand Up @@ -134,9 +132,7 @@ fn build_wasm_host_runtime(
}
if is_android_target(target) {
if let Some(ndk) = std::env::var_os("ANDROID_NDK_HOME") {
for (k, v) in
android_cross_env(std::path::Path::new(&ndk), target)
{
for (k, v) in android_cross_env(std::path::Path::new(&ndk), target) {
cargo_cmd.env(k, v);
}
}
Expand All @@ -154,9 +150,7 @@ fn build_wasm_host_runtime(
}
Err(err) => {
if matches!(format, OutputFormat::Text) {
eprintln!(
" wasm-host (no-auto): failed to spawn cargo ({err})"
);
eprintln!(" wasm-host (no-auto): failed to spawn cargo ({err})");
}
return None;
}
Expand Down
6 changes: 2 additions & 4 deletions crates/perry/src/commands/compile/optimized_libs/tests.rs
Original file line number Diff line number Diff line change
Expand Up @@ -1299,10 +1299,8 @@ fn wasm_usage_changes_auto_optimize_cache_key() {
ctx_no_wasm.uses_crypto_builtins,
);
let feature_arg = features_to_cargo_arg(&features);
let key_no_wasm =
auto_optimized_cache_key(&feature_arg, true, false, None, &ctx_no_wasm);
let key_wasm =
auto_optimized_cache_key(&feature_arg, true, false, None, &ctx_wasm);
let key_no_wasm = auto_optimized_cache_key(&feature_arg, true, false, None, &ctx_no_wasm);
let key_wasm = auto_optimized_cache_key(&feature_arg, true, false, None, &ctx_wasm);
assert_ne!(
key_no_wasm, key_wasm,
"wasm usage must change the cache key so the target dirs don't collide"
Expand Down
Loading