Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat(deps): add separate wit-wasm and wit-std features #531

Merged
merged 5 commits into from
Jan 2, 2025
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
165 changes: 156 additions & 9 deletions Cargo.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,7 @@ wadm-types = { version = "0.7.1", path = "./crates/wadm-types" }
wasmcloud-control-interface = { version = "2.2.0" }
wasmcloud-secrets-types = "0.5.0"
wit-bindgen-wrpc = { version = "0.9", default-features = false }
wit-bindgen = { version = "0.36.0", default-features = false }

[dev-dependencies]
chrono = { workspace = true }
Expand Down
13 changes: 8 additions & 5 deletions crates/wadm-types/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,7 @@ license = "Apache-2.0"
repository = "https://github.com/wasmcloud/wadm"

[features]
default = ["std"]
std = ["dep:tokio"]
wit = ["wit-bindgen-wrpc"]
wit = []

[dependencies]
serde = { workspace = true, features = ["derive"] }
Expand All @@ -21,5 +19,10 @@ anyhow = { workspace = true }
regex = { workspace = true }
schemars = { workspace = true }
utoipa = { workspace = true }
tokio = { workspace = true, optional = true, features = ["full"] }
wit-bindgen-wrpc = { workspace = true, optional = true }

[target.'cfg(not(target_family = "wasm"))'.dependencies]
tokio = { workspace = true, features = ["full"] }
wit-bindgen-wrpc = { workspace = true }

[target.'cfg(target_family = "wasm")'.dependencies]
wit-bindgen = { workspace = true, features = ["macros"] }
15 changes: 15 additions & 0 deletions crates/wadm-types/src/bindings.rs
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,21 @@ use crate::{
};
use wasmcloud::wadm;

#[cfg(all(feature = "wit", target_family = "wasm"))]
wit_bindgen::generate!({
path: "wit",
additional_derives: [
serde::Serialize,
serde::Deserialize,
],
with: {
"wasmcloud:wadm/[email protected]": generate,
"wasmcloud:wadm/[email protected]": generate,
"wasmcloud:wadm/[email protected]": generate
}
});

#[cfg(all(feature = "wit", not(target_family = "wasm")))]
wit_bindgen_wrpc::generate!({
generate_unused_types: true,
additional_derives: [
Expand Down
4 changes: 2 additions & 2 deletions crates/wadm-types/src/validation.rs
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
//!
use std::collections::{HashMap, HashSet};
#[cfg(feature = "std")]
#[cfg(not(target_family = "wasm"))]
use std::path::Path;
use std::sync::OnceLock;

Expand Down Expand Up @@ -274,7 +274,7 @@ impl ValidationOutput for Vec<ValidationFailure> {
/// # Arguments
///
/// * `path` - Path to the Manifest that will be read into memory and validated
#[cfg(feature = "std")]
#[cfg(not(target_family = "wasm"))]
pub async fn validate_manifest_file(
path: impl AsRef<Path>,
) -> Result<(Manifest, Vec<ValidationFailure>)> {
Expand Down
4 changes: 2 additions & 2 deletions crates/wadm-types/wit/deps.lock
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
[wadm]
path = "../../../wit/wadm"
sha256 = "be9dcb406ac45d69c18c70d962572b9def1f59787246caf27b54f255a817ace7"
sha512 = "c3a3dc09613acff547165627174323096e50abd31998a3514917cc7b2596d86ae04bf4950cbbfac932fc82b2039f435f278fe25eb6f9d23ab7678662e8d528f1"
sha256 = "9795ab1a83023da07da2dc28d930004bd913b9dbf07d68d9ef9207a44348a169"
sha512 = "9a94f33fd861912c81efd441cd19cc8066dbb2df5c2236d0472b66294bddc20ec5ad569484be18334d8c104ae9647b2c81c9878210ac35694ad8ba4a5b3780be"
4 changes: 2 additions & 2 deletions crates/wadm-types/wit/deps/wadm/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ interface types {
deployed,
failed,
waiting,
unhealthy,
unhealthy
}

enum deploy-result {
Expand Down Expand Up @@ -215,4 +215,4 @@ interface types {
requirements: list<tuple<string, string>>,
weight: option<u32>,
}
}
}
3 changes: 2 additions & 1 deletion wit/wadm/types.wit
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,7 @@ interface types {
deployed,
failed,
waiting,
unhealthy
}

enum deploy-result {
Expand Down Expand Up @@ -214,4 +215,4 @@ interface types {
requirements: list<tuple<string, string>>,
weight: option<u32>,
}
}
}