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

Remove wat dependency from wit-component #825

Merged
merged 1 commit into from Nov 17, 2022
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.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 1 addition & 2 deletions crates/wit-component/Cargo.toml
Expand Up @@ -7,7 +7,6 @@ edition.workspace = true
[dependencies]
wasmparser = { workspace = true }
wasm-encoder = { workspace = true }
wat = { workspace = true }
wit-parser = { workspace = true }
anyhow = { workspace = true }
log = "0.4.17"
Expand All @@ -19,4 +18,4 @@ wasmprinter = { workspace = true }
glob = "0.3.0"
pretty_assertions = "1.3.0"
env_logger = { workspace = true }
#test-helpers = { path = '../test-helpers', default-features = false }
wat = { workspace = true }
17 changes: 0 additions & 17 deletions crates/wit-component/src/encoding.rs
Expand Up @@ -64,7 +64,6 @@ use anyhow::{anyhow, bail, Context, Result};
use indexmap::{map::Entry, IndexMap, IndexSet};
use std::hash::{Hash, Hasher};
use std::mem;
use std::path::Path;
use wasm_encoder::*;
use wasmparser::{FuncType, Validator, WasmFeatures};
use wit_parser::{
Expand Down Expand Up @@ -2200,22 +2199,6 @@ impl ComponentEncoder {
Ok(self)
}

/// This is a convenience method for [`ComponentEncoder::adapter`] for
/// inferring everything from just one `path` specified.
///
/// The wasm binary at `path` is read and parsed and is assumed to have
/// embedded information about its imported interfaces. Additionally the
/// name of the adapter is inferred from the file name itself as the file
/// stem.
pub fn adapter_file(self, path: &Path) -> Result<Self> {
let name = path
.file_stem()
.and_then(|s| s.to_str())
.ok_or_else(|| anyhow!("input filename was not valid utf-8"))?;
let wasm = wat::parse_file(path)?;
self.adapter(name, &wasm)
}

/// Indicates whether this encoder is only encoding types and does not
/// require a `module` as input.
pub fn types_only(mut self, only: bool) -> Self {
Expand Down