diff --git a/CHANGELOG.md b/CHANGELOG.md index e72ba34b8..e944f8349 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -20,6 +20,7 @@ #### 🚀 Updates - Added Linux x64 musl support (`x86_64-unknown-linux-musl`). +- Improved file and directory locking. Will now work correctly across processes and signals, especially for killed/dropped. - Updated WASM functions to use explicit Rust enum types for versions to properly handle all variations (version, alias, requirement, range). - WASM API - Uses `VersionSpec` enum: diff --git a/Cargo.lock b/Cargo.lock index 6db32d6d4..1bc5c4b7f 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -172,9 +172,9 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", @@ -455,9 +455,9 @@ dependencies = [ [[package]] name = "clap" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "d04704f56c2cde07f43e8e2c154b43f216dc5c92fc98ada720177362f953b956" +checksum = "ac495e00dcec98c83465d5ad66c5c4fabd652fd6686e7c6269b117e729a6f17b" dependencies = [ "clap_builder", "clap_derive", @@ -465,30 +465,30 @@ dependencies = [ [[package]] name = "clap_builder" -version = "4.4.6" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0e231faeaca65ebd1ea3c737966bf858971cd38c3849107aa3ea7de90a804e45" +checksum = "c77ed9a32a62e6ca27175d00d29d05ca32e396ea1eb5fb01d8256b669cec7663" dependencies = [ "anstream", "anstyle", - "clap_lex 0.5.0", + "clap_lex 0.6.0", "strsim", ] [[package]] name = "clap_complete" -version = "4.4.3" +version = "4.4.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "e3ae8ba90b9d8b007efe66e55e48fb936272f5ca00349b5b0e89877520d35ea7" +checksum = "bffe91f06a11b4b9420f62103854e90867812cd5d01557f853c5ee8e791b12ae" dependencies = [ - "clap 4.4.6", + "clap 4.4.7", ] [[package]] name = "clap_derive" -version = "4.4.2" +version = "4.4.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0862016ff20d69b84ef8247369fabf5c008a7417002411897d40ee1f4532b873" +checksum = "cf9804afaaf59a91e75b022a30fb7229a7901f60c755489cc61c9b423b836442" dependencies = [ "heck", "proc-macro2", @@ -507,9 +507,9 @@ dependencies = [ [[package]] name = "clap_lex" -version = "0.5.0" +version = "0.6.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "2da6da31387c7e4ef160ffab6d5e7f00c42626fe39aea70a7b0f1773f7dd6c1b" +checksum = "702fc72eb24e5a1e48ce58027a675bc24edd52096d5397d4aea7c6dd9eca0bd1" [[package]] name = "clean-path" @@ -1224,9 +1224,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide 0.7.1", @@ -1279,9 +1279,9 @@ dependencies = [ [[package]] name = "futures" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "23342abe12aba583913b2e62f22225ff9c950774065e4bfb61a19cd9770fec40" +checksum = "da0290714b38af9b4a7b094b8a37086d1b4e61f2df9122c3cad2577669145335" dependencies = [ "futures-channel", "futures-core", @@ -1294,9 +1294,9 @@ dependencies = [ [[package]] name = "futures-channel" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "955518d47e09b25bbebc7a18df10b81f0c766eaf4c4f1cccef2fca5f2a4fb5f2" +checksum = "ff4dd66668b557604244583e3e1e1eada8c5c2e96a6d0d6653ede395b78bbacb" dependencies = [ "futures-core", "futures-sink", @@ -1304,15 +1304,15 @@ dependencies = [ [[package]] name = "futures-core" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4bca583b7e26f571124fe5b7561d49cb2868d79116cfa0eefce955557c6fee8c" +checksum = "eb1d22c66e66d9d72e1758f0bd7d4fd0bee04cad842ee34587d68c07e45d088c" [[package]] name = "futures-executor" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ccecee823288125bd88b4d7f565c9e58e41858e47ab72e8ea2d64e93624386e0" +checksum = "0f4fb8693db0cf099eadcca0efe2a5a22e4550f98ed16aba6c48700da29597bc" dependencies = [ "futures-core", "futures-task", @@ -1321,15 +1321,15 @@ dependencies = [ [[package]] name = "futures-io" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "4fff74096e71ed47f8e023204cfd0aa1289cd54ae5430a9523be060cdb849964" +checksum = "8bf34a163b5c4c52d0478a4d757da8fb65cabef42ba90515efee0f6f9fa45aaa" [[package]] name = "futures-macro" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" +checksum = "53b153fd91e4b0147f4aced87be237c98248656bb01050b96bf3ee89220a8ddb" dependencies = [ "proc-macro2", "quote", @@ -1338,21 +1338,21 @@ dependencies = [ [[package]] name = "futures-sink" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "f43be4fe21a13b9781a69afa4985b0f6ee0e1afab2c6f454a8cf30e2b2237b6e" +checksum = "e36d3378ee38c2a36ad710c5d30c2911d752cb941c00c72dbabfb786a7970817" [[package]] name = "futures-task" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "76d3d132be6c0e6aa1534069c705a74a5997a356c0dc2f86a47765e5617c5b65" +checksum = "efd193069b0ddadc69c46389b740bbccdd97203899b48d09c5f7969591d6bae2" [[package]] name = "futures-util" -version = "0.3.28" +version = "0.3.29" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "26b01e40b772d54cf6c6d721c1d1abd0647a0106a12ecaa1c186273392a69533" +checksum = "a19526d624e703a3179b3d322efec918b6246ea0fa51d41124525f00f1cc8104" dependencies = [ "futures-channel", "futures-core", @@ -1697,9 +1697,9 @@ dependencies = [ [[package]] name = "insta" -version = "1.33.0" +version = "1.34.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1aa511b2e298cd49b1856746f6bb73e17036bcd66b25f5e92cdcdbec9bd75686" +checksum = "5d64600be34b2fcfc267740a243fa7744441bb4947a619ac4e5bb6507f35fbfc" dependencies = [ "console", "lazy_static", @@ -2132,9 +2132,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "once_map" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc08fbf8d1bb5119046009c6a3f3153333f1080b68778e0e1be37c747b97cf5" +checksum = "3388ad2ab0b17d90355995011856a3337e0a98147950f076ee9a73ad5d4a553e" dependencies = [ "ahash", "hashbrown 0.14.2", @@ -2304,7 +2304,7 @@ name = "proto_cli" version = "0.20.4" dependencies = [ "chrono", - "clap 4.4.6", + "clap 4.4.7", "clap_complete", "convert_case", "dialoguer", @@ -2395,7 +2395,7 @@ dependencies = [ "proto_pdk_api", "proto_wasm_plugin", "serde_json", - "toml 0.8.2", + "toml 0.8.5", ] [[package]] @@ -2875,9 +2875,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] @@ -2894,9 +2894,9 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", @@ -2916,9 +2916,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -3064,9 +3064,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starbase" -version = "0.2.8" +version = "0.2.9" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0ce70d3d623e4e26202bdac9fedda7f6e91a12c12f98147eaf2e624c7525c457" +checksum = "e6d78e172dba2a6c0e98c4b45fd8f245efe7b4c9c6e08981705f03bffdb00288" dependencies = [ "async-trait", "chrono", @@ -3086,9 +3086,9 @@ dependencies = [ [[package]] name = "starbase_archive" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ad85bff80a5ec20265e65a69102eee54ae1e4dac9f977256fbf770c7153fa1" +checksum = "935856c30da2f62a73bcc57eecb5508bedd313287bc0e00e7e7c4b7a07fb5995" dependencies = [ "flate2", "miette", @@ -3100,14 +3100,14 @@ dependencies = [ "tracing", "xz2", "zip", - "zstd 0.12.4", + "zstd 0.13.0", ] [[package]] name = "starbase_events" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f172a2185991dbfb2a3446c47749ade52d66d2aaea724d19bd45607527ebd9d" +checksum = "455a107aab23fa941399ed716e42776ac8e200f5f92706b7ce59b08949aaf153" dependencies = [ "async-trait", "miette", @@ -3117,9 +3117,9 @@ dependencies = [ [[package]] name = "starbase_macros" -version = "0.2.6" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "52740dab6d63a2cd80f282741514655723b813b9c82717b5c39aa80a78684dfe" +checksum = "70da3be1ac772cd1cf5b71a725988b64829da92664b8fc362be765462c28638c" dependencies = [ "darling 0.20.3", "proc-macro2", @@ -3129,9 +3129,9 @@ dependencies = [ [[package]] name = "starbase_sandbox" -version = "0.1.11" +version = "0.1.12" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ed2c63f6daf91fb1cb95ac13ff5f5bf57d0657060519d137cfff6d1a0a690dbc" +checksum = "49d8cc34f93dd97db45ad1a7240bc03e01ee8478af003f8d945e8031585a4f11" dependencies = [ "assert_cmd", "assert_fs", @@ -3157,9 +3157,9 @@ dependencies = [ [[package]] name = "starbase_utils" -version = "0.3.4" +version = "0.3.6" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b5dc77ea8ee6706f6485f931653277a4bfe04a2d127727e018b082fbfe52b3" +checksum = "f9faf731068b919569efae7f6c7c6c3d2e29411c1cba666ef0c6fe20b82f50a1" dependencies = [ "dirs 5.0.1", "fs4", @@ -3173,7 +3173,7 @@ dependencies = [ "starbase_styles", "thiserror", "tokio", - "toml 0.8.2", + "toml 0.8.5", "tracing", "wax", ] @@ -3535,21 +3535,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "3efaf127c78d5339cc547cce4e4d973bd5e4f56e949a06d091c082ebeef2f800" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.5", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -3569,9 +3569,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" dependencies = [ "indexmap 2.0.2", "serde", @@ -3632,12 +3632,12 @@ dependencies = [ [[package]] name = "tracing-log" -version = "0.1.3" +version = "0.2.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "78ddad33d2d10b1ed7eb9d1f518a5674713876e97e5bb9b7345a7984fbb4f922" +checksum = "ee855f1f400bd0e5c02d150ae5de3840039a3f54b025156404e34c23c03f47c3" dependencies = [ - "lazy_static", "log", + "once_cell", "tracing-core", ] @@ -4808,11 +4808,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ - "zstd-safe 6.0.6", + "zstd-safe 7.0.0", ] [[package]] @@ -4827,11 +4827,10 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/Cargo.toml b/Cargo.toml index 1b923f638..5e26458ba 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -5,34 +5,39 @@ default-members = ["crates/cli"] [workspace.dependencies] cached = "0.46.0" -clap = "4.4.6" -clap_complete = "4.4.3" +clap = "4.4.7" +clap_complete = "4.4.4" convert_case = "0.6.0" extism = { version = "0.5.4" } extism-pdk = "0.3.4" human-sort = "0.2.2" miette = "5.10.0" once_cell = "1.18.0" -once_map = "0.4.9" -regex = "1.10.2" +once_map = "0.4.10" +regex = { version = "1.10.2", default-features = false, features = [ + "std", + "unicode-perl", +] } reqwest = { version = "0.11.22", default-features = false } schematic = { version = "0.12.7", default-features = false, features = [ "schema", ] } semver = "1.0.20" -serde = { version = "1.0.189", features = ["derive"] } +serde = { version = "1.0.190", features = ["derive"] } serde_json = "1.0.107" sha2 = "0.10.8" -starbase_archive = { version = "0.2.3", features = [ +starbase = "0.2.9" +starbase_archive = { version = "0.2.4", features = [ "tar-gz", "tar-xz", "tar-zstd", "zip", "zip-deflate", ] } -starbase_sandbox = { version = "0.1.11" } +starbase_events = "0.2.2" +starbase_sandbox = { version = "0.1.12" } starbase_styles = "0.1.16" -starbase_utils = { version = "0.3.4", default-features = false, features = [ +starbase_utils = { version = "0.3.6", default-features = false, features = [ "json", "toml", ] } diff --git a/README.md b/README.md index d6f3fb2ec..618a035b7 100644 --- a/README.md +++ b/README.md @@ -2,7 +2,7 @@ ![Crates.io](https://img.shields.io/crates/v/proto_cli) ![Crates.io](https://img.shields.io/crates/d/proto_cli) -proto is a unified and pluggable next-generation version manager for multiple programming languages. +proto is a pluggable next-generation version manager for multiple programming languages. A unified toolchain. - [Learn more](https://moonrepo.dev/proto) - [Documentation](https://moonrepo.dev/docs/proto) @@ -19,14 +19,14 @@ proto is a unified and pluggable next-generation version manager for multiple pr - Contextual version detection, ensuring the correct version of a tool is always used. - Checksum verification, ensuring a tool came from a trusted source. - Detects and infers from a language's ecosystem for maximum compatibility. -- Pluggable architecture, allowing for custom tooling. +- Pluggable architecture via WASM, enabling custom integrations. ## Supported languages - Bun - Deno - Go -- Node.js (and npm, pnpm, yarn) +- Node (and npm, pnpm, yarn) - Python - Rust - ... [and more via plugins!](https://moonrepo.dev/docs/proto/tools) diff --git a/crates/cli/Cargo.toml b/crates/cli/Cargo.toml index 016c735c4..43d125f18 100644 --- a/crates/cli/Cargo.toml +++ b/crates/cli/Cargo.toml @@ -37,14 +37,14 @@ clap_complete = { workspace = true } convert_case = { workspace = true } dialoguer = "0.11.0" dirs = "5.0.1" -futures = "0.3.28" +futures = "0.3.29" human-sort = { workspace = true } indicatif = "0.17.7" miette = { workspace = true } reqwest = { workspace = true, features = ["rustls-tls-native-roots", "stream"] } semver = { workspace = true } serde = { workspace = true } -starbase = "0.2.8" +starbase = { workspace = true } starbase_archive = { workspace = true } starbase_styles = { workspace = true } starbase_utils = { workspace = true } diff --git a/crates/cli/tests/utils.rs b/crates/cli/tests/utils.rs index c6dd4b63e..e5d476bc9 100644 --- a/crates/cli/tests/utils.rs +++ b/crates/cli/tests/utils.rs @@ -24,7 +24,7 @@ pub fn create_proto_command>(path: T) -> assert_cmd::Command { let path = path.as_ref(); let mut cmd = create_command_with_name(path, "proto"); - cmd.timeout(std::time::Duration::from_secs(180)); + cmd.timeout(std::time::Duration::from_secs(240)); cmd.env("PROTO_HOME", path.as_os_str()); cmd.env("PROTO_LOG", "trace"); cmd.env("PROTO_WASM_LOG", "trace"); diff --git a/crates/core/Cargo.toml b/crates/core/Cargo.toml index 589933369..f92a8a165 100644 --- a/crates/core/Cargo.toml +++ b/crates/core/Cargo.toml @@ -25,7 +25,7 @@ serde = { workspace = true } serde_json = { workspace = true } sha2 = { workspace = true } starbase_archive = { workspace = true } -starbase_events = "0.2.1" +starbase_events = { workspace = true } starbase_styles = { workspace = true } starbase_utils = { workspace = true, features = ["fs-lock"] } thiserror = { workspace = true } diff --git a/crates/core/src/helpers.rs b/crates/core/src/helpers.rs index 4dfc90669..97bf38923 100644 --- a/crates/core/src/helpers.rs +++ b/crates/core/src/helpers.rs @@ -159,9 +159,8 @@ pub fn is_offline() -> bool { } pub fn is_cache_enabled() -> bool { - env::var("PROTO_CACHE").map_or(true, |value| { - value != "0" && value != "false" && value != "no" && value != "off" - }) + env::var("PROTO_CACHE") + .is_ok_and(|value| value != "0" && value != "false" && value != "no" && value != "off") } pub fn is_archive_file>(path: P) -> bool { diff --git a/crates/core/src/tool.rs b/crates/core/src/tool.rs index 35b82e4e0..34857ec96 100644 --- a/crates/core/src/tool.rs +++ b/crates/core/src/tool.rs @@ -8,7 +8,7 @@ use crate::proto::ProtoEnvironment; use crate::shimmer::{ create_global_shim, create_local_shim, get_shim_file_name, ShimContext, SHIM_VERSION, }; -use crate::tool_manifest::{now, ToolManifest}; +use crate::tool_manifest::ToolManifest; use crate::version_resolver::VersionResolver; use extism::{manifest::Wasm, Manifest as PluginManifest}; use miette::IntoDiagnostic; @@ -819,8 +819,8 @@ impl Tool { } /// Download the tool (as an archive) from its distribution registry - /// into the `~/.proto/temp` folder, and optionally verify checksums. - pub async fn install_from_prebuilt(&self, temp_dir: &Path) -> miette::Result<()> { + /// into the `~/.proto/tools/` folder, and optionally verify checksums. + pub async fn install_from_prebuilt(&self, install_dir: &Path) -> miette::Result<()> { debug!( tool = self.id.as_str(), "Installing tool from a pre-built archive" @@ -831,10 +831,12 @@ impl Tool { "download_prebuilt", DownloadPrebuiltInput { context: self.create_context(), - install_dir: self.to_virtual_path(temp_dir), + install_dir: self.to_virtual_path(install_dir), }, )?; + let temp_dir = self.get_temp_dir(); + // Download the prebuilt let download_url = options.download_url; let download_file = match options.download_name { @@ -875,15 +877,13 @@ impl Tool { options.checksum_public_key.as_deref(), ) .await?; - - fs::remove_file(checksum_file)?; } // Attempt to unpack the archive debug!( tool = self.id.as_str(), download_file = ?download_file, - install_dir = ?temp_dir, + install_dir = ?install_dir, "Attempting to unpack archive", ); @@ -892,14 +892,14 @@ impl Tool { "unpack_archive", UnpackArchiveInput { input_file: self.to_virtual_path(&download_file), - output_dir: self.to_virtual_path(temp_dir), + output_dir: self.to_virtual_path(install_dir), context: self.create_context(), }, )?; // Is an archive, unpack it } else if is_archive_file(&download_file) { - let mut archiver = Archiver::new(temp_dir, &download_file); + let mut archiver = Archiver::new(install_dir, &download_file); if let Some(prefix) = &options.archive_prefix { archiver.set_prefix(prefix); @@ -909,7 +909,7 @@ impl Tool { // Not an archive, assume a binary and copy } else { - let install_path = temp_dir.join(if cfg!(windows) { + let install_path = install_dir.join(if cfg!(windows) { format!("{}.exe", self.id) } else { self.id.to_string() @@ -919,10 +919,6 @@ impl Tool { fs::update_perms(install_path, None)?; } - if download_file.exists() { - fs::remove_file(&download_file)?; - } - Ok(()) } @@ -943,9 +939,7 @@ impl Tool { } let install_dir = self.get_tool_dir(); - let temp_install_dir = - self.get_temp_dir() - .join(format!("{}-{}", self.get_resolved_version(), now())); + let install_lock = fs::lock_directory(&install_dir)?; let mut installed = false; self.on_installing @@ -963,7 +957,7 @@ impl Tool { "native_install", NativeInstallInput { context: self.create_context(), - install_dir: self.to_virtual_path(&temp_install_dir), + install_dir: self.to_virtual_path(&install_dir), }, )?; @@ -990,17 +984,11 @@ impl Tool { // self.install_from_prebuilt(&install_dir).await?; // } - self.install_from_prebuilt(&temp_install_dir).await?; - - // Ensure the final destination does not exist before moving - if install_dir.exists() { - fs::remove_dir_all(&install_dir)?; - } - - // Move the built/unpacked files to the final destination - fs::rename(temp_install_dir, &install_dir)?; + self.install_from_prebuilt(&install_dir).await?; } + install_lock.unlock()?; + self.on_installed .emit(InstalledEvent { version: self.get_resolved_version(), diff --git a/crates/core/src/tool_manifest.rs b/crates/core/src/tool_manifest.rs index cd7460ce6..9f9c75fff 100644 --- a/crates/core/src/tool_manifest.rs +++ b/crates/core/src/tool_manifest.rs @@ -9,7 +9,7 @@ use std::{ use tracing::{debug, info}; use version_spec::*; -pub(crate) fn now() -> u128 { +fn now() -> u128 { SystemTime::now() .duration_since(SystemTime::UNIX_EPOCH) .map(|d| d.as_millis()) diff --git a/crates/pdk-test-utils/src/macros.rs b/crates/pdk-test-utils/src/macros.rs index 76413f987..c195df2c8 100644 --- a/crates/pdk-test-utils/src/macros.rs +++ b/crates/pdk-test-utils/src/macros.rs @@ -56,9 +56,11 @@ macro_rules! generate_download_install_tests { tool.version = Some(proto_pdk_test_utils::VersionSpec::parse($version).unwrap()); - let temp_dir = tool.get_temp_dir().join($version); + let temp_dir = tool.get_temp_dir(); - tool.install_from_prebuilt(&temp_dir).await.unwrap(); + tool.install_from_prebuilt(&tool.get_tool_dir()) + .await + .unwrap(); assert!(temp_dir.exists()); } diff --git a/plugins/Cargo.lock b/plugins/Cargo.lock index d9431823e..9e58bad47 100644 --- a/plugins/Cargo.lock +++ b/plugins/Cargo.lock @@ -130,13 +130,13 @@ dependencies = [ [[package]] name = "async-trait" -version = "0.1.73" +version = "0.1.74" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "bc00ceb34980c03614e35a3a4e218276a0a824e911d07651cd0d858a51e8c0f0" +checksum = "a66537f1bb974b254c98ed142ff995236e81b9d0fe4db0575f46612cb15eb0f9" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -692,7 +692,7 @@ dependencies = [ "proc-macro2", "quote", "strsim", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -714,7 +714,7 @@ checksum = "836a9bbc7ad63342d6d6e7b815ccab164bc77a2d95d84bc3117a8c0d5c98e2d5" dependencies = [ "darling_core 0.20.3", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -941,7 +941,7 @@ checksum = "d2be216330f7304de051e0faf1578880e9e0dc1ecbd2c0fea5765c63a079d0ba" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1015,9 +1015,9 @@ dependencies = [ [[package]] name = "flate2" -version = "1.0.27" +version = "1.0.28" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "c6c98ee8095e9d1dcbf2fcc6d95acccb90d1c81db1e44725c6a984b1dbdfb010" +checksum = "46303f565772937ffe1d394a4fac6f411c6013172fadde9dcdb1e147a086940e" dependencies = [ "crc32fast", "miniz_oxide", @@ -1091,7 +1091,7 @@ checksum = "89ca545a94061b6365f2c7355b4b32bd20df3ff95f02da9329b34ccc3bd6ee72" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1748,7 +1748,7 @@ checksum = "49e7bc1560b95a3c4a25d03de42fe76ca718ab92d1a22a55b9b4cf67b3ae635c" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -1853,9 +1853,9 @@ checksum = "dd8b5dd2ae5ed71462c540258bedcb51965123ad7e7ccf4b9a8cafaa4a63576d" [[package]] name = "once_map" -version = "0.4.9" +version = "0.4.10" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "0dc08fbf8d1bb5119046009c6a3f3153333f1080b68778e0e1be37c747b97cf5" +checksum = "3388ad2ab0b17d90355995011856a3337e0a98147950f076ee9a73ad5d4a553e" dependencies = [ "ahash", "hashbrown 0.14.2", @@ -2007,9 +2007,9 @@ dependencies = [ [[package]] name = "proc-macro2" -version = "1.0.66" +version = "1.0.69" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "18fb31db3f9bddb2ea821cde30a9f70117e3f119938b5ee630b7403aa6e2ead9" +checksum = "134c189feb4956b20f6f547d2cf727d4c0fe06722b20a0eec87ed445a97f92da" dependencies = [ "unicode-ident", ] @@ -2511,9 +2511,9 @@ dependencies = [ [[package]] name = "serde" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "8e422a44e74ad4001bdc8eede9a4570ab52f71190e9c076d14369f38b9200537" +checksum = "91d3c334ca1ee894a2c6f6ad698fe8c435b76d504b13d436f0685d648d6d96f7" dependencies = [ "serde_derive", ] @@ -2530,13 +2530,13 @@ dependencies = [ [[package]] name = "serde_derive" -version = "1.0.189" +version = "1.0.190" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1e48d1f918009ce3145511378cf68d613e3b3d9137d67272562080d68a2b32d5" +checksum = "67c5609f394e5c2bd7fc51efda478004ea80ef42fee983d5c67a65e34f32c0e3" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2552,9 +2552,9 @@ dependencies = [ [[package]] name = "serde_spanned" -version = "0.6.3" +version = "0.6.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "96426c9936fd7a0124915f9185ea1d20aa9445cc9821142f0a73bc9207a2e186" +checksum = "12022b835073e5b11e90a14f86838ceb1c8fb0325b72416845c487ac0fa95e80" dependencies = [ "serde", ] @@ -2679,9 +2679,9 @@ checksum = "a8f112729512f8e442d81f95a8a7ddf2b7c6b8a1a6f509a95864142b30cab2d3" [[package]] name = "starbase_archive" -version = "0.2.3" +version = "0.2.4" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "67ad85bff80a5ec20265e65a69102eee54ae1e4dac9f977256fbf770c7153fa1" +checksum = "935856c30da2f62a73bcc57eecb5508bedd313287bc0e00e7e7c4b7a07fb5995" dependencies = [ "flate2", "miette", @@ -2693,14 +2693,14 @@ dependencies = [ "tracing", "xz2", "zip", - "zstd 0.12.4", + "zstd 0.13.0", ] [[package]] name = "starbase_events" -version = "0.2.1" +version = "0.2.2" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "5f172a2185991dbfb2a3446c47749ade52d66d2aaea724d19bd45607527ebd9d" +checksum = "455a107aab23fa941399ed716e42776ac8e200f5f92706b7ce59b08949aaf153" dependencies = [ "async-trait", "miette", @@ -2710,14 +2710,14 @@ dependencies = [ [[package]] name = "starbase_macros" -version = "0.2.5" +version = "0.2.7" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "63159597180d00c01353e4bf4d4401328a30eb618c0130adf7b9371db4df3d3a" +checksum = "70da3be1ac772cd1cf5b71a725988b64829da92664b8fc362be765462c28638c" dependencies = [ "darling 0.20.3", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2749,9 +2749,9 @@ dependencies = [ [[package]] name = "starbase_utils" -version = "0.3.4" +version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "87b5dc77ea8ee6706f6485f931653277a4bfe04a2d127727e018b082fbfe52b3" +checksum = "67068d75fcff5d1bd7a67561576c1fd4b4f05ca8b199e7368e92a9a9bc448d65" dependencies = [ "dirs 5.0.1", "fs4", @@ -2765,7 +2765,7 @@ dependencies = [ "starbase_styles", "thiserror", "tokio", - "toml 0.8.2", + "toml 0.8.5", "tracing", "wax", ] @@ -2799,9 +2799,9 @@ dependencies = [ [[package]] name = "syn" -version = "2.0.31" +version = "2.0.38" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "718fa2415bcb8d8bd775917a1bf12a7931b6dfa890753378538118181e0cb398" +checksum = "e96b79aaa137db8f61e26363a0c9b47d8b4ec75da28b7d1d614c2303e232408b" dependencies = [ "proc-macro2", "quote", @@ -2932,7 +2932,7 @@ checksum = "266b2e40bc00e5a6c09c3584011e08b06f123c00362c92b975ba9843aaaa14b8" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -2983,9 +2983,9 @@ checksum = "1f3ccbac311fea05f86f61904b462b55fb3df8837a366dfc601a0161d0532f20" [[package]] name = "tokio" -version = "1.32.0" +version = "1.33.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "17ed6077ed6cd6c74735e21f37eb16dc3935f96878b1fe961074089cc80893f9" +checksum = "4f38200e3ef7995e5ef13baec2f432a6da0aa9ac495b2c0e8f3b7eec2c92d653" dependencies = [ "backtrace", "bytes", @@ -3008,7 +3008,7 @@ checksum = "630bdcf245f78637c13ec01ffae6187cca34625e8c63150d424b59e55af2675e" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3058,21 +3058,21 @@ dependencies = [ [[package]] name = "toml" -version = "0.8.2" +version = "0.8.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "185d8ab0dfbb35cf1399a6344d8484209c088f75f8f68230da55d48d95d43e3d" +checksum = "3efaf127c78d5339cc547cce4e4d973bd5e4f56e949a06d091c082ebeef2f800" dependencies = [ "serde", "serde_spanned", "toml_datetime", - "toml_edit 0.20.2", + "toml_edit 0.20.5", ] [[package]] name = "toml_datetime" -version = "0.6.3" +version = "0.6.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "7cda73e2f1397b1262d6dfdcef8aafae14d1de7748d66822d3bfeeb6d03e5e4b" +checksum = "3550f4e9685620ac18a50ed434eb3aec30db8ba93b0287467bca5826ea25baf1" dependencies = [ "serde", ] @@ -3092,9 +3092,9 @@ dependencies = [ [[package]] name = "toml_edit" -version = "0.20.2" +version = "0.20.5" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "396e4d48bbb2b7554c944bde63101b5ae446cff6ec4a24227428f15eb72ef338" +checksum = "782bf6c2ddf761c1e7855405e8975472acf76f7f36d0d4328bd3b7a2fae12a85" dependencies = [ "indexmap 2.0.0", "serde", @@ -3129,7 +3129,7 @@ checksum = "34704c8d6ebcbc939824180af020566b01a7c01f80641264eba0999f6c2b6be7" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", ] [[package]] @@ -3405,7 +3405,7 @@ dependencies = [ "once_cell", "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "wasm-bindgen-shared", ] @@ -3439,7 +3439,7 @@ checksum = "54681b18a46765f095758388f2d0cf16eb8d4169b639ab575a8f5693af210c7b" dependencies = [ "proc-macro2", "quote", - "syn 2.0.31", + "syn 2.0.38", "wasm-bindgen-backend", "wasm-bindgen-shared", ] @@ -4222,11 +4222,11 @@ dependencies = [ [[package]] name = "zstd" -version = "0.12.4" +version = "0.13.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "1a27595e173641171fc74a1232b7b1c7a7cb6e18222c11e9dfb9888fa424c53c" +checksum = "bffb3309596d527cfcba7dfc6ed6052f1d39dfbd7c867aa2e865e4a449c10110" dependencies = [ - "zstd-safe 6.0.6", + "zstd-safe 7.0.0", ] [[package]] @@ -4241,11 +4241,10 @@ dependencies = [ [[package]] name = "zstd-safe" -version = "6.0.6" +version = "7.0.0" source = "registry+https://github.com/rust-lang/crates.io-index" -checksum = "ee98ffd0b48ee95e6c5168188e44a54550b1564d9d530ee21d5f0eaed1069581" +checksum = "43747c7422e2924c11144d5229878b98180ef8b06cca4ab5af37afc8a8d8ea3e" dependencies = [ - "libc", "zstd-sys", ] diff --git a/plugins/Cargo.toml b/plugins/Cargo.toml index 414bf8076..c7a7e7fc4 100644 --- a/plugins/Cargo.toml +++ b/plugins/Cargo.toml @@ -4,5 +4,5 @@ members = ["wasm-test"] [workspace.dependencies] extism-pdk = "0.3.4" -serde = { version = "1.0.188", features = ["derive"] } -tokio = "1.32.0" +serde = { version = "1.0.190", features = ["derive"] } +tokio = { version = "1.32.0", features = ["full"] }