-
Notifications
You must be signed in to change notification settings - Fork 824
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #5089 from wasmerio/run-433-cli-allow-synthesizing…
…-a-wasmertoml-in-wasmer-package-unpack feat(cli): Restore packages from webcs
- Loading branch information
Showing
15 changed files
with
488 additions
and
16 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
[package] | ||
name = "wasmer-package" | ||
version = "0.1.0" | ||
|
||
authors.workspace = true | ||
edition.workspace = true | ||
homepage.workspace = true | ||
license.workspace = true | ||
repository.workspace = true | ||
rust-version.workspace = true | ||
|
||
# See more keys and their definitions at https://doc.rust-lang.org/cargo/reference/manifest.html | ||
|
||
[dependencies] | ||
webc.workspace = true | ||
wasmer-config = { version = "0.8.0", path = "../config" } | ||
toml = "0.8.0" | ||
|
||
[dev-dependencies] | ||
pretty_assertions.workspace = true | ||
tempfile = "3.12.0" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,47 @@ | ||
use std::sync::Arc; | ||
|
||
#[derive(Clone, Debug)] | ||
pub struct ConversionError { | ||
message: String, | ||
cause: Option<Arc<dyn std::error::Error + Send + Sync>>, | ||
} | ||
|
||
impl ConversionError { | ||
pub fn msg(msg: impl Into<String>) -> Self { | ||
Self { | ||
message: msg.into(), | ||
cause: None, | ||
} | ||
} | ||
|
||
pub fn with_cause( | ||
msg: impl Into<String>, | ||
cause: impl std::error::Error + Send + Sync + 'static, | ||
) -> Self { | ||
Self { | ||
message: msg.into(), | ||
cause: Some(Arc::new(cause)), | ||
} | ||
} | ||
} | ||
|
||
impl std::fmt::Display for ConversionError { | ||
fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { | ||
write!(f, "could not convert manifest: {}", self.message)?; | ||
if let Some(cause) = &self.cause { | ||
write!(f, " (cause: {})", cause)?; | ||
} | ||
|
||
Ok(()) | ||
} | ||
} | ||
|
||
impl std::error::Error for ConversionError { | ||
fn source(&self) -> Option<&(dyn std::error::Error + 'static)> { | ||
if let Some(e) = &self.cause { | ||
Some(e) | ||
} else { | ||
None | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
mod error; | ||
mod webc_to_package; | ||
|
||
pub use self::{error::ConversionError, webc_to_package::webc_to_package_dir}; |
Oops, something went wrong.