Skip to content

Commit 84511c0

Browse files
authored
Merge pull request #2272 from fermyon/fix-test-components
Fix test components build
2 parents d120905 + 23ef04a commit 84511c0

File tree

3 files changed

+13
-1
lines changed

3 files changed

+13
-1
lines changed

.vscode/settings.json

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,9 @@
1414
},
1515
"rust-analyzer.files.excludeDirs": [
1616
"templates"
17+
],
18+
"rust-analyzer.linkedProjects": [
19+
"./Cargo.toml",
20+
"./tests/test-components/components/Cargo.toml"
1721
]
1822
}

tests/test-components/build.rs

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,15 @@ fn main() {
2525
for package in packages {
2626
let crate_path = PathBuf::from("components").join(&package);
2727
let manifest_path = crate_path.join("Cargo.toml");
28+
if !manifest_path.exists() {
29+
eprintln!("No Cargo.toml in {crate_path:?}; skipping");
30+
continue;
31+
}
2832
let manifest = cargo_toml::Manifest::from_path(&manifest_path)
2933
.expect("failed to read and parse Cargo manifest");
3034

35+
eprintln!("Building test component {:?}", manifest.package().name());
36+
3137
// Build the test component
3238
let mut cargo = Command::new("cargo");
3339
cargo
@@ -42,7 +48,7 @@ fn main() {
4248
let const_name = to_shouty_snake_case(&package);
4349
let package_name = manifest.package.expect("manifest has no package").name;
4450
let binary_name = package_name.replace(['-', '.'], "_");
45-
let wasm_path = out_dir
51+
let mut wasm_path = out_dir
4652
.join("wasm32-wasi")
4753
.join("debug")
4854
.join(format!("{binary_name}.wasm"));
@@ -65,6 +71,7 @@ fn main() {
6571
.expect("failed to apply adapter")
6672
.encode()
6773
.expect("failed to encode component");
74+
wasm_path = wasm_path.with_extension("adapted.wasm");
6875
std::fs::write(&wasm_path, new_bytes).expect("failed to write new wasm binary");
6976
}
7077

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,4 @@
11
[workspace]
22
members = ["*"]
3+
exclude = ["target"]
34
resolver = "2"

0 commit comments

Comments
 (0)