diff --git a/wasm-rpc-stubgen/src/wit.rs b/wasm-rpc-stubgen/src/wit.rs index cd0221ce..c0db8284 100644 --- a/wasm-rpc-stubgen/src/wit.rs +++ b/wasm-rpc-stubgen/src/wit.rs @@ -150,7 +150,6 @@ pub fn copy_wit_files(def: &StubDefinition) -> anyhow::Result<()> { } } } - let wasm_rpc_wit = include_str!("../../wasm-rpc/wit/wasm-rpc.wit"); let wasm_rpc_root = dest_wit_root.join(Path::new("deps/wasm-rpc")); fs::create_dir_all(&wasm_rpc_root).unwrap(); @@ -158,7 +157,10 @@ pub fn copy_wit_files(def: &StubDefinition) -> anyhow::Result<()> { "Writing wasm-rpc.wit to {}", wasm_rpc_root.to_string_lossy() ); - fs::write(wasm_rpc_root.join(Path::new("wasm-rpc.wit")), wasm_rpc_wit)?; + fs::write( + wasm_rpc_root.join(Path::new("wasm-rpc.wit")), + golem_wasm_rpc::WASM_RPC_WIT, + )?; Ok(()) } diff --git a/wasm-rpc/Cargo.toml b/wasm-rpc/Cargo.toml index 3cd267e3..977b4bb7 100644 --- a/wasm-rpc/Cargo.toml +++ b/wasm-rpc/Cargo.toml @@ -6,6 +6,8 @@ license = "Apache-2.0" homepage = "https://golem.cloud" description = "Golem WASM RPC support library" +include = [] + [lib] path = "src/lib.rs" crate-type = ["cdylib", "rlib"] diff --git a/wasm-rpc/src/lib.rs b/wasm-rpc/src/lib.rs index 3c540df0..b2b942b7 100644 --- a/wasm-rpc/src/lib.rs +++ b/wasm-rpc/src/lib.rs @@ -272,6 +272,9 @@ impl<'a> arbitrary::Arbitrary<'a> for WitValue { } } +#[cfg(feature = "host")] +pub static WASM_RPC_WIT: &'static str = include_str!("../wit/wasm-rpc.wit"); + pub const WASM_RPC_VERSION: &str = env!("CARGO_PKG_VERSION"); #[cfg(test)]