From ae9032025f22f1aa3c32f0112f310527dcf228f2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?D=C3=A1vid=20Istv=C3=A1n=20B=C3=ADr=C3=B3?= Date: Mon, 9 Dec 2024 06:37:39 +0100 Subject: [PATCH] fix component source dir vs component source mix-up --- wasm-rpc-stubgen/src/commands/app.rs | 2 +- wasm-rpc-stubgen/src/model/app.rs | 4 ++++ wasm-rpc-stubgen/src/wit_resolve.rs | 4 +--- 3 files changed, 6 insertions(+), 4 deletions(-) diff --git a/wasm-rpc-stubgen/src/commands/app.rs b/wasm-rpc-stubgen/src/commands/app.rs index 4c95d92..1897dcc 100644 --- a/wasm-rpc-stubgen/src/commands/app.rs +++ b/wasm-rpc-stubgen/src/commands/app.rs @@ -390,7 +390,7 @@ async fn link_rpc( let _indent = LogIndent::new(); for component_name in ctx.application.component_names() { - let source = ctx.application.component_source_dir(component_name); + let source = ctx.application.component_source(component_name); let dependencies = ctx .application .component_wasm_rpc_dependencies(component_name); diff --git a/wasm-rpc-stubgen/src/model/app.rs b/wasm-rpc-stubgen/src/model/app.rs index d85cf52..844d531 100644 --- a/wasm-rpc-stubgen/src/model/app.rs +++ b/wasm-rpc-stubgen/src/model/app.rs @@ -873,6 +873,10 @@ impl Application { .unwrap_or_else(|| panic!("Component not found: {}", component_name)) } + pub fn component_source(&self, component_name: &ComponentName) -> &Path { + &self.component(component_name).source + } + pub fn component_source_dir(&self, component_name: &ComponentName) -> &Path { self.component(component_name).source_dir() } diff --git a/wasm-rpc-stubgen/src/wit_resolve.rs b/wasm-rpc-stubgen/src/wit_resolve.rs index acf5987..a528506 100644 --- a/wasm-rpc-stubgen/src/wit_resolve.rs +++ b/wasm-rpc-stubgen/src/wit_resolve.rs @@ -422,9 +422,7 @@ impl ResolvedWitApplication { { validation.push_context( "source", - app.component_source_dir(component_name) - .to_string_lossy() - .to_string(), + app.component_source(component_name).display().to_string(), ); }