From ba1c2d4d870ef45e76cf01ca5a54e99ca00a4d67 Mon Sep 17 00:00:00 2001 From: David Moravek Date: Tue, 27 Aug 2024 09:15:50 +0200 Subject: [PATCH] Don't fail parsing on `@feature` and `@since` gates. --- Cargo.lock | 120 +++++++++++++++++++----------------- Cargo.toml | 14 ++--- crates/core/src/registry.rs | 20 +++--- crates/wit/src/lib.rs | 18 +++--- crates/wit/tests/build.rs | 6 +- src/bindings.rs | 63 ++++++++++++++----- src/generator.rs | 9 ++- tests/support/mod.rs | 6 +- 8 files changed, 151 insertions(+), 105 deletions(-) diff --git a/Cargo.lock b/Cargo.lock index 7fff07ea..48e5cc60 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -586,16 +586,16 @@ dependencies = [ "warg-protocol", "warg-server", "wasi-preview1-component-adapter-provider", - "wasm-metadata 0.208.1", + "wasm-metadata 0.215.0", "wasm-pkg-client", - "wasmparser 0.208.1", - "wasmprinter 0.208.1", + "wasmparser 0.215.0", + "wasmprinter 0.215.0", "wat", "which", "wit-bindgen-core", "wit-bindgen-rust", - "wit-component 0.208.1", - "wit-parser 0.208.1", + "wit-component 0.215.0", + "wit-parser 0.215.0", ] [[package]] @@ -622,8 +622,8 @@ dependencies = [ "warg-protocol", "wasm-pkg-client", "windows-sys 0.52.0", - "wit-component 0.208.1", - "wit-parser 0.208.1", + "wit-component 0.215.0", + "wit-parser 0.215.0", ] [[package]] @@ -4467,36 +4467,37 @@ dependencies = [ [[package]] name = "wasm-encoder" -version = "0.208.1" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "6425e84e42f7f558478e40ecc2287912cb319f2ca68e5c0bb93c61d4fc63fa17" +checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.209.1" +version = "0.210.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7b4a05336882dae732ce6bd48b7e11fe597293cb72c13da4f35d7d5f8d53b2a7" +checksum = "e7e3764d9d6edabd8c9e16195e177be0d20f6ab942ad18af52860f12f82bc59a" dependencies = [ "leb128", ] [[package]] name = "wasm-encoder" -version = "0.210.0" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e7e3764d9d6edabd8c9e16195e177be0d20f6ab942ad18af52860f12f82bc59a" +checksum = "4fb56df3e06b8e6b77e37d2969a50ba51281029a9aeb3855e76b7f49b6418847" dependencies = [ "leb128", + "wasmparser 0.215.0", ] [[package]] name = "wasm-metadata" -version = "0.208.1" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "42a2c4280ad374a6db3d76d4bb61e2ec4b3b9ce5469cc4f2bbc5708047a2bbff" +checksum = "4d32029ce424f6d3c2b39b4419fb45a0e2d84fb0751e0c0a32b7ce8bd5d97f46" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -4504,15 +4505,15 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.208.1", - "wasmparser 0.208.1", + "wasm-encoder 0.209.1", + "wasmparser 0.209.1", ] [[package]] name = "wasm-metadata" -version = "0.209.1" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d32029ce424f6d3c2b39b4419fb45a0e2d84fb0751e0c0a32b7ce8bd5d97f46" +checksum = "0c6bb07c5576b608f7a2a9baa2294c1a3584a249965d695a9814a496cb6d232f" dependencies = [ "anyhow", "indexmap 2.2.6", @@ -4520,8 +4521,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder 0.209.1", - "wasmparser 0.209.1", + "wasm-encoder 0.215.0", + "wasmparser 0.215.0", ] [[package]] @@ -4601,29 +4602,29 @@ dependencies = [ [[package]] name = "wasmparser" -version = "0.208.1" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "dd921789c9dcc495f589cb37d200155dee65b4a4beeb853323b5e24e0a5f9c58" +checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" dependencies = [ "ahash", "bitflags 2.5.0", "hashbrown 0.14.5", "indexmap 2.2.6", "semver", - "serde 1.0.203", ] [[package]] name = "wasmparser" -version = "0.209.1" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "07035cc9a9b41e62d3bb3a3815a66ab87c993c06fe1cf6b2a3f2a18499d937db" +checksum = "53fbde0881f24199b81cf49b6ff8f9c145ac8eb1b7fc439adb5c099734f7d90e" dependencies = [ "ahash", "bitflags 2.5.0", "hashbrown 0.14.5", "indexmap 2.2.6", "semver", + "serde 1.0.203", ] [[package]] @@ -4638,12 +4639,13 @@ dependencies = [ [[package]] name = "wasmprinter" -version = "0.208.1" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0700bdace4821e6c694617938500ae9999946df464bb13219c16570f8b6f202f" +checksum = "d8e9a325d85053408209b3d2ce5eaddd0dd6864d1cff7a007147ba073157defc" dependencies = [ "anyhow", - "wasmparser 0.208.1", + "termcolor", + "wasmparser 0.215.0", ] [[package]] @@ -4931,43 +4933,45 @@ dependencies = [ "warg-crypto", "warg-protocol", "warg-server", - "wasm-metadata 0.208.1", + "wasm-metadata 0.215.0", "wasm-pkg-client", - "wasmparser 0.208.1", - "wit-component 0.208.1", - "wit-parser 0.208.1", + "wasmparser 0.215.0", + "wit-component 0.215.0", + "wit-parser 0.215.0", ] [[package]] name = "wit-bindgen-core" -version = "0.25.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7076a12e69af6e1f6093bd16657d7ae61c30cfd3c5f62321046eb863b17ab1e2" +checksum = "bb7e3df01cd43cfa1cb52602e4fc05cb2b62217655f6705639b6953eb0a3fed2" dependencies = [ "anyhow", "heck 0.5.0", - "wit-parser 0.208.1", + "wit-parser 0.215.0", ] [[package]] name = "wit-bindgen-rust" -version = "0.25.0" +version = "0.30.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7f8ca0dd2aa75452450da1906391aba9d3a43d95fa920e872361ea00acc452a5" +checksum = "61a767d1a8eb4e908bfc53febc48b87ada545703b16fe0148ee7736a29a01417" dependencies = [ "anyhow", "heck 0.5.0", "indexmap 2.2.6", - "wasm-metadata 0.208.1", + "prettyplease", + "syn 2.0.66", + "wasm-metadata 0.215.0", "wit-bindgen-core", - "wit-component 0.208.1", + "wit-component 0.215.0", ] [[package]] name = "wit-component" -version = "0.208.1" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fef7dd0e47f5135dd8739ccc5b188ab8b7e27e1d64df668aa36680f0b8646db8" +checksum = "25a2bb5b039f9cb03425e1d5a6e54b441ca4ca1b1d4fa6a0924db67a55168f99" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -4976,17 +4980,17 @@ dependencies = [ "serde 1.0.203", "serde_derive", "serde_json", - "wasm-encoder 0.208.1", - "wasm-metadata 0.208.1", - "wasmparser 0.208.1", - "wit-parser 0.208.1", + "wasm-encoder 0.209.1", + "wasm-metadata 0.209.1", + "wasmparser 0.209.1", + "wit-parser 0.209.1", ] [[package]] name = "wit-component" -version = "0.209.1" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25a2bb5b039f9cb03425e1d5a6e54b441ca4ca1b1d4fa6a0924db67a55168f99" +checksum = "f725e3885fc5890648be5c5cbc1353b755dc932aa5f1aa7de968b912a3280743" dependencies = [ "anyhow", "bitflags 2.5.0", @@ -4995,17 +4999,17 @@ dependencies = [ "serde 1.0.203", "serde_derive", "serde_json", - "wasm-encoder 0.209.1", - "wasm-metadata 0.209.1", - "wasmparser 0.209.1", - "wit-parser 0.209.1", + "wasm-encoder 0.215.0", + "wasm-metadata 0.215.0", + "wasmparser 0.215.0", + "wit-parser 0.215.0", ] [[package]] name = "wit-parser" -version = "0.208.1" +version = "0.209.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "516417a730725fe3e6c9e2efc8d86697480f80496d32b24e62736950704c047c" +checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269" dependencies = [ "anyhow", "id-arena", @@ -5016,14 +5020,14 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.208.1", + "wasmparser 0.209.1", ] [[package]] name = "wit-parser" -version = "0.209.1" +version = "0.215.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3e79b9e3c0b6bb589dec46317e645851e0db2734c44e2be5e251b03ff4a51269" +checksum = "935a97eaffd57c3b413aa510f8f0b550a4a9fe7d59e79cd8b89a83dcb860321f" dependencies = [ "anyhow", "id-arena", @@ -5034,7 +5038,7 @@ dependencies = [ "serde_derive", "serde_json", "unicode-xid", - "wasmparser 0.209.1", + "wasmparser 0.215.0", ] [[package]] diff --git a/Cargo.toml b/Cargo.toml index 47457592..aed54649 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -106,16 +106,16 @@ warg-crypto = "0.7.0" warg-protocol = "0.7.0" warg-server = "0.7.0" wasi-preview1-component-adapter-provider = "23.0.1" -wasm-metadata = "0.208.1" +wasm-metadata = "0.215.0" wasm-pkg-client = { git = "https://github.com/bytecodealliance/wasm-pkg-tools.git", rev = "c48006aa1bcff1e69f4f8fc6689249b314985ab1" } -wasmparser = "0.208.1" -wasmprinter = "0.208.1" +wasmparser = "0.215.0" +wasmprinter = "0.215.0" wat = "1.208.1" which = "6.0.1" -wit-bindgen-core = "0.25.0" -wit-bindgen-rust = "0.25.0" -wit-component = "0.208.1" -wit-parser = "0.208.1" +wit-bindgen-core = "0.30.0" +wit-bindgen-rust = "0.30.0" +wit-component = "0.215.0" +wit-parser = "0.215.0" [profile.release] panic = "abort" diff --git a/crates/core/src/registry.rs b/crates/core/src/registry.rs index 70b6c3d7..30f89ea8 100644 --- a/crates/core/src/registry.rs +++ b/crates/core/src/registry.rs @@ -24,7 +24,7 @@ use wasm_pkg_client::{ Client, Config, ContentDigest, Error as WasmPkgError, PackageRef, Release, VersionInfo, }; use wit_component::DecodedWasm; -use wit_parser::{PackageId, PackageName, Resolve, UnresolvedPackage, WorldId}; +use wit_parser::{PackageId, PackageName, Resolve, UnresolvedPackageGroup, WorldId}; use crate::{ lock::{LockFileResolver, LockedPackageVersion}, @@ -315,7 +315,7 @@ impl DependencyResolution { { return Ok(DecodedDependency::Wit { resolution: self, - package: UnresolvedPackage::parse_dir(path).with_context(|| { + package: UnresolvedPackageGroup::parse_dir(path).with_context(|| { format!("failed to parse dependency `{path}`", path = path.display()) })?, }); @@ -354,9 +354,9 @@ impl DependencyResolution { if &bytes[0..4] != b"\0asm" { return Ok(DecodedDependency::Wit { resolution: self, - package: UnresolvedPackage::parse( + package: UnresolvedPackageGroup::parse( // This is fake, but it's needed for the parser to work. - self.name().to_string().as_ref(), + self.name().to_string(), std::str::from_utf8(&bytes).with_context(|| { format!( "dependency `{name}` is not UTF-8 encoded", @@ -386,7 +386,7 @@ pub enum DecodedDependency<'a> { /// The resolution related to the decoded dependency. resolution: &'a DependencyResolution, /// The unresolved WIT package. - package: UnresolvedPackage, + package: UnresolvedPackageGroup, }, /// The dependency decoded from a Wasm file. Wasm { @@ -406,8 +406,12 @@ impl<'a> DecodedDependency<'a> { match self { Self::Wit { package, .. } => { let mut resolve = Resolve::new(); - let source_files = package.source_files().map(Path::to_path_buf).collect(); - let pkg = resolve.push(package)?; + let source_files = package + .source_map + .source_files() + .map(Path::to_path_buf) + .collect(); + let pkg = resolve.push_group(package)?; Ok((resolve, pkg, source_files)) } Self::Wasm { decoded, .. } => match decoded { @@ -423,7 +427,7 @@ impl<'a> DecodedDependency<'a> { /// Gets the package name of the decoded dependency. pub fn package_name(&self) -> &PackageName { match self { - Self::Wit { package, .. } => &package.name, + Self::Wit { package, .. } => &package.main.name, Self::Wasm { decoded, .. } => &decoded.resolve().packages[decoded.package()].name, } } diff --git a/crates/wit/src/lib.rs b/crates/wit/src/lib.rs index e3f1eb9b..101184a8 100644 --- a/crates/wit/src/lib.rs +++ b/crates/wit/src/lib.rs @@ -19,7 +19,7 @@ use warg_protocol::registry; use wasm_metadata::{Link, LinkType, RegistryMetadata}; use wasm_pkg_client::caching::FileCache; use wit_component::DecodedWasm; -use wit_parser::{PackageId, PackageName, Resolve, UnresolvedPackage}; +use wit_parser::{PackageId, PackageName, Resolve, UnresolvedPackageGroup}; pub mod commands; pub mod config; @@ -97,14 +97,18 @@ async fn parse_wit_package( } // Parse the root package itself - let root = UnresolvedPackage::parse_dir(dir).with_context(|| { + let root = UnresolvedPackageGroup::parse_dir(dir).with_context(|| { format!( "failed to parse package from directory `{dir}`", dir = dir.display() ) })?; - let mut source_files: Vec<_> = root.source_files().map(Path::to_path_buf).collect(); + let mut source_files: Vec<_> = root + .source_map + .source_files() + .map(Path::to_path_buf) + .collect(); // Do a topological sort of the dependencies let mut order = IndexSet::new(); @@ -122,8 +126,8 @@ async fn parse_wit_package( resolution, package, } => { - source_files.extend(package.source_files().map(Path::to_path_buf)); - merged.push(package).with_context(|| { + source_files.extend(package.source_map.source_files().map(Path::to_path_buf)); + merged.push_group(package).with_context(|| { format!( "failed to merge dependency `{name}`", name = resolution.name() @@ -149,7 +153,7 @@ async fn parse_wit_package( }; } - let package = merged.push(root).with_context(|| { + let package = merged.push_group(root).with_context(|| { format!( "failed to merge package from directory `{dir}`", dir = dir.display() @@ -174,7 +178,7 @@ async fn parse_wit_package( package, resolution, } => { - for name in package.foreign_deps.keys() { + for name in package.main.foreign_deps.keys() { // Only visit known dependencies // wit-parser will error on unknown foreign dependencies when // the package is resolved diff --git a/crates/wit/tests/build.rs b/crates/wit/tests/build.rs index ad82c21f..1020a800 100644 --- a/crates/wit/tests/build.rs +++ b/crates/wit/tests/build.rs @@ -34,14 +34,16 @@ fn it_builds() -> Result<()> { let project = Project::new("foo")?; project.file( "bar.wit", - r#"package foo:bar; + r#"package foo:bar@1.2.3; +@since(version = 1.2.3) interface bar {} +@since(version = 1.2.3) world bar-world {} "#, )?; project.file( "baz.wit", - r#"package foo:bar; + r#"package foo:bar@1.2.3; interface baz {} world baz-world {} "#, diff --git a/src/bindings.rs b/src/bindings.rs index 497efa09..a50114a0 100644 --- a/src/bindings.rs +++ b/src/bindings.rs @@ -11,10 +11,10 @@ use indexmap::{IndexMap, IndexSet}; use semver::Version; use wasm_pkg_client::PackageRef; use wit_bindgen_core::Files; -use wit_bindgen_rust::Opts; +use wit_bindgen_rust::{Opts, WithOption}; use wit_component::DecodedWasm; use wit_parser::{ - Interface, Package, PackageName, Resolve, Type, TypeDefKind, TypeOwner, UnresolvedPackage, + Interface, Package, PackageName, Resolve, Type, TypeDefKind, TypeOwner, UnresolvedPackageGroup, World, WorldId, WorldItem, WorldKey, }; @@ -95,7 +95,7 @@ impl<'a> BindingsGenerator<'a> { pub fn generate(self) -> Result { let settings = &self.resolution.metadata.section.bindings; let opts = Opts { - rustfmt: settings.format, + format: settings.format, ownership: match settings.ownership { Ownership::Owning => wit_bindgen_rust::Ownership::Owning, Ownership::Borrowing => wit_bindgen_rust::Ownership::Borrowing { @@ -118,7 +118,7 @@ impl<'a> BindingsGenerator<'a> { with: settings .with .iter() - .map(|(key, value)| (key.clone(), value.clone())) + .map(|(key, value)| (key.clone(), WithOption::Path(value.clone()))) .collect(), type_section_suffix: settings.type_section_suffix.clone(), disable_run_ctors_once_workaround: settings.disable_run_ctors_once_workaround, @@ -126,6 +126,9 @@ impl<'a> BindingsGenerator<'a> { export_macro_name: settings.export_macro_name.clone(), pub_export_macro: settings.pub_export_macro, generate_unused_types: settings.generate_unused_types, + // todo - add support for these settings + generate_all: true, + disable_custom_section_link_helpers: false, }; let mut files = Files::default(); @@ -193,7 +196,8 @@ impl<'a> BindingsGenerator<'a> { let source = merged .merge(resolve) .with_context(|| format!("failed to merge world of dependency `{id}`"))? - .worlds[component_world_id.index()]; + .worlds[component_world_id.index()] + .unwrap(); Self::import_world( &mut merged, source, @@ -254,14 +258,14 @@ impl<'a> BindingsGenerator<'a> { // Parse the target package itself let root = if path.is_dir() { - UnresolvedPackage::parse_dir(path).with_context(|| { + UnresolvedPackageGroup::parse_dir(path).with_context(|| { format!( "failed to parse local target from directory `{}`", path.display() ) })? } else { - UnresolvedPackage::parse_file(path).with_context(|| { + UnresolvedPackageGroup::parse_file(path).with_context(|| { format!( "failed to parse local target `{path}`", path = path.display() @@ -269,7 +273,11 @@ impl<'a> BindingsGenerator<'a> { })? }; - let mut source_files: Vec<_> = root.source_files().map(Path::to_path_buf).collect(); + let mut source_files: Vec<_> = root + .source_map + .source_files() + .map(Path::to_path_buf) + .collect(); // Do a topological sort of the dependencies let mut order = IndexSet::new(); @@ -287,8 +295,8 @@ impl<'a> BindingsGenerator<'a> { resolution, package, } => { - source_files.extend(package.source_files().map(Path::to_path_buf)); - merged.push(package).with_context(|| { + source_files.extend(package.source_map.source_files().map(Path::to_path_buf)); + merged.push_group(package).with_context(|| { format!( "failed to merge target dependency `{name}`", name = resolution.name() @@ -314,7 +322,7 @@ impl<'a> BindingsGenerator<'a> { } } - let package = merged.push(root).with_context(|| { + let package = merged.push_group(root).with_context(|| { format!( "failed to merge local target `{path}`", path = path.display() @@ -354,7 +362,7 @@ impl<'a> BindingsGenerator<'a> { package, resolution, } => { - for name in package.foreign_deps.keys() { + for name in package.main.foreign_deps.keys() { if !visiting.insert(name) { bail!("foreign dependency `{name}` forms a dependency cycle while parsing target dependency `{other}`", other = resolution.name()); } @@ -406,6 +414,7 @@ impl<'a> BindingsGenerator<'a> { package: Some(package), includes: Default::default(), include_names: Default::default(), + stability: Default::default(), }); resolve.packages[package].worlds.insert(name, world); @@ -444,7 +453,13 @@ impl<'a> BindingsGenerator<'a> { ty = resolve.types[ty].name.as_deref().unwrap_or("") ); - used.insert(WorldKey::Interface(id), WorldItem::Interface(id)); + used.insert( + WorldKey::Interface(id), + WorldItem::Interface { + id: id, + stability: Default::default(), + }, + ); } } } @@ -457,7 +472,7 @@ impl<'a> BindingsGenerator<'a> { log::debug!("importing function `{name}`", name = f.name); functions.insert(key.clone().unwrap_name(), f.clone()); } - WorldItem::Interface(id) => { + WorldItem::Interface { id, stability: _ } => { let name = match key { WorldKey::Name(name) => name.clone(), WorldKey::Interface(id) => { @@ -495,7 +510,10 @@ impl<'a> BindingsGenerator<'a> { used.insert( WorldKey::Interface(other), - WorldItem::Interface(other), + WorldItem::Interface { + id: other, + stability: Default::default(), + }, ); } } @@ -526,6 +544,7 @@ impl<'a> BindingsGenerator<'a> { functions: Default::default(), docs: Default::default(), package, + stability: Default::default(), }); let import_name = @@ -534,7 +553,13 @@ impl<'a> BindingsGenerator<'a> { if resolve.worlds[target_id] .imports - .insert(WorldKey::Interface(name_id), WorldItem::Interface(id)) + .insert( + WorldKey::Interface(name_id), + WorldItem::Interface { + id: id, + stability: Default::default(), + }, + ) .is_some() { let iface = &resolve.interfaces[id]; @@ -564,6 +589,7 @@ impl<'a> BindingsGenerator<'a> { types: Default::default(), functions, package: source.package, + stability: Default::default(), }); // Add any types owned by the world to the interface @@ -580,7 +606,10 @@ impl<'a> BindingsGenerator<'a> { .imports .insert( WorldKey::Name(name.clone()), - WorldItem::Interface(interface), + WorldItem::Interface { + id: interface, + stability: Default::default(), + }, ) .is_some() { diff --git a/src/generator.rs b/src/generator.rs index 61088688..140472ef 100644 --- a/src/generator.rs +++ b/src/generator.rs @@ -446,7 +446,7 @@ impl<'a> UnimplementedFunction<'a> { .exports .values() .any(|world_item| match world_item { - WorldItem::Interface(id) => *id == interface_id, + WorldItem::Interface { id, stability: _ } => *id == interface_id, _ => false, }) } @@ -460,7 +460,7 @@ impl<'a> UnimplementedFunction<'a> { .exports .values() .any(|world_item| match world_item { - WorldItem::Interface(id) => *id == interface_id, + WorldItem::Interface { id, stability: _ } => *id == interface_id, _ => false, }) } @@ -684,7 +684,10 @@ impl<'a> ImplementationGenerator<'a> { WorldItem::Function(f) => { functions.push(f); } - WorldItem::Interface(iface) => { + WorldItem::Interface { + id: iface, + stability: _, + } => { let interface = &resolve.interfaces[*iface]; interfaces.push(InterfaceGenerator::new( resolve, key, interface, names, world, diff --git a/tests/support/mod.rs b/tests/support/mod.rs index f645e4af..1c2bbdaa 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -25,7 +25,7 @@ use warg_protocol::{operator::NamespaceState, registry::PackageName}; use warg_server::{policy::content::WasmContentPolicy, Config, Server}; use wasm_pkg_client::Registry; use wasmparser::{Chunk, Encoding, Parser, Payload, Validator}; -use wit_parser::{Resolve, UnresolvedPackage}; +use wit_parser::{Resolve, UnresolvedPackageGroup}; const WARG_CONFIG_NAME: &str = "warg-config.json"; const WASM_PKG_CONFIG_NAME: &str = "wasm-pkg-config.json"; @@ -128,8 +128,8 @@ pub async fn publish_wit( ) -> Result<()> { let mut resolve = Resolve::new(); let pkg = resolve - .push( - UnresolvedPackage::parse(Path::new("foo.wit"), wit) + .push_group( + UnresolvedPackageGroup::parse(Path::new("foo.wit"), wit) .context("failed to parse wit for publishing")?, ) .context("failed to resolve wit for publishing")?;