diff --git a/Cargo.lock b/Cargo.lock index c0f3b733..f817a221 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -55,9 +55,9 @@ dependencies = [ [[package]] name = "anstream" -version = "0.6.5" +version = "0.6.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d664a92ecae85fd0a7392615844904654d1d5f5514837f471ddef4a057aba1b6" +checksum = "4cd2405b3ac1faab2990b74d728624cd9fd115651fcecc7c2d8daf01376275ba" dependencies = [ "anstyle", "anstyle-parse", @@ -103,15 +103,15 @@ dependencies = [ [[package]] name = "anyhow" -version = "1.0.76" +version = "1.0.79" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "59d2a3357dde987206219e78ecfbbb6e8dad06cbb65292758d3270e6254f7355" +checksum = "080e9890a082662b09c1ad45f567faeeb47f22b5fb23895fbe1e651e718e25ca" [[package]] name = "assert_cmd" -version = "2.0.12" +version = "2.0.13" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "88903cb14723e4d4003335bb7f8a14f27691649105346a0f0957466c096adfe6" +checksum = "00ad3f3a942eee60335ab4342358c161ee296829e0d16ff42fc1d6cb07815467" dependencies = [ "anstyle", "bstr", @@ -139,7 +139,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "1ca33f4bc4ed1babef42cad36cc1f51fa88be00420404e5b1e80ab1b18f7678c" dependencies = [ "concurrent-queue", - "event-listener 4.0.0", + "event-listener 4.0.3", "event-listener-strategy", "futures-core", "pin-project-lite", @@ -151,11 +151,11 @@ version = "1.8.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "17ae5ebefcc48e7452b4987947920dac9450be1110cadf34d1b8c116bdbaf97c" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.3.0", "async-task", "concurrent-queue", "fastrand 2.0.1", - "futures-lite 2.1.0", + "futures-lite 2.2.0", "slab", ] @@ -193,15 +193,15 @@ dependencies = [ [[package]] name = "async-io" -version = "2.2.1" +version = "2.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d6d3b15875ba253d1110c740755e246537483f152fa334f91abd7fe84c88b3ff" +checksum = "6afaa937395a620e33dc6a742c593c01aced20aa376ffb0f628121198578ccc7" dependencies = [ - "async-lock 3.2.0", + "async-lock 3.3.0", "cfg-if", "concurrent-queue", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.2.0", "parking", "polling 3.3.1", "rustix 0.38.28", @@ -221,11 +221,11 @@ dependencies = [ [[package]] name = "async-lock" -version = "3.2.0" +version = "3.3.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7125e42787d53db9dd54261812ef17e937c95a51e4d291373b670342fa44310c" +checksum = "d034b430882f8381900d3fe6f0aaa3ad94f2cb4ac519b429692a1bc2dda4ae7b" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.3", "event-listener-strategy", "pin-project-lite", ] @@ -255,7 +255,7 @@ checksum = "5fd55a5ba1179988837d24ab4c7cc8ed6efdeff578ede0416b4225a5fca35bd0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -264,7 +264,7 @@ version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "9e47d90f65a225c4527103a8d747001fc56e375203592b25ad103e1ca13124c5" dependencies = [ - "async-io 2.2.1", + "async-io 2.2.2", "async-lock 2.8.0", "atomic-waker", "cfg-if", @@ -278,19 +278,19 @@ dependencies = [ [[package]] name = "async-task" -version = "4.5.0" +version = "4.7.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b4eb2cdb97421e01129ccb49169d8279ed21e829929144f4a22a6e54ac549ca1" +checksum = "fbb36e985947064623dbd357f727af08ffd077f93d696782f3c56365fa2e2799" [[package]] name = "async-trait" -version = "0.1.75" +version = "0.1.77" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fdf6721fb0140e4f897002dd086c06f6c27775df19cfe1fccb21181a48fd2c98" +checksum = "c980ee35e870bd1a4d2c8294d4c04d0499e67bca1e4b5cefcc693c2fa00caea9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -365,7 +365,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -397,9 +397,9 @@ checksum = "9e1b586273c5702936fe7b7d6896644d8be71e6314cfe09d3167c95f712589e8" [[package]] name = "base64" -version = "0.21.5" +version = "0.21.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "35636a1494ede3b646cc98f74f8e62c773a38a659ebc777a2cf26b9b74171df9" +checksum = "9d297deb1925b89f2ccc13d7635fa0714f12c87adce1c75356b39ca9b7178567" [[package]] name = "base64ct" @@ -457,20 +457,20 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "6a37913e8dc4ddcc604f0c6d3bf2887c995153af3611de9e23c352b44c1b9118" dependencies = [ "async-channel", - "async-lock 3.2.0", + "async-lock 3.3.0", "async-task", "fastrand 2.0.1", "futures-io", - "futures-lite 2.1.0", + "futures-lite 2.2.0", "piper", "tracing", ] [[package]] name = "bstr" -version = "1.8.0" +version = "1.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "542f33a8835a0884b006a0c3df3dadd99c0c3f296ed26c2fdc8028e01ad6230c" +checksum = "c48f0051a4b4c5e0b6d365cd04af53aeaa209e3cc15ec2cdb69e73cc87fbd0dc" dependencies = [ "memchr", "regex-automata", @@ -529,6 +529,7 @@ dependencies = [ "semver", "serde", "serde_json", + "tempfile", "tokio", "tokio-util", "toml_edit 0.21.0", @@ -538,12 +539,12 @@ dependencies = [ "warg-protocol", "warg-server", "wasm-metadata", - "wasmparser 0.118.1", + "wasmparser 0.119.0", "wat", "which 5.0.0", "wit-bindgen-core", "wit-bindgen-rust", - "wit-component 0.19.0", + "wit-component 0.19.1", "wit-parser", ] @@ -577,7 +578,7 @@ dependencies = [ "warg-crypto", "warg-protocol", "windows-sys 0.52.0", - "wit-component 0.19.0", + "wit-component 0.19.1", "wit-parser", ] @@ -587,7 +588,7 @@ version = "0.6.0" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -604,9 +605,9 @@ dependencies = [ [[package]] name = "cargo-platform" -version = "0.1.5" +version = "0.1.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e34637b3140142bdf929fb439e8aa4ebad7651ebf7b1080b3930aa16ac1459ff" +checksum = "ceed8ef69d8518a5dda55c07425450b58a4e1946f4951eab6d7191ee86c2443d" dependencies = [ "serde", ] @@ -664,9 +665,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.11" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bfaff671f6b22ca62406885ece523383b9b64022e341e53e009a62ebc47a45f2" +checksum = "58e54881c004cec7895b0068a0a954cd5d62da01aef83fa35b1e594497bf5445" dependencies = [ "clap_builder", "clap_derive", @@ -674,9 +675,9 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.11" +version = "4.4.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a216b506622bb1d316cd51328dce24e07bdff4a6128a47c7e7fad11878d5adbb" +checksum = "59cb82d7f531603d2fd1f507441cdd35184fa81beff7bd489570de7f773460bb" dependencies = [ "anstream", "anstyle", @@ -693,7 +694,7 @@ dependencies = [ "heck", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -719,9 +720,9 @@ dependencies = [ [[package]] name = "const-oid" -version = "0.9.5" +version = "0.9.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "28c122c3980598d243d63d9a704629a2d748d101f278052ff068be5a4423ab6f" +checksum = "c2459377285ad874054d797f3ccebf984978aa39129f6eafde5cdc8315b612f8" [[package]] name = "core-foundation" @@ -741,21 +742,18 @@ checksum = "06ea2b9bc92be3c2baa9334a323ebca2d6f074ff852cd1d7b11064035cd3868f" [[package]] name = "cpufeatures" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce420fe07aecd3e67c5f910618fe65e94158f6dcc0adf44e00d69ce2bdfe0fd0" +checksum = "53fe5e26ff1b7aef8bca9c6080520cfb8d9333c7568e1829cef191a9723e5504" dependencies = [ "libc", ] [[package]] name = "crossbeam-utils" -version = "0.8.17" +version = "0.8.19" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c06d96137f14f244c37f989d9fff8f95e6c18b918e71f36638f8c49112e4c78f" -dependencies = [ - "cfg-if", -] +checksum = "248e3bacc7dc6baa3b21e405ee045c3047101a49145e7e9eca583ab4c2ca5345" [[package]] name = "crypto-bigint" @@ -800,7 +798,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -811,7 +809,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -827,9 +825,9 @@ dependencies = [ [[package]] name = "deranged" -version = "0.3.9" +version = "0.3.11" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f32d04922c60427da6f9fef14d042d9edddef64cb9d4ce0d64d0685fbeb1fd3" +checksum = "b42b6fa04a440b495c8b04d0e71b707c585f83cb9cb28cf8cd0d976c315e31b4" dependencies = [ "powerfmt", "serde", @@ -958,7 +956,7 @@ checksum = "f95e2801cd355d4a1a3e3953ce6ee5ae9603a5c833455343a8bfe3f44d418246" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -1009,9 +1007,9 @@ dependencies = [ [[package]] name = "event-listener" -version = "4.0.0" +version = "4.0.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "770d968249b5d99410d61f5bf89057f3199a077a04d087092f58e7d10692baae" +checksum = "67b215c49b2b248c855fb73579eb1f4f26c38ffdc12973e20e07b91d78d5646e" dependencies = [ "concurrent-queue", "parking", @@ -1024,7 +1022,7 @@ version = "0.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "958e4d70b6d5e81971bebec42271ec641e7ff4e170a6fa605f2b8a8b65cb97d3" dependencies = [ - "event-listener 4.0.0", + "event-listener 4.0.3", "pin-project-lite", ] @@ -1100,9 +1098,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" +checksum = "645c6916888f6cb6350d2550b80fb63e734897a8498abe35cfb732b6487804b0" dependencies = [ "futures-channel", "futures-core", @@ -1115,9 +1113,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" +checksum = "eac8f7d7865dcb88bd4373ab671c8cf4508703796caa2b1985a9ca867b3fcb78" dependencies = [ "futures-core", "futures-sink", @@ -1125,15 +1123,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" +checksum = "dfc6580bb841c5a68e9ef15c77ccc837b40a7504914d52e47b8b0e9bbda25a1d" [[package]] name = "futures-executor" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" +checksum = "a576fc72ae164fca6b9db127eaa9a9dda0d61316034f33a0a0d4eda41f02b01d" dependencies = [ "futures-core", "futures-task", @@ -1142,9 +1140,9 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" +checksum = "a44623e20b9681a318efdd71c299b6b222ed6f231972bfe2f224ebad6311f0c1" [[package]] name = "futures-lite" @@ -1163,9 +1161,9 @@ dependencies = [ [[package]] name = "futures-lite" -version = "2.1.0" +version = "2.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeee267a1883f7ebef3700f262d2d54de95dfaf38189015a74fdc4e0c7ad8143" +checksum = "445ba825b27408685aaecefd65178908c36c6e96aaf6d8599419d46e624192ba" dependencies = [ "fastrand 2.0.1", "futures-core", @@ -1176,32 +1174,32 @@ dependencies = [ [[package]] name = "futures-macro" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" +checksum = "87750cf4b7a4c0625b1529e4c543c2182106e4dedc60a2a6455e00d212c489ac" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] name = "futures-sink" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" +checksum = "9fb8e00e87438d937621c1c6269e53f536c14d3fbd6a042bb24879e57d474fb5" [[package]] name = "futures-task" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" +checksum = "38d84fa142264698cdce1a9f9172cf383a0c82de1bddcf3092901442c4097004" [[package]] name = "futures-util" -version = "0.3.29" +version = "0.3.30" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" +checksum = "3d6401deb83407ab3da39eba7e33987a73c3df0c82b4bb5813ee871c19c41d48" dependencies = [ "futures-channel", "futures-core", @@ -1228,9 +1226,9 @@ dependencies = [ [[package]] name = "getrandom" -version = "0.2.11" +version = "0.2.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "fe9006bed769170c11f845cf00c7c1e9092aeb3f268e007c3e760ac68008070f" +checksum = "190092ea657667030ac6a35e305e62fc4dd69fd98ac98631e5d3a2b1575a12b5" dependencies = [ "cfg-if", "libc", @@ -1256,9 +1254,9 @@ dependencies = [ [[package]] name = "h2" -version = "0.3.22" +version = "0.3.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4d6250322ef6e60f93f9a2162799302cd6f68f79f6e5d85c8c16f14d1d958178" +checksum = "b553656127a00601c8ae5590fcfdc118e4083a7924b6cf4ffc1ea4b99dc429d7" dependencies = [ "bytes", "fnv", @@ -1291,7 +1289,7 @@ version = "0.3.9" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "06683b93020a07e3dbcf5f8c0f6d40080d725bea7936fc01ad345c01b97dc270" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "headers-core", "http", @@ -1332,9 +1330,9 @@ checksum = "7f24254aa9a54b5c858eaee2f5bccdb46aaf0e486a595ed5fd8f86ba55232a70" [[package]] name = "hkdf" -version = "0.12.3" +version = "0.12.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "791a029f6b9fc27657f6f188ec6e5e43f6911f6f878e0dc5501396e09809d437" +checksum = "7b5f8eb2ad728638ea2c7d47a21db23b7b58a72ed6a38256b8a1849f15fbbdf7" dependencies = [ "hmac", ] @@ -1350,11 +1348,11 @@ dependencies = [ [[package]] name = "home" -version = "0.5.5" +version = "0.5.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5444c27eef6923071f7ebcc33e3444508466a76f7a2b93da00ed6e19f30c1ddb" +checksum = "e3d1354bf6b7235cb4a0576c2619fd4ed18183f689b12b006a0ee7329eeff9a5" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1370,9 +1368,9 @@ dependencies = [ [[package]] name = "http-body" -version = "0.4.5" +version = "0.4.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d5f38f16d184e36f2408a55281cd658ecbd3ca05cce6d6510a176eca393e26d1" +checksum = "7ceab25649e9960c0311ea418d17bee82c0dcec1bd053b5f9a66e265a693bed2" dependencies = [ "bytes", "http", @@ -1405,9 +1403,9 @@ checksum = "9a3a5bfb195931eeb336b2a7b4d761daec841b97f947d34394601737a7bba5e4" [[package]] name = "hyper" -version = "0.14.27" +version = "0.14.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ffb1cfd654a8219eaef89881fdb3bb3b1cdc5fa75ded05d6933b2b382e395468" +checksum = "bf96e135eb83a2a8ddf766e426a841d8ddd7449d5f00d34ea02b41d2f19eef80" dependencies = [ "bytes", "futures-channel", @@ -1420,7 +1418,7 @@ dependencies = [ "httpdate", "itoa", "pin-project-lite", - "socket2 0.4.10", + "socket2 0.5.5", "tokio", "tower-service", "tracing", @@ -1442,9 +1440,9 @@ dependencies = [ [[package]] name = "iana-time-zone" -version = "0.1.58" +version = "0.1.59" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8326b86b6cff230b97d0d312a6c40a60726df3332e721f72a1b035f451663b20" +checksum = "b6a67363e2aa4443928ce15e57ebae94fd8949958fd1223c4cfc0cd473ad7539" dependencies = [ "android_system_properties", "core-foundation-sys", @@ -1535,13 +1533,13 @@ checksum = "8f518f335dce6725a761382244631d86cf0ccb2863413590b31338feb467f9c3" [[package]] name = "is-terminal" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "cb0889898416213fab133e1d33a0e5858a48177452750691bde3666d0fdbaf8b" +checksum = "0bad00257d07be169d870ab665980b06cdb366d792ad690bf2e76876dc503455" dependencies = [ "hermit-abi", "rustix 0.38.28", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -1570,25 +1568,25 @@ checksum = "b1a46d1a171d865aa5f83f92695765caa047a9b4cbae2cbf37dbd613a793fd4c" [[package]] name = "js-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "54c0c35952f67de54bb584e9fd912b3023117cbafc0a77d8f3dee1fb5f572fe8" +checksum = "cee9c64da59eae3b50095c18d3e74f8b73c0b86d2792824ff01bbce68ba229ca" dependencies = [ "wasm-bindgen", ] [[package]] name = "keyring" -version = "2.1.0" +version = "2.3.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ec6488afbd1d8202dbd6e2dd38c0753d8c0adba9ac9985fc6f732a0d551f75e1" +checksum = "85b479dcf9eae65481044dfda57af7fe2da6c1401180360f6898801fe9ed4db9" dependencies = [ "byteorder", "lazy_static", "linux-keyutils", "secret-service", "security-framework", - "winapi", + "windows-sys 0.52.0", ] [[package]] @@ -1605,9 +1603,9 @@ checksum = "884e2677b40cc8c339eaefcb701c32ef1fd2493d71118dc0ca4b6a736c93bd67" [[package]] name = "libc" -version = "0.2.151" +version = "0.2.152" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "302d7ab3130588088d277783b1e2d2e10c9e9e4a16dd9050e6ec93fb3e7048f4" +checksum = "13e3bf6590cbc649f4d1a3eefc9d5d6eb746f5200ffb04e5e142700b8faa56e7" [[package]] name = "libredox" @@ -1678,7 +1676,7 @@ dependencies = [ "proc-macro2", "quote", "regex-syntax 0.6.29", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -1698,9 +1696,9 @@ checksum = "0e7465ac9959cc2b1404e8e2367b43684a6d13790fe23056cc8c6c5a6b7bcb94" [[package]] name = "memchr" -version = "2.6.4" +version = "2.7.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f665ee40bc4a3c5590afb1e9677db74a508659dfd71e126420da8274909a0167" +checksum = "523dc4f511e55ab87b694dc30d0f820d60906ef06413f93d4d7a1385599cc149" [[package]] name = "memoffset" @@ -1711,6 +1709,15 @@ dependencies = [ "autocfg", ] +[[package]] +name = "memoffset" +version = "0.9.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "5a634b1c61a95585bd15607c6ab0c4e5b226e695ff2800ba0cdccddf208c406c" +dependencies = [ + "autocfg", +] + [[package]] name = "miette" version = "5.10.0" @@ -1731,7 +1738,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -1803,7 +1810,7 @@ dependencies = [ "bitflags 1.3.2", "cfg-if", "libc", - "memoffset", + "memoffset 0.7.1", ] [[package]] @@ -1919,9 +1926,9 @@ dependencies = [ [[package]] name = "object" -version = "0.32.1" +version = "0.32.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9cf5f9dd3933bd50a9e1f149ec995f39ae2c496d31fd772c1fd45ebc27e902b0" +checksum = "a6a622008b6e321afc04970976f62ee297fdbaa6f95318ca343e3eebb9648441" dependencies = [ "memchr", ] @@ -1940,9 +1947,9 @@ checksum = "624a8340c38c1b80fd549087862da4ba43e08858af025b236e509b6649fc13d5" [[package]] name = "openssl" -version = "0.10.59" +version = "0.10.62" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7a257ad03cd8fb16ad4172fedf8094451e1af1c4b70097636ef2eac9a5f0cc33" +checksum = "8cde4d2d9200ad5909f8dac647e29482e07c3a35de8a13fce7c9c7747ad9f671" dependencies = [ "bitflags 2.4.1", "cfg-if", @@ -1961,7 +1968,7 @@ checksum = "a948666b637a0f465e8564c73e89d4dde00d72d4d473cc972f390fc3dcee7d9c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -1972,9 +1979,9 @@ checksum = "ff011a302c396a5197692431fc1948019154afc178baf7d8e37367442a4601cf" [[package]] name = "openssl-sys" -version = "0.9.95" +version = "0.9.98" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "40a4130519a360279579c2053038317e40eff64d13fd3f004f9e1b72b8a6aaf9" +checksum = "c1665caf8ab2dc9aef43d1c0023bd904633a6a05cb30b0ad59bec2ae986e57a7" dependencies = [ "cc", "libc", @@ -2142,7 +2149,7 @@ checksum = "4359fd9c9171ec6e8c62926d6faaf553a8dc3f64e1507e76da7911b4f6a04405" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -2180,9 +2187,9 @@ dependencies = [ [[package]] name = "pkg-config" -version = "0.3.27" +version = "0.3.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26072860ba924cbfa98ea39c8c19b4dd6a4a25423dbdf219c1eca91aa0cf6964" +checksum = "69d3587f8a9e599cc7ec2c00e331f71c4e69a5f9a4b8a6efd5b07466b9736f9a" [[package]] name = "polling" @@ -2298,9 +2305,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.71" +version = "1.0.76" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "75cb1540fadbd5b8fbccc4dddad2734eba435053f725621c070711a14bb5f4b8" +checksum = "95fc56cda0b5c3325f5fbbd7ff9fda9e02bb00bb3dac51252d2f1bfa1cb8cc8c" dependencies = [ "unicode-ident", ] @@ -2401,9 +2408,9 @@ dependencies = [ [[package]] name = "quote" -version = "1.0.33" +version = "1.0.35" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5267fca4496028628a95160fc423a33e8b2e6af8a5302579e322e4b520293cae" +checksum = "291ec9ab5efd934aaf503a6466c5d5251535d108ee747472c3977cc5acc868ef" dependencies = [ "proc-macro2", ] @@ -2495,11 +2502,11 @@ checksum = "c08c74e62047bb2de4ff487b251e4a92e24f48745648451635cec7d591162d9f" [[package]] name = "reqwest" -version = "0.11.22" +version = "0.11.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "046cd98826c46c2ac8ddecae268eb5c2e58628688a5fc7a2643704a73faba95b" +checksum = "37b1ae8d9ac08420c66222fb9096fc5de435c3c48542bc5336c51892cffafb41" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "bytes", "encoding_rs", "futures-core", @@ -2620,11 +2627,11 @@ dependencies = [ [[package]] name = "schannel" -version = "0.1.22" +version = "0.1.23" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0c3733bf4cf7ea0880754e19cb5a462007c4a8c1914bff372ccc95b464f1df88" +checksum = "fbc91545643bcf3a0bbb6569265615222618bdf33ce4ffbbd13c4bbd4c093534" dependencies = [ - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] @@ -2700,38 +2707,38 @@ dependencies = [ [[package]] name = "semver" -version = "1.0.20" +version = "1.0.21" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "836fa6a3e1e547f9a2c4040802ec865b5d85f4014efe00555d7090a3dcaa1090" +checksum = "b97ed7a9823b74f99c7742f5336af7be5ecd3eeafcb1507d1fa93347b1d589b0" dependencies = [ "serde", ] [[package]] name = "serde" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "25dd9975e68d0cb5aa1120c288333fc98731bd1dd12f561e468ea4728c042b89" +checksum = "63261df402c67811e9ac6def069e4786148c4563f4b50fd4bf30aa370d626b02" dependencies = [ "serde_derive", ] [[package]] name = "serde_derive" -version = "1.0.193" +version = "1.0.195" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "43576ca501357b9b071ac53cdc7da8ef0cbd9493d8df094cd821777ea6e894d3" +checksum = "46fe8f8603d81ba86327b23a2e9cdf49e1255fb94a4c5f297f6ee0547178ea2c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] name = "serde_json" -version = "1.0.108" +version = "1.0.111" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3d1c7e3eac408d115102c4c24ad393e0821bb3a5df4d506a80f85f7a742a526b" +checksum = "176e46fa42316f18edd598015a5166857fc835ec732f5215eac6b7bdbf0a84f4" dependencies = [ "itoa", "ryu", @@ -2740,9 +2747,9 @@ dependencies = [ [[package]] name = "serde_path_to_error" -version = "0.1.14" +version = "0.1.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4beec8bce849d58d06238cb50db2e1c417cfeafa4c63f692b15c82b7c80f8335" +checksum = "ebd154a240de39fdebcf5775d2675c204d7c13cf39a4c697be6493c8e734337c" dependencies = [ "itoa", "serde", @@ -2750,20 +2757,20 @@ dependencies = [ [[package]] name = "serde_repr" -version = "0.1.17" +version = "0.1.18" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3081f5ffbb02284dda55132aa26daecedd7372a42417bbbab6f14ab7d6bb9145" +checksum = "0b2e6b945e9d3df726b65d6ee24060aff8e3533d431f677a9695db04eff9dfdb" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] name = "serde_spanned" -version = "0.6.4" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" +checksum = "eb3622f419d1296904700073ea6cc23ad690adbd66f13ea683df73298736f0c1" dependencies = [ "serde", ] @@ -2786,7 +2793,7 @@ version = "3.4.0" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "64cd236ccc1b7a29e7e2739f27c0b2dd199804abc4290e32f59f3b68d6405c23" dependencies = [ - "base64 0.21.5", + "base64 0.21.7", "chrono", "hex", "indexmap 1.9.3", @@ -2806,7 +2813,7 @@ dependencies = [ "darling", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -2896,18 +2903,18 @@ dependencies = [ [[package]] name = "spdx" -version = "0.10.2" +version = "0.10.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b19b32ed6d899ab23174302ff105c1577e45a06b08d4fe0a9dd13ce804bbbf71" +checksum = "62bde1398b09b9f93fc2fc9b9da86e362693e999d3a54a8ac47a99a5a73f638b" dependencies = [ "smallvec", ] [[package]] name = "spki" -version = "0.7.2" +version = "0.7.3" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9d1e996ef02c474957d681f1b05213dfb0abab947b446a62d37770b23500184a" +checksum = "d91ed6c858b01f942cd56b37a94b3e0a1798290327d1236e4d9cf4eaca44d29d" dependencies = [ "base64ct", "der", @@ -2944,9 +2951,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.42" +version = "2.0.48" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5b7d0a2c048d661a1a59fcd7355baa232f7ed34e0ee4df2eef3c1c1c0d3852d8" +checksum = "0f3531638e407dfc0814761abb7c00a5b54992b849452a0646b7f65c9f770f3f" dependencies = [ "proc-macro2", "quote", @@ -2982,22 +2989,22 @@ dependencies = [ [[package]] name = "tempfile" -version = "3.8.1" +version = "3.9.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7ef1adac450ad7f4b3c28589471ade84f25f731a7a0fe30d71dfa9f60fd808e5" +checksum = "01ce4141aa927a6d1bd34a041795abd0db1cccba5d5f24b009f694bdf3a1f3fa" dependencies = [ "cfg-if", "fastrand 2.0.1", "redox_syscall", "rustix 0.38.28", - "windows-sys 0.48.0", + "windows-sys 0.52.0", ] [[package]] name = "termcolor" -version = "1.4.0" +version = "1.4.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ff1bc3d3f05aff0403e8ac0d92ced918ec05b666a43f83297ccef5bea8a3d449" +checksum = "06794f8f6c5c898b3275aebefa6b8a1cb24cd2c6c79397ab15774837a0bc5755" dependencies = [ "winapi-util", ] @@ -3010,22 +3017,22 @@ checksum = "3369f5ac52d5eb6ab48c6b4ffdc8efbcad6b89c765749064ba298f2c68a16a76" [[package]] name = "thiserror" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f9a7210f5c9a7156bb50aa36aed4c95afb51df0df00713949448cf9e97d382d2" +checksum = "d54378c645627613241d077a3a79db965db602882668f9136ac42af9ecb730ad" dependencies = [ "thiserror-impl", ] [[package]] name = "thiserror-impl" -version = "1.0.50" +version = "1.0.56" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" +checksum = "fa0faa943b50f3db30a20aa7e265dbc66076993efed8463e8de414e5d06d3471" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -3040,9 +3047,9 @@ dependencies = [ [[package]] name = "time" -version = "0.3.30" +version = "0.3.31" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c4a34ab300f2dee6e562c10a046fc05e358b29f9bf92277f30c3c8d82275f6f5" +checksum = "f657ba42c3f86e7680e53c8cd3af8abbe56b5491790b46e22e19c0d57463583e" dependencies = [ "deranged", "itoa", @@ -3060,9 +3067,9 @@ checksum = "ef927ca75afb808a4d64dd374f00a2adf8d0fcff8e7b184af886c3c87ec4a3f3" [[package]] name = "time-macros" -version = "0.2.15" +version = "0.2.16" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4ad70d68dba9e1f8aceda7aa6711965dfec1cac869f311a51bd08b3a2ccbce20" +checksum = "26197e33420244aeb70c3e8c78376ca46571bc4e701e4791c2cd9f57dcb3a43f" dependencies = [ "time-core", ] @@ -3109,7 +3116,7 @@ checksum = "5b8a1e28f2deaa14e508979454cb3a223b10b938b45af148bc0986de36f1923b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -3256,7 +3263,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", ] [[package]] @@ -3296,9 +3303,9 @@ dependencies = [ [[package]] name = "try-lock" -version = "0.2.4" +version = "0.2.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "3528ecfd12c466c6f163363caf2d02a71161dd5e1cc6ae7b34207ea2d42d81ed" +checksum = "e421abadd41a4225275504ea4d6566923418b7f05506fbc9c0fe86ba7396114b" [[package]] name = "typenum" @@ -3308,10 +3315,11 @@ checksum = "42ff0bf0c66b8238c6f3b578df37d0b7848e55df8577b3f74f92a69acceeb825" [[package]] name = "uds_windows" -version = "1.0.2" +version = "1.1.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ce65604324d3cce9b966701489fbd0cf318cb1f7bd9dd07ac9a4ee6fb791930d" +checksum = "89daebc3e6fd160ac4aa9fc8b3bf71e1f74fbf92367ae71fb83a037e8bf164b9" dependencies = [ + "memoffset 0.9.0", "tempfile", "winapi", ] @@ -3327,9 +3335,9 @@ dependencies = [ [[package]] name = "unicode-bidi" -version = "0.3.13" +version = "0.3.14" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "92888ba5573ff080736b3648696b70cafad7d250551175acbaa4e0385b3e1460" +checksum = "6f2528f27a9eb2b21e69c95319b30bd0efd85d09c379741b0f78ea1d86be2416" [[package]] name = "unicode-ident" @@ -3489,7 +3497,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "3421fa178ce468087d2c51b53ae4ab6d435e4e41bb6fee2c2b25bd555df9f6c3" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "digest", "hex", "leb128", @@ -3529,7 +3537,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "a1e47b7e7a8a9f9895268b68e7cf29ca1d3129faa9f9bcbc973ff5e92884a014" dependencies = [ "anyhow", - "base64 0.21.5", + "base64 0.21.7", "hex", "indexmap 2.1.0", "pbjson-types", @@ -3597,9 +3605,9 @@ checksum = "9c8d87e72b64a3b4db28d11ce29237c246188f4f51057d65a7eab63b7987e423" [[package]] name = "wasm-bindgen" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7daec296f25a1bae309c0cd5c29c4b260e510e6d813c286b19eaadf409d40fce" +checksum = "0ed0d4f68a3015cc185aff4db9506a015f4b96f95303897bfa23f846db54064e" dependencies = [ "cfg-if", "wasm-bindgen-macro", @@ -3607,24 +3615,24 @@ dependencies = [ [[package]] name = "wasm-bindgen-backend" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e397f4664c0e4e428e8313a469aaa58310d302159845980fd23b0f22a847f217" +checksum = "1b56f625e64f3a1084ded111c4d5f477df9f8c92df113852fa5a374dbda78826" dependencies = [ "bumpalo", "log", "once_cell", "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-futures" -version = "0.4.38" +version = "0.4.39" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "9afec9963e3d0994cac82455b2b3502b81a7f40f9a0d32181f7528d9f4b43e02" +checksum = "ac36a15a220124ac510204aec1c3e5db8a22ab06fd6706d881dc6149f8ed9a12" dependencies = [ "cfg-if", "js-sys", @@ -3634,9 +3642,9 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5961017b3b08ad5f3fe39f1e79877f8ee7c23c5e5fd5eb80de95abc41f1f16b2" +checksum = "0162dbf37223cd2afce98f3d0785506dcb8d266223983e4b5b525859e6e182b2" dependencies = [ "quote", "wasm-bindgen-macro-support", @@ -3644,22 +3652,22 @@ dependencies = [ [[package]] name = "wasm-bindgen-macro-support" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c5353b8dab669f5e10f5bd76df26a9360c748f054f862ff5f3f8aae0c7fb3907" +checksum = "f0eb82fcb7930ae6219a7ecfd55b217f5f0893484b7a13022ebb2b2bf20b5283" dependencies = [ "proc-macro2", "quote", - "syn 2.0.42", + "syn 2.0.48", "wasm-bindgen-backend", "wasm-bindgen-shared", ] [[package]] name = "wasm-bindgen-shared" -version = "0.2.88" +version = "0.2.89" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0d046c5d029ba91a1ed14da14dca44b68bf2f124cfbaf741c54151fdb3e0750b" +checksum = "7ab9b36309365056cd639da3134bf87fa8f3d86008abf99e612384a6eecd459f" [[package]] name = "wasm-encoder" @@ -3670,11 +3678,20 @@ dependencies = [ "leb128", ] +[[package]] +name = "wasm-encoder" +version = "0.39.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "111495d6204760238512f57a9af162f45086504da332af210f2f75dd80b34f1d" +dependencies = [ + "leb128", +] + [[package]] name = "wasm-metadata" -version = "0.10.14" +version = "0.10.15" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d835d67708f6374937c550ad8dd1d17c616ae009e3f00d7a0ac9f7825e78c36a" +checksum = "818931c85b1d197909699d36c509fa89550ccfa0d66932ba3c1726faddb4d0c7" dependencies = [ "anyhow", "indexmap 2.1.0", @@ -3682,8 +3699,8 @@ dependencies = [ "serde_derive", "serde_json", "spdx", - "wasm-encoder", - "wasmparser 0.118.1", + "wasm-encoder 0.39.0", + "wasmparser 0.119.0", ] [[package]] @@ -3719,32 +3736,43 @@ dependencies = [ "semver", ] +[[package]] +name = "wasmparser" +version = "0.119.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "8c35daf77afb4f9b14016625144a391085ec2ca99ca9cc53ed291bb53ab5278d" +dependencies = [ + "bitflags 2.4.1", + "indexmap 2.1.0", + "semver", +] + [[package]] name = "wast" -version = "69.0.1" +version = "70.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c1ee37317321afde358e4d7593745942c48d6d17e0e6e943704de9bbee121e7a" +checksum = "2ee4bc54bbe1c6924160b9f75e374a1d07532e7580eb632c0ee6cdd109bb217e" dependencies = [ "leb128", "memchr", "unicode-width", - "wasm-encoder", + "wasm-encoder 0.39.0", ] [[package]] name = "wat" -version = "1.0.82" +version = "1.0.83" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "aeb338ee8dee4d4cd05e6426683f21c5087dc7cfc8903e839ccf48d43332da3c" +checksum = "9f0dce8cdc288c717cf01e461a1e451a7b8445d53451123536ba576e423a101a" dependencies = [ "wast", ] [[package]] name = "web-sys" -version = "0.3.65" +version = "0.3.66" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5db499c5f66323272151db0e666cd34f78617522fb0c1604d31a27c50c206a85" +checksum = "50c24a44ec86bb68fbecd1b3efed7e85ea5621b39b35ef2766b66cd984f8010f" dependencies = [ "js-sys", "wasm-bindgen", @@ -3808,11 +3836,11 @@ checksum = "712e227841d057c1ee1cd2fb22fa7e5a5461ae8e48fa2ca79ec42cfc1931183f" [[package]] name = "windows-core" -version = "0.51.1" +version = "0.52.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f1f8cf84f35d2db49a46868f947758c7a1138116f7fac3bc844f43ade1292e64" +checksum = "33ab640c8d7e35bf8ba19b884ba838ceb4fba93a4e8c65a9059d08afcfc683d9" dependencies = [ - "windows-targets 0.48.5", + "windows-targets 0.52.0", ] [[package]] @@ -3949,9 +3977,9 @@ checksum = "dff9641d1cd4be8d1a070daf9e3773c5f67e78b4d9d42263020c057706765c04" [[package]] name = "winnow" -version = "0.5.26" +version = "0.5.34" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "b67b5f0a4e7a27a64c651977932b9dc5667ca7fc31ac44b03ed37a0cf42fdfff" +checksum = "b7cf47b659b318dccbd69cc4797a39ae128f533dce7902a1096044d1967b9c16" dependencies = [ "memchr", ] @@ -3985,6 +4013,7 @@ dependencies = [ "rpassword", "semver", "serde", + "tempfile", "tokio", "tokio-util", "toml_edit 0.21.0", @@ -3994,8 +4023,8 @@ dependencies = [ "warg-protocol", "warg-server", "wasm-metadata", - "wasmparser 0.118.1", - "wit-component 0.19.0", + "wasmparser 0.119.0", + "wit-component 0.19.1", "wit-parser", ] @@ -4045,7 +4074,7 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.38.1", "wasm-metadata", "wasmparser 0.118.1", "wit-parser", @@ -4053,9 +4082,9 @@ dependencies = [ [[package]] name = "wit-component" -version = "0.19.0" +version = "0.19.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4b2e0cdd27c1500cb2524810e8f40b50012355a476c1bea5d12d73620125cc04" +checksum = "429e3c06fba3a7566aab724ae3ffff3152ede5399d44789e7dd11f5421292859" dependencies = [ "anyhow", "bitflags 2.4.1", @@ -4064,17 +4093,17 @@ dependencies = [ "serde", "serde_derive", "serde_json", - "wasm-encoder", + "wasm-encoder 0.39.0", "wasm-metadata", - "wasmparser 0.118.1", + "wasmparser 0.119.0", "wit-parser", ] [[package]] name = "wit-parser" -version = "0.13.0" +version = "0.13.1" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "15df6b7b28ce94b8be39d8df5cb21a08a4f3b9f33b631aedb4aa5776f785ead3" +checksum = "df4913a2219096373fd6512adead1fb77ecdaa59d7fc517972a7d30b12f625be" dependencies = [ "anyhow", "id-arena", diff --git a/Cargo.toml b/Cargo.toml index a8bc9b45..d9f0e024 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -52,15 +52,15 @@ bytes = { workspace = true } which = { workspace = true } [dev-dependencies] -assert_cmd = "2.0.12" -predicates = "3.0.4" -wasmparser = "0.118.1" -wat = "1.0.82" -warg-server = "0.2.0" +assert_cmd = { workspace = true } +predicates = { workspace = true } +wasmparser = { workspace = true } +wat = { workspace = true } +warg-server = { workspace = true } +tempfile = { workspace = true } [workspace] members = ["crates/bindings", "crates/macro", "crates/core", "crates/wit"] -exclude = ["target/tests"] [workspace.dependencies] cargo-component-core = { path = "crates/core", version = "0.6.0" } @@ -68,37 +68,43 @@ cargo-component-macro = { path = "crates/macro", version = "0.6.0" } warg-protocol = "0.2.0" warg-crypto = "0.2.0" warg-client = "0.2.0" -anyhow = "1.0.76" -clap = { version = "4.4.11", features = ["derive"] } +anyhow = "1.0.79" +clap = { version = "4.4.16", features = ["derive"] } toml_edit = { version = "0.21.0", features = ["serde"] } pretty_env_logger = "0.5.0" log = "0.4.20" tokio = { version = "1.35.1", default-features = false, features = ["macros", "rt-multi-thread"] } tokio-util = "0.7.10" heck = "0.4.1" -semver = "1.0.20" -serde = { version = "1.0.193", features = ["derive"] } -serde_json = "1.0.108" +semver = "1.0.21" +serde = { version = "1.0.195", features = ["derive"] } +serde_json = "1.0.111" indexmap = "2.1.0" url = { version = "2.5.0", features = ["serde"] } -wit-parser = "0.13.0" -wit-component = "0.19.0" -wasm-metadata = "0.10.14" +wit-parser = "0.13.1" +wit-component = "0.19.1" +wasm-metadata = "0.10.15" parse_arg = "0.1.4" cargo_metadata = "0.18.1" cargo-config2 = "0.1.17" -keyring = "2.1.0" -libc = "0.2.151" +keyring = "2.3.1" +libc = "0.2.152" owo-colors = "4.0.0" unicode-width = "0.1.11" p256 = "0.13.2" rand_core = "0.6.4" rpassword = "7.3.1" -futures = "0.3.29" +futures = "0.3.30" bytes = "1.5.0" -proc-macro2 = "1.0.71" -quote = "1.0.33" -syn = "2.0.42" +proc-macro2 = "1.0.76" +quote = "1.0.35" +syn = "2.0.48" which = "5.0.0" wit-bindgen-rust = "0.16.0" wit-bindgen-core = "0.16.0" +tempfile = "3.9.0" +assert_cmd = "2.0.13" +predicates = "3.0.4" +wasmparser = "0.119.0" +wat = "1.0.83" +warg-server = "0.2.0" diff --git a/crates/wit/Cargo.toml b/crates/wit/Cargo.toml index 0502e588..a8958e31 100644 --- a/crates/wit/Cargo.toml +++ b/crates/wit/Cargo.toml @@ -36,8 +36,9 @@ tokio = { workspace = true } pretty_env_logger = { workspace = true } [dev-dependencies] -assert_cmd = "2.0.12" -predicates = "3.0.4" -warg-server = "0.2.0" +assert_cmd = { workspace = true } +predicates = { workspace = true } +warg-server = { workspace = true } tokio-util = { workspace = true } -wasmparser = "0.118.1" +wasmparser = { workspace = true } +tempfile = { workspace = true } diff --git a/crates/wit/tests/add.rs b/crates/wit/tests/add.rs index 77e37e4e..9676ba69 100644 --- a/crates/wit/tests/add.rs +++ b/crates/wit/tests/add.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{prelude::*, str::contains}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; mod support; @@ -39,11 +40,11 @@ fn requires_package() { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn validate_the_package_exists() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project .wit("add foo:bar") @@ -56,11 +57,11 @@ async fn validate_the_package_exists() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn validate_the_version_exists() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("foo.wit", "package foo:bar;\n")?; project .wit("publish --init") @@ -69,7 +70,7 @@ async fn validate_the_version_exists() -> Result<()> { .stderr(contains("Published package `foo:bar` v0.1.0")) .success(); - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project .wit("add foo:bar") .assert() @@ -92,11 +93,11 @@ async fn validate_the_version_exists() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn checks_for_duplicate_dependencies() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("foo.wit", "package foo:bar;\n")?; project .wit("publish --init") @@ -105,7 +106,7 @@ async fn checks_for_duplicate_dependencies() -> Result<()> { .stderr(contains("foo")) .success(); - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project .wit("add foo:bar") .assert() @@ -128,11 +129,11 @@ async fn checks_for_duplicate_dependencies() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn does_not_modify_manifest_for_dry_run() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("foo.wit", "package foo:bar;\n")?; project .wit("publish --init") @@ -141,7 +142,7 @@ async fn does_not_modify_manifest_for_dry_run() -> Result<()> { .stderr(contains("foo")) .success(); - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project .wit("add foo:bar --dry-run") .assert() diff --git a/crates/wit/tests/init.rs b/crates/wit/tests/init.rs index 1f286907..c016811d 100644 --- a/crates/wit/tests/init.rs +++ b/crates/wit/tests/init.rs @@ -3,6 +3,7 @@ use anyhow::Result; use assert_cmd::prelude::*; use predicates::str::contains; use std::{fs, path::Path}; +use tempfile::TempDir; mod support; @@ -18,10 +19,10 @@ fn help() { #[test] fn it_creates_the_expected_files() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; wit("init foo") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains(format!( "Created configuration file `{path}`", @@ -29,7 +30,7 @@ fn it_creates_the_expected_files() -> Result<()> { ))) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(proj_dir.join("wit.toml").is_file()); Ok(()) @@ -37,10 +38,10 @@ fn it_creates_the_expected_files() -> Result<()> { #[test] fn it_supports_registry_option() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; wit("init bar --registry https://example.com") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains(format!( "Created configuration file `{path}`", @@ -48,7 +49,7 @@ fn it_supports_registry_option() -> Result<()> { ))) .success(); - let proj_dir = root.join("bar"); + let proj_dir = dir.path().join("bar"); assert!(fs::read_to_string(proj_dir.join("wit.toml"))? .contains("default = \"https://example.com/\"")); diff --git a/crates/wit/tests/publish.rs b/crates/wit/tests/publish.rs index 926a68ab..2c688667 100644 --- a/crates/wit/tests/publish.rs +++ b/crates/wit/tests/publish.rs @@ -1,10 +1,11 @@ -use std::fs; +use std::{fs, rc::Rc}; use crate::support::*; use anyhow::{Context, Result}; use assert_cmd::prelude::*; use predicates::str::contains; use semver::Version; +use tempfile::TempDir; use toml_edit::{value, Array}; use warg_client::{Client, FileSystemClient}; use warg_protocol::registry::PackageId; @@ -35,11 +36,11 @@ fn it_fails_with_missing_toml_file() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_publishes_a_wit_package() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("baz.wit", "package baz:qux;\n")?; project .wit("publish --init") @@ -53,11 +54,11 @@ async fn it_publishes_a_wit_package() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_does_a_dry_run_publish() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("baz.wit", "package baz:qux;\n")?; project .wit("publish --init --dry-run") @@ -82,9 +83,9 @@ async fn it_does_a_dry_run_publish() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_publishes_with_registry_metadata() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; let authors = ["Jane Doe "]; let categories = ["wasm"]; @@ -94,7 +95,7 @@ async fn it_publishes_with_registry_metadata() -> Result<()> { let homepage = "https://example.com/home"; let repository = "https://example.com/repo"; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.file("baz.wit", "package baz:qux;\n")?; project.update_manifest(|mut doc| { diff --git a/crates/wit/tests/support/mod.rs b/crates/wit/tests/support/mod.rs index 09b32f3c..c9d2f188 100644 --- a/crates/wit/tests/support/mod.rs +++ b/crates/wit/tests/support/mod.rs @@ -6,9 +6,10 @@ use std::{ env, fs, path::{Path, PathBuf}, process::Command, - sync::atomic::{AtomicUsize, Ordering::SeqCst}, + rc::Rc, time::Duration, }; +use tempfile::TempDir; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use toml_edit::Document; @@ -24,25 +25,6 @@ pub fn test_signing_key() -> &'static str { "ecdsa-p256:2CV1EpLaSYEn4In4OAEDAj5O4Hzu8AFAxgHXuG310Ew=" } -pub fn root() -> Result { - static NEXT_ID: AtomicUsize = AtomicUsize::new(0); - std::thread_local! { - static TEST_ID: usize = NEXT_ID.fetch_add(1, SeqCst); - } - let id = TEST_ID.with(|n| *n); - let mut path = env::current_exe()?; - path.pop(); // remove test exe name - path.pop(); // remove `deps` - path.pop(); // remove `debug` or `release` - path.push("tests"); - path.push("wit"); - fs::create_dir_all(&path)?; - - exclude_test_directories()?; - - Ok(path.join(format!("t{id}"))) -} - // This works around an apparent bug in cargo where // a directory is explicitly excluded from a workspace, // but `cargo new` still detects `workspace.package` settings @@ -69,13 +51,6 @@ fn exclude_test_directories() -> Result<()> { Ok(()) } -pub fn create_root() -> Result { - let root = root()?; - drop(fs::remove_dir_all(&root)); - fs::create_dir_all(&root)?; - Ok(root) -} - pub fn wit(args: &str) -> Command { let mut exe = std::env::current_exe().unwrap(); exe.pop(); // remove test exe name @@ -91,10 +66,6 @@ pub fn wit(args: &str) -> Command { cmd } -pub fn project() -> Result { - Ok(ProjectBuilder::new(create_root()?)) -} - pub struct ServerInstance { task: Option>, shutdown: CancellationToken, @@ -143,61 +114,36 @@ pub async fn spawn_server(root: &Path) -> Result<(ServerInstance, warg_client::C } pub struct Project { + dir: Rc, root: PathBuf, } -pub struct ProjectBuilder { - project: Project, -} - -impl ProjectBuilder { - pub fn new(root: PathBuf) -> Self { - Self { - project: Project { root }, - } - } - - pub fn root(&self) -> &Path { - self.project.root() - } - - pub fn file>(&mut self, path: B, body: &str) -> Result<&mut Self> { - let path = self.root().join(path); - fs::create_dir_all(path.parent().unwrap())?; - fs::write(self.root().join(path), body)?; - Ok(self) - } - - pub fn build(&mut self) -> Project { - Project { - root: self.project.root.clone(), - } - } -} - impl Project { pub fn new(name: &str) -> Result { - let root = create_root()?; + let dir = TempDir::new()?; wit(&format!("init {name}")) - .current_dir(&root) + .current_dir(&dir) .assert() .try_success()?; + let root = dir.path().join(name); + Ok(Self { - root: root.join(name), + dir: Rc::new(dir), + root, }) } - pub fn with_root(root: &Path, name: &str, args: &str) -> Result { + pub fn with_dir(dir: Rc, name: &str, args: &str) -> Result { wit(&format!("init {name} {args}")) - .current_dir(root) + .current_dir(dir.as_ref()) .assert() .try_success()?; - Ok(Self { - root: root.join(name), - }) + let root = dir.path().join(name); + + Ok(Self { dir, root }) } pub fn file>(&self, path: B, body: &str) -> Result<&Self> { @@ -211,6 +157,10 @@ impl Project { &self.root } + pub fn dir(&self) -> &Rc { + &self.dir + } + pub fn wit(&self, cmd: &str) -> Command { let mut cmd = wit(cmd); cmd.current_dir(&self.root); diff --git a/crates/wit/tests/update.rs b/crates/wit/tests/update.rs index 85866714..32023f0d 100644 --- a/crates/wit/tests/update.rs +++ b/crates/wit/tests/update.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{prelude::PredicateBooleanExt, str::contains, Predicate}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; mod support; @@ -29,11 +30,11 @@ fn it_fails_with_missing_toml_file() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_without_changes_is_a_noop() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project.file("bar.wit", "package foo:bar;\n")?; project .wit("publish --init") @@ -42,7 +43,7 @@ async fn update_without_changes_is_a_noop() -> Result<()> { .stderr(contains("Published package `foo:bar` v0.1.0")) .success(); - let project = Project::with_root(&root, "baz", "")?; + let project = Project::with_dir(dir.clone(), "baz", "")?; project.file("baz.wit", "package foo:baz;\n")?; project .wit("add foo:bar") @@ -67,11 +68,11 @@ async fn update_without_changes_is_a_noop() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project.file("bar.wit", "package foo:bar;\n")?; project .wit("publish --init") @@ -80,7 +81,7 @@ async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> { .stderr(contains("Published package `foo:bar` v0.1.0")) .success(); - let project = Project::with_root(&root, "baz", "")?; + let project = Project::with_dir(dir.clone(), "baz", "")?; project.file("baz.wit", "package foo:baz;\n")?; project .wit("add foo:bar") @@ -95,13 +96,13 @@ async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> { .stderr(contains("Created package `baz.wasm`")); fs::write( - root.join("bar/wit.toml"), + dir.path().join("bar/wit.toml"), "version = \"1.0.0\"\n[dependencies]\n[registries]\n", )?; wit("publish") .env("WIT_PUBLISH_KEY", test_signing_key()) - .current_dir(root.join("bar")) + .current_dir(dir.path().join("bar")) .assert() .stderr(contains("Published package `foo:bar` v1.0.0")) .success(); @@ -117,11 +118,11 @@ async fn test_update_without_compatible_changes_is_a_noop() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_compatible_changes() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project.file("bar.wit", "package foo:bar;\n")?; project.file( "wit.toml", @@ -135,7 +136,7 @@ async fn update_with_compatible_changes() -> Result<()> { .stderr(contains("Published package `foo:bar` v1.0.0")) .success(); - let project = Project::with_root(&root, "baz", "")?; + let project = Project::with_dir(dir.clone(), "baz", "")?; project.file("baz.wit", "package foo:baz;\n")?; project .wit("add foo:bar") @@ -150,13 +151,13 @@ async fn update_with_compatible_changes() -> Result<()> { .stderr(contains("Created package `baz.wasm`")); fs::write( - root.join("bar/wit.toml"), + dir.path().join("bar/wit.toml"), "version = \"1.1.0\"\n[dependencies]\n[registries]\n", )?; wit("publish") .env("WIT_PUBLISH_KEY", test_signing_key()) - .current_dir(root.join("bar")) + .current_dir(dir.path().join("bar")) .assert() .stderr(contains("Published package `foo:bar` v1.1.0")) .success(); @@ -175,11 +176,11 @@ async fn update_with_compatible_changes() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project.file("bar.wit", "package foo:bar;\n")?; project.file( "wit.toml", @@ -193,7 +194,7 @@ async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> { .stderr(contains("Published package `foo:bar` v1.0.0")) .success(); - let project = Project::with_root(&root, "baz", "")?; + let project = Project::with_dir(dir.clone(), "baz", "")?; project.file("baz.wit", "package foo:baz;\n")?; project .wit("add foo:bar") @@ -208,13 +209,13 @@ async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> { .stderr(contains("Created package `baz.wasm`")); fs::write( - root.join("bar/wit.toml"), + dir.path().join("bar/wit.toml"), "version = \"1.1.0\"\n[dependencies]\n[registries]\n", )?; wit("publish") .env("WIT_PUBLISH_KEY", test_signing_key()) - .current_dir(root.join("bar")) + .current_dir(dir.path().join("bar")) .assert() .stderr(contains("Published package `foo:bar` v1.1.0")) .success(); @@ -233,11 +234,11 @@ async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_changed_dependencies() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "bar", "")?; + let project = Project::with_dir(dir.clone(), "bar", "")?; project.file("bar.wit", "package foo:bar;\n")?; project.file( "wit.toml", @@ -251,7 +252,7 @@ async fn update_with_changed_dependencies() -> Result<()> { .stderr(contains("Published package `foo:bar` v1.0.0")) .success(); - let project = Project::with_root(&root, "baz", "")?; + let project = Project::with_dir(dir.clone(), "baz", "")?; project.file("baz.wit", "package foo:baz;\n")?; project.file( "wit.toml", @@ -265,7 +266,7 @@ async fn update_with_changed_dependencies() -> Result<()> { .stderr(contains("Published package `foo:baz` v1.0.0")) .success(); - let project = Project::with_root(&root, "qux", "")?; + let project = Project::with_dir(dir.clone(), "qux", "")?; project.file("qux.wit", "package foo:qux;\n")?; project .wit("add foo:bar") diff --git a/tests/add.rs b/tests/add.rs index e5de03df..badf6e35 100644 --- a/tests/add.rs +++ b/tests/add.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{prelude::*, str::contains}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; use toml_edit::value; mod support; @@ -27,11 +28,11 @@ fn requires_package() { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn validate_the_package_exists() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project .cargo_component("add foo:bar") @@ -44,13 +45,13 @@ async fn validate_the_package_exists() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn validate_the_version_exists() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_component(&config, "foo:bar", "1.1.0", "(component)", true).await?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project .cargo_component("add foo:bar") @@ -74,13 +75,13 @@ async fn validate_the_version_exists() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn adds_dependencies_to_target_component() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_component(&config, "foo:bar", "1.1.0", "(component)", true).await?; - let project = Project::with_root(&root, "foo_target", "")?; + let project = Project::with_dir(dir.clone(), "foo_target", "")?; let manifest = fs::read_to_string(project.root().join("Cargo.toml"))?; assert!(!contains("package.metadata.component.target.dependencies").eval(&manifest)); @@ -126,13 +127,13 @@ fn checks_for_duplicate_dependencies() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn prints_modified_manifest_for_dry_run() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_component(&config, "foo:bar", "1.2.3", "(component)", true).await?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project .cargo_component("add --dry-run foo:bar") diff --git a/tests/build.rs b/tests/build.rs index 700ce37d..01415f83 100644 --- a/tests/build.rs +++ b/tests/build.rs @@ -3,7 +3,8 @@ use anyhow::{Context, Result}; use assert_cmd::prelude::*; use cargo_component::BINDINGS_CRATE_NAME; use predicates::{prelude::PredicateBooleanExt, str::contains}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; use toml_edit::{value, Array, InlineTable, Item, Table}; mod support; @@ -52,25 +53,31 @@ fn it_builds_a_bin_project() -> Result<()> { #[test] fn it_builds_a_workspace() -> Result<()> { - let project = project()? - .file( - "Cargo.toml", - r#"[workspace] + let dir = Rc::new(TempDir::new()?); + let project = Project { + dir: dir.clone(), + root: dir.path().to_owned(), + }; + + project.file( + "Cargo.toml", + r#"[workspace] members = ["foo", "bar", "baz"] "#, - )? - .file( - "baz/Cargo.toml", - r#"[package] + )?; + + project.file( + "baz/Cargo.toml", + r#"[package] name = "baz" version = "0.1.0" edition = "2021" [dependencies] "#, - )? - .file("baz/src/lib.rs", "")? - .build(); + )?; + + project.file("baz/src/lib.rs", "")?; project .cargo_component("new --reactor foo") @@ -78,7 +85,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `foo`")) .success(); - let member = ProjectBuilder::new(project.root().join("foo")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("foo"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -90,7 +100,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `bar`")) .success(); - let member = ProjectBuilder::new(project.root().join("bar")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("bar"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -390,7 +403,7 @@ fn empty_world_with_dep_valid() -> Result<()> { let dep = project.debug_wasm("dep"); validate_component(&dep)?; - let project = Project::with_root(project.root().parent().unwrap(), "main", "")?; + let project = Project::with_dir(project.dir().clone(), "main", "")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); let table = doc["package"]["metadata"]["component"] @@ -620,9 +633,8 @@ fn it_builds_resources_with_specified_ownership_model() -> Result<()> { #[test] fn it_builds_with_a_component_dependency() -> Result<()> { - let root = create_root()?; - - let comp1 = Project::with_root(&root, "comp1", "")?; + let dir = Rc::new(TempDir::new()?); + let comp1 = Project::with_dir(dir.clone(), "comp1", "")?; comp1.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -672,7 +684,7 @@ impl Guest for Component { let dep = comp1.release_wasm("comp1"); validate_component(&dep)?; - let comp2 = Project::with_root(&root, "comp2", "")?; + let comp2 = Project::with_dir(dir.clone(), "comp2", "")?; comp2.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); doc["package"]["metadata"]["component"]["dependencies"]["my:comp1"]["path"] = @@ -738,10 +750,8 @@ fn it_builds_with_adapter() -> Result<()> { let project = Project::new("foo")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); - doc["package"]["metadata"]["component"]["adapter"] = value(format!( - "../../../../../adapters/{version}/wasi_snapshot_preview1.reactor.wasm", - version = env!("WASI_ADAPTER_VERSION") - )); + doc["package"]["metadata"]["component"]["adapter"] = + value(adapter_path().to_str().unwrap()); Ok(doc) })?; diff --git a/tests/check.rs b/tests/check.rs index 1aea748c..99d45bb6 100644 --- a/tests/check.rs +++ b/tests/check.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{boolean::PredicateBooleanExt, str::contains}; -use std::{fmt::Write, fs}; +use std::{fmt::Write, fs, rc::Rc}; +use tempfile::TempDir; mod support; @@ -47,25 +48,31 @@ fn it_finds_errors() -> Result<()> { #[test] fn it_checks_a_workspace() -> Result<()> { - let project = project()? - .file( - "Cargo.toml", - r#"[workspace] + let dir = Rc::new(TempDir::new()?); + let project = Project { + dir: dir.clone(), + root: dir.path().to_owned(), + }; + + project.file( + "Cargo.toml", + r#"[workspace] members = ["foo", "bar", "baz"] "#, - )? - .file( - "baz/Cargo.toml", - r#"[package] + )?; + + project.file( + "baz/Cargo.toml", + r#"[package] name = "baz" version = "0.1.0" edition = "2021" [dependencies] "#, - )? - .file("baz/src/lib.rs", "")? - .build(); + )?; + + project.file("baz/src/lib.rs", "")?; project .cargo_component("new --reactor foo") @@ -73,7 +80,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `foo`")) .success(); - let member = ProjectBuilder::new(project.root().join("foo")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("foo"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -85,7 +95,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `bar`")) .success(); - let member = ProjectBuilder::new(project.root().join("bar")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("bar"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) diff --git a/tests/clippy.rs b/tests/clippy.rs index 958a57eb..662713fd 100644 --- a/tests/clippy.rs +++ b/tests/clippy.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{boolean::PredicateBooleanExt, str::contains}; -use std::{fmt::Write, fs}; +use std::{fmt::Write, fs, rc::Rc}; +use tempfile::TempDir; mod support; @@ -72,25 +73,31 @@ fn it_finds_clippy_warnings() -> Result<()> { #[test] fn it_checks_a_workspace() -> Result<()> { - let project = project()? - .file( - "Cargo.toml", - r#"[workspace] + let dir = Rc::new(TempDir::new()?); + let project = Project { + dir: dir.clone(), + root: dir.path().to_owned(), + }; + + project.file( + "Cargo.toml", + r#"[workspace] members = ["foo", "bar", "baz"] "#, - )? - .file( - "baz/Cargo.toml", - r#"[package] + )?; + + project.file( + "baz/Cargo.toml", + r#"[package] name = "baz" version = "0.1.0" edition = "2021" [dependencies] "#, - )? - .file("baz/src/lib.rs", "")? - .build(); + )?; + + project.file("baz/src/lib.rs", "")?; project .cargo_component("new --reactor foo") @@ -98,7 +105,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `foo`")) .success(); - let member = ProjectBuilder::new(project.root().join("foo")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("foo"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -110,7 +120,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `bar`")) .success(); - let member = ProjectBuilder::new(project.root().join("bar")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("bar"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) diff --git a/tests/metadata.rs b/tests/metadata.rs index 07d5c7c5..ce373982 100644 --- a/tests/metadata.rs +++ b/tests/metadata.rs @@ -1,7 +1,10 @@ +use std::rc::Rc; + use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{prelude::PredicateBooleanExt, str::contains}; +use tempfile::TempDir; mod support; @@ -39,25 +42,31 @@ fn it_rejects_invalid_format_versions() -> Result<()> { #[test] fn it_prints_workspace_metadata() -> Result<()> { - let project = project()? - .file( - "Cargo.toml", - r#"[workspace] + let dir = Rc::new(TempDir::new()?); + let project = Project { + dir: dir.clone(), + root: dir.path().to_owned(), + }; + + project.file( + "Cargo.toml", + r#"[workspace] members = ["foo", "bar", "baz"] "#, - )? - .file( - "baz/Cargo.toml", - r#"[package] + )?; + + project.file( + "baz/Cargo.toml", + r#"[package] name = "baz" version = "0.1.0" edition = "2021" [dependencies] "#, - )? - .file("baz/src/lib.rs", "")? - .build(); + )?; + + project.file("baz/src/lib.rs", "")?; project .cargo_component("new --reactor foo") @@ -65,7 +74,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `foo`")) .success(); - let member = ProjectBuilder::new(project.root().join("foo")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("foo"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -77,7 +89,10 @@ edition = "2021" .stderr(contains("Updated manifest of package `bar`")) .success(); - let member = ProjectBuilder::new(project.root().join("bar")).build(); + let member = Project { + dir: dir.clone(), + root: project.root().join("bar"), + }; member.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) diff --git a/tests/new.rs b/tests/new.rs index f8feb1b5..b3054b83 100644 --- a/tests/new.rs +++ b/tests/new.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::Result; use assert_cmd::prelude::*; use predicates::{str::contains, Predicate}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; mod support; @@ -20,15 +21,15 @@ fn help() { #[test] fn it_creates_the_expected_files_for_bin() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --command foo") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains("Updated manifest of package `foo")) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(proj_dir.join("Cargo.toml").is_file()); assert!(!proj_dir.join("wit/world.wit").is_file()); @@ -41,15 +42,15 @@ fn it_creates_the_expected_files_for_bin() -> Result<()> { #[test] fn it_creates_the_expected_files() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --reactor foo") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains("Updated manifest of package `foo`")) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(proj_dir.join("Cargo.toml").is_file()); assert!(proj_dir.join("wit/world.wit").is_file()); @@ -62,15 +63,15 @@ fn it_creates_the_expected_files() -> Result<()> { #[test] fn it_supports_editor_option() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --reactor foo --editor none") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains("Updated manifest of package `foo")) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(proj_dir.join("Cargo.toml").is_file()); assert!(proj_dir.join("wit/world.wit").is_file()); @@ -82,15 +83,15 @@ fn it_supports_editor_option() -> Result<()> { #[test] fn it_supports_edition_option() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --reactor foo --edition 2018") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains("Updated manifest of package `foo")) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(fs::read_to_string(proj_dir.join("Cargo.toml"))?.contains("edition = \"2018\"")); @@ -99,15 +100,15 @@ fn it_supports_edition_option() -> Result<()> { #[test] fn it_supports_name_option() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --reactor foo --name bar") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains("Updated manifest of package `bar`")) .success(); - let proj_dir = root.join("foo"); + let proj_dir = dir.path().join("foo"); assert!(fs::read_to_string(proj_dir.join("Cargo.toml"))?.contains("name = \"bar\"")); @@ -116,10 +117,10 @@ fn it_supports_name_option() -> Result<()> { #[test] fn it_rejects_rust_keywords() -> Result<()> { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component("new --reactor foo --name fn") - .current_dir(&root) + .current_dir(dir.path()) .assert() .stderr(contains( "the name `fn` cannot be used as a package name, it is a Rust keyword", @@ -131,9 +132,9 @@ fn it_rejects_rust_keywords() -> Result<()> { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_targets_a_world() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -152,7 +153,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "component", "--target foo:bar@1.0.0")?; + let project = Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -170,11 +171,11 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_errors_if_target_does_not_exist() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; - match Project::with_root(&root, "component", "--target foo:bar@1.0.0") { + match Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0") { Ok(_) => panic!("expected error"), Err(e) => assert!(contains("package `foo:bar` does not exist").eval(&e.to_string())), } diff --git a/tests/publish.rs b/tests/publish.rs index 0984af65..e9a85237 100644 --- a/tests/publish.rs +++ b/tests/publish.rs @@ -3,7 +3,8 @@ use anyhow::{Context, Result}; use assert_cmd::prelude::*; use predicates::str::contains; use semver::Version; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; use toml_edit::{value, Array}; use warg_client::Client; use warg_protocol::registry::PackageId; @@ -23,9 +24,9 @@ fn help() { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_publishes_a_component() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -40,7 +41,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "foo", "--namespace test --target my:world")?; + let project = Project::with_dir(dir.clone(), "foo", "--namespace test --target my:world")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -70,9 +71,9 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_fails_if_package_does_not_exist() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -87,7 +88,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "foo", "--namespace test --target my:world")?; + let project = Project::with_dir(dir.clone(), "foo", "--namespace test --target my:world")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -105,9 +106,9 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_publishes_a_dependency() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -121,7 +122,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "foo", "--namespace test --target my:world/foo")?; + let project = Project::with_dir(dir.clone(), "foo", "--namespace test --target my:world/foo")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -136,7 +137,7 @@ world foo { validate_component(&project.release_wasm("foo"))?; - let project = Project::with_root(&root, "bar", "--namespace test --target my:world")?; + let project = Project::with_dir(dir.clone(), "bar", "--namespace test --target my:world")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -174,9 +175,9 @@ impl Guest for Component { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn it_publishes_with_registry_metadata() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; let authors = ["Jane Doe "]; let categories = ["wasm"]; @@ -186,7 +187,7 @@ async fn it_publishes_with_registry_metadata() -> Result<()> { let homepage = "https://example.com/home"; let repository = "https://example.com/repo"; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); diff --git a/tests/support/mod.rs b/tests/support/mod.rs index cf09f8b3..4f594f83 100644 --- a/tests/support/mod.rs +++ b/tests/support/mod.rs @@ -4,12 +4,13 @@ use anyhow::{bail, Context, Result}; use assert_cmd::prelude::OutputAssertExt; use cargo_component::BINDINGS_CRATE_NAME; use std::{ - env, fs, + fs, path::{Path, PathBuf}, process::Command, - sync::atomic::{AtomicUsize, Ordering::SeqCst}, + rc::Rc, time::Duration, }; +use tempfile::TempDir; use tokio::task::JoinHandle; use tokio_util::sync::CancellationToken; use toml_edit::{value, Document, InlineTable}; @@ -31,63 +32,29 @@ pub fn test_signing_key() -> &'static str { "ecdsa-p256:2CV1EpLaSYEn4In4OAEDAj5O4Hzu8AFAxgHXuG310Ew=" } -pub fn redirect_bindings_crate(doc: &mut Document) { - const PATH_TO_BINDINGS_CRATE: &str = "../../../../../crates/bindings"; - - doc["dependencies"][BINDINGS_CRATE_NAME] = - value(InlineTable::from_iter([("path", PATH_TO_BINDINGS_CRATE)])); -} - -pub fn root() -> Result { - static NEXT_ID: AtomicUsize = AtomicUsize::new(0); - std::thread_local! { - static TEST_ID: usize = NEXT_ID.fetch_add(1, SeqCst); - } - let id = TEST_ID.with(|n| *n); - let mut path = env::current_exe()?; +pub fn adapter_path() -> PathBuf { + let mut path = std::env::current_exe().unwrap(); path.pop(); // remove test exe name path.pop(); // remove `deps` path.pop(); // remove `debug` or `release` - path.push("tests"); - path.push("cargo-component"); - fs::create_dir_all(&path)?; - - exclude_test_directories()?; - - Ok(path.join(format!("t{id}"))) + path.pop(); // remove `target` + path.push("adapters"); + path.push(env!("WASI_ADAPTER_VERSION")); + path.push("wasi_snapshot_preview1.reactor.wasm"); + path } -// This works around an apparent bug in cargo where -// a directory is explicitly excluded from a workspace, -// but `cargo new` still detects `workspace.package` settings -// and sets them to be inherited in the new project. -fn exclude_test_directories() -> Result<()> { - let mut path = env::current_exe()?; +pub fn redirect_bindings_crate(doc: &mut Document) { + let mut path = std::env::current_exe().unwrap(); path.pop(); // remove test exe name path.pop(); // remove `deps` path.pop(); // remove `debug` or `release` - path.push("tests"); - path.push("Cargo.toml"); - - if !path.exists() { - fs::write( - &path, - r#" - [workspace] - exclude = ["cargo-component", "wit"] - "#, - ) - .with_context(|| format!("failed to write `{path}`", path = path.display()))?; - } + path.pop(); // remove `target` + path.push("crates"); + path.push("bindings"); - Ok(()) -} - -pub fn create_root() -> Result { - let root = root()?; - drop(fs::remove_dir_all(&root)); - fs::create_dir_all(&root)?; - Ok(root) + doc["dependencies"][BINDINGS_CRATE_NAME] = + value(InlineTable::from_iter([("path", path.to_str().unwrap())])); } pub fn cargo_component(args: &str) -> Command { @@ -106,10 +73,6 @@ pub fn cargo_component(args: &str) -> Command { cmd } -pub fn project() -> Result { - Ok(ProjectBuilder::new(create_root()?)) -} - pub async fn publish( config: &warg_client::Config, id: &PackageId, @@ -242,74 +205,60 @@ pub async fn spawn_server(root: &Path) -> Result<(ServerInstance, warg_client::C } pub struct Project { - root: PathBuf, -} - -pub struct ProjectBuilder { - project: Project, -} - -impl ProjectBuilder { - pub fn new(root: PathBuf) -> Self { - Self { - project: Project { root }, - } - } - - pub fn root(&self) -> &Path { - self.project.root() - } - - pub fn file>(&mut self, path: B, body: &str) -> Result<&mut Self> { - let path = self.root().join(path); - fs::create_dir_all(path.parent().unwrap())?; - fs::write(self.root().join(path), body)?; - Ok(self) - } - - pub fn build(&mut self) -> Project { - Project { - root: self.project.root.clone(), - } - } + pub dir: Rc, + pub root: PathBuf, } impl Project { pub fn new(name: &str) -> Result { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component(&format!("new --reactor {name}")) - .current_dir(&root) + .current_dir(dir.path()) .assert() .try_success()?; + let root = dir.path().join(name); + Ok(Self { - root: root.join(name), + dir: Rc::new(dir), + root, }) } pub fn new_bin(name: &str) -> Result { - let root = create_root()?; + let dir = TempDir::new()?; cargo_component(&format!("new {name}")) - .current_dir(&root) + .current_dir(dir.path()) .assert() .try_success()?; + let root = dir.path().join(name); + Ok(Self { - root: root.join(name), + dir: Rc::new(dir), + root, }) } - pub fn with_root(root: &Path, name: &str, args: &str) -> Result { + pub fn with_dir(dir: Rc, name: &str, args: &str) -> Result { cargo_component(&format!("new --reactor {name} {args}")) - .current_dir(root) + .current_dir(dir.path()) .assert() .try_success()?; - Ok(Self { - root: root.join(name), - }) + let root = dir.path().join(name); + + Ok(Self { dir, root }) + } + + pub fn root(&self) -> &Path { + &self.root + } + + pub fn dir(&self) -> &Rc { + &self.dir } pub fn file>(&self, path: B, body: &str) -> Result<&Self> { @@ -332,10 +281,6 @@ impl Project { Ok(()) } - pub fn root(&self) -> &Path { - &self.root - } - pub fn build_dir(&self) -> PathBuf { self.root().join("target") } diff --git a/tests/update.rs b/tests/update.rs index 60f52d98..4561343e 100644 --- a/tests/update.rs +++ b/tests/update.rs @@ -2,7 +2,8 @@ use crate::support::*; use anyhow::{Context, Result}; use assert_cmd::prelude::*; use predicates::{prelude::PredicateBooleanExt, str::contains}; -use std::fs; +use std::{fs, rc::Rc}; +use tempfile::TempDir; use toml_edit::value; mod support; @@ -21,9 +22,9 @@ fn help() { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_without_changes_is_a_noop() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -38,7 +39,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "component", "--target foo:bar@1.0.0")?; + let project = Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -62,9 +63,9 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_without_compatible_changes_is_a_noop() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -79,7 +80,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "component", "--target foo:bar@1.0.0")?; + let project = Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -122,9 +123,9 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_compatible_changes() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -139,7 +140,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "component", "--target foo:bar@1.0.0")?; + let project = Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -196,9 +197,9 @@ impl Guest for Component { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_compatible_changes_is_noop_for_dryrun() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_wit( &config, @@ -213,7 +214,7 @@ world foo { ) .await?; - let project = Project::with_root(&root, "component", "--target foo:bar@1.0.0")?; + let project = Project::with_dir(dir.clone(), "component", "--target foo:bar@1.0.0")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) @@ -261,14 +262,14 @@ world foo { #[tokio::test(flavor = "multi_thread", worker_threads = 1)] async fn update_with_changed_dependencies() -> Result<()> { - let root = create_root()?; - let (_server, config) = spawn_server(&root).await?; - config.write_to_file(&root.join("warg-config.json"))?; + let dir = Rc::new(TempDir::new()?); + let (_server, config) = spawn_server(dir.path()).await?; + config.write_to_file(&dir.path().join("warg-config.json"))?; publish_component(&config, "foo:bar", "1.0.0", "(component)", true).await?; publish_component(&config, "foo:baz", "1.0.0", "(component)", true).await?; - let project = Project::with_root(&root, "foo", "")?; + let project = Project::with_dir(dir.clone(), "foo", "")?; project.update_manifest(|mut doc| { redirect_bindings_crate(&mut doc); Ok(doc) diff --git a/tests/upgrade.rs b/tests/upgrade.rs index 2e1d816f..5a728efe 100644 --- a/tests/upgrade.rs +++ b/tests/upgrade.rs @@ -21,8 +21,7 @@ fn help() { #[test] fn upgrade_single_crate_already_current_is_no_op() -> Result<()> { - let root = create_root()?; - let project = Project::with_root(&root, "component", "")?; + let project = Project::new("component")?; project .cargo_component("upgrade --no-install") @@ -37,8 +36,7 @@ fn upgrade_single_crate_already_current_is_no_op() -> Result<()> { #[test] fn upgrade_single_crate_upgrades_bindings_dep() -> Result<()> { - let root = create_root()?; - let project = Project::with_root(&root, "component", "")?; + let project = Project::new("component")?; project.update_manifest(|mut doc| { // Set arbitrary old version of bindings crate. doc["dependencies"][BINDINGS_CRATE_NAME] = value("0.1.0"); @@ -94,8 +92,7 @@ fn upgrade_single_crate_upgrades_bindings_dep() -> Result<()> { #[test] fn skip_packages_newer_than_cargo_component() -> Result<()> { - let root = create_root()?; - let project = Project::with_root(&root, "component", "")?; + let project = Project::new("component")?; project.update_manifest(|mut doc| { // Set arbitrary future version of cargo-component doc["dependencies"][BINDINGS_CRATE_NAME] = value("1000.0.0"); @@ -123,8 +120,7 @@ fn skip_packages_newer_than_cargo_component() -> Result<()> { #[test] fn upgrade_dry_run_does_not_alter_manifest() -> Result<()> { - let root = create_root()?; - let project = Project::with_root(&root, "component", "")?; + let project = Project::new("component")?; project.update_manifest(|mut doc| { // Set arbitrary old version of bindings crate. doc["dependencies"][BINDINGS_CRATE_NAME] = value("0.1.0");