Skip to content

Commit

Permalink
refactor(wasmer/cache): sys, js compilable features
Browse files Browse the repository at this point in the history
  • Loading branch information
kwonoj committed Mar 17, 2022
1 parent 5f2e3fc commit 4528527
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 2 deletions.
6 changes: 4 additions & 2 deletions lib/cache/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ readme = "README.md"
edition = "2018"

[dependencies]
wasmer = { path = "../api", version = "=2.2.1", default-features = false }
wasmer = { path = "../api", version = "=2.2.1", default-features = false}
hex = "0.4"
thiserror = "1"
blake3 = "1.0"
Expand All @@ -25,7 +25,9 @@ wasmer-engine-universal = { path = "../engine-universal", version = "=2.2.1" }
wasmer-engine-dylib = { path = "../engine-dylib", version = "=2.2.1" }

[features]
default = ["wasmer/sys"]
default = ["sys"]
sys = ["wasmer/sys-default"]
js = ["wasmer/js-default", "wasmer/js-serializable-module"]
blake3-pure = ["blake3/pure"]

[[bench]]
Expand Down
3 changes: 3 additions & 0 deletions lib/cache/src/filesystem.rs
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
#![cfg_attr(not(feature = "sys"), allow(unused))]
use crate::cache::Cache;
use crate::hash::Hash;
use std::fs::{create_dir_all, File};
Expand Down Expand Up @@ -35,6 +36,7 @@ pub struct FileSystemCache {
ext: Option<String>,
}

#[cfg(feature = "sys")]
impl FileSystemCache {
/// Construct a new `FileSystemCache` around the specified directory.
pub fn new<P: Into<PathBuf>>(path: P) -> io::Result<Self> {
Expand Down Expand Up @@ -84,6 +86,7 @@ impl FileSystemCache {
}
}

#[cfg(feature = "sys")]
impl Cache for FileSystemCache {
type DeserializeError = DeserializeError;
type SerializeError = SerializeError;
Expand Down
1 change: 1 addition & 0 deletions lib/cache/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@ mod filesystem;
mod hash;

pub use crate::cache::Cache;
#[cfg(feature = "sys")]
pub use crate::filesystem::FileSystemCache;
pub use crate::hash::Hash;

Expand Down

0 comments on commit 4528527

Please sign in to comment.