Skip to content

Commit 096e5b2

Browse files
authored
Drop shellexpand from dependency tree (#10603)
* Drop `shellexpand` from dependency tree This is a historical dependency of `wiggle` which can be worked around in a different manner by making paths relative to `CARGO_MANIFEST_DIR` by default. * Fix some more wiggle tests * One more wiggle test * Yet one more wiggle test
1 parent 39f49fe commit 096e5b2

26 files changed

Lines changed: 27 additions & 54 deletions

Cargo.lock

Lines changed: 0 additions & 20 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

crates/wasi-common/src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ macro_rules! define_wasi {
130130
wiggle::wasmtime_integration!({
131131
// The wiggle code to integrate with lives here:
132132
target: crate::snapshots::preview_1,
133-
witx: ["$CARGO_MANIFEST_DIR/witx/preview1/wasi_snapshot_preview1.witx"],
133+
witx: ["witx/preview1/wasi_snapshot_preview1.witx"],
134134
errors: { errno => trappable Error },
135135
$async_mode: *
136136
});
@@ -139,7 +139,7 @@ macro_rules! define_wasi {
139139
wiggle::wasmtime_integration!({
140140
// The wiggle code to integrate with lives here:
141141
target: crate::snapshots::preview_0,
142-
witx: ["$CARGO_MANIFEST_DIR/witx/preview0/wasi_unstable.witx"],
142+
witx: ["witx/preview0/wasi_unstable.witx"],
143143
errors: { errno => trappable Error },
144144
$async_mode: *
145145
});

crates/wasi-common/src/snapshots/preview_0.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ use std::collections::HashSet;
1111
use wiggle::{GuestMemory, GuestPtr};
1212

1313
wiggle::from_witx!({
14-
witx: ["$CARGO_MANIFEST_DIR/witx/preview0/wasi_unstable.witx"],
14+
witx: ["witx/preview0/wasi_unstable.witx"],
1515
errors: { errno => trappable Error },
1616
async: *,
1717
wasmtime: false,

crates/wasi-common/src/snapshots/preview_1.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ use error::{Error, ErrorExt};
2626
pub(crate) const MAX_SHARED_BUFFER_SIZE: usize = 1 << 16;
2727

2828
wiggle::from_witx!({
29-
witx: ["$CARGO_MANIFEST_DIR/witx/preview1/wasi_snapshot_preview1.witx"],
29+
witx: ["witx/preview1/wasi_snapshot_preview1.witx"],
3030
errors: { errno => trappable Error },
3131
// Note: not every function actually needs to be async, however, nearly all of them do, and
3232
// keeping that set the same in this macro and the wasmtime_wiggle / lucet_wiggle macros is

crates/wasi-nn/build.rs

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,8 @@
11
//! This build script:
22
//! - has the configuration necessary for the Wiggle and WITX macros.
33
fn main() {
4-
// This is necessary for Wiggle/WITX macros.
54
let cwd = std::env::current_dir().unwrap();
65
let wasi_root = cwd.join("witx");
7-
println!("cargo:rustc-env=WASI_ROOT={}", wasi_root.display());
86

97
// Also automatically rebuild if the WITX files change
108
for entry in walkdir::WalkDir::new(wasi_root) {

crates/wasi-nn/src/witx.rs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ where
9494
mod generated {
9595
use super::*;
9696
wiggle::from_witx!({
97-
witx: ["$WASI_ROOT/wasi-nn.witx"],
97+
witx: ["witx/wasi-nn.witx"],
9898
errors: { nn_errno => WasiNnError }
9999
});
100100

crates/wasi/src/preview0.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ pub fn add_to_linker_sync<T: Send>(
2424
}
2525

2626
wiggle::from_witx!({
27-
witx: ["$CARGO_MANIFEST_DIR/witx/preview0/wasi_unstable.witx"],
27+
witx: ["witx/preview0/wasi_unstable.witx"],
2828
async: {
2929
wasi_unstable::{
3030
fd_advise, fd_close, fd_datasync, fd_fdstat_get, fd_filestat_get, fd_filestat_set_size,
@@ -42,7 +42,7 @@ mod sync {
4242
use std::future::Future;
4343

4444
wiggle::wasmtime_integration!({
45-
witx: ["$CARGO_MANIFEST_DIR/witx/preview0/wasi_unstable.witx"],
45+
witx: ["witx/preview0/wasi_unstable.witx"],
4646
target: super,
4747
block_on[in_tokio]: {
4848
wasi_unstable::{

crates/wasi/src/preview1.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -825,7 +825,7 @@ pub fn add_to_linker_sync<T: Send>(
825825
// None of the generated modules, traits, or types should be used externally
826826
// to this module.
827827
wiggle::from_witx!({
828-
witx: ["$CARGO_MANIFEST_DIR/witx/preview1/wasi_snapshot_preview1.witx"],
828+
witx: ["witx/preview1/wasi_snapshot_preview1.witx"],
829829
async: {
830830
wasi_snapshot_preview1::{
831831
fd_advise, fd_close, fd_datasync, fd_fdstat_get, fd_filestat_get, fd_filestat_set_size,
@@ -843,7 +843,7 @@ pub(crate) mod sync {
843843
use std::future::Future;
844844

845845
wiggle::wasmtime_integration!({
846-
witx: ["$CARGO_MANIFEST_DIR/witx/preview1/wasi_snapshot_preview1.witx"],
846+
witx: ["witx/preview1/wasi_snapshot_preview1.witx"],
847847
target: super,
848848
block_on[in_tokio]: {
849849
wasi_snapshot_preview1::{

crates/wiggle/generate/Cargo.toml

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,3 @@ proc-macro2 = { workspace = true }
2222
heck = { workspace = true }
2323
anyhow = { workspace = true }
2424
syn = { workspace = true, features = ["full"] }
25-
shellexpand = "2.0"

crates/wiggle/generate/src/config.rs

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -252,11 +252,7 @@ impl Parse for Paths {
252252
let expanded_paths = path_lits
253253
.iter()
254254
.map(|lit| {
255-
PathBuf::from(
256-
shellexpand::env(&lit.value())
257-
.expect("shell expansion")
258-
.as_ref(),
259-
)
255+
PathBuf::from(std::env::var("CARGO_MANIFEST_DIR").unwrap()).join(lit.value())
260256
})
261257
.collect::<Vec<PathBuf>>();
262258

0 commit comments

Comments
 (0)