From 398763a1718365ce944ef339f3e9ad8cd816521d Mon Sep 17 00:00:00 2001 From: daimond113 Date: Sat, 26 Apr 2025 19:31:05 +0200 Subject: [PATCH] fix: download engines eagerly Previously, to download an engine pesde would require its linker to be executed. This caused issues if called concurrently, such as with scripts & required the user to manually execute the engine before usage. This change makes it so it is downloaded in the install step before any scripts which solves the issue. --- CHANGELOG.md | 3 + Cargo.lock | 58 +++++++++- Cargo.toml | 2 +- docs/src/content/docs/guides/engines.mdx | 11 +- src/cli/commands/init.rs | 4 +- src/cli/commands/self_upgrade.rs | 24 +++-- src/cli/install.rs | 87 ++++++++------- src/cli/version.rs | 132 +++++++++++------------ src/download_and_link.rs | 6 +- src/engine/source/archive.rs | 84 +++++++-------- src/linking/incremental.rs | 4 +- src/main.rs | 4 +- 12 files changed, 240 insertions(+), 179 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 1b5cb88..8691102 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,9 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0 ### Added - Add dev only installs in #32 by @Stefanuk12 +### Fixed +- Download engines in install step rather than lazily by @daimond113 + ### Performance - Remove unnecessary `Arc`s from codebase by @daimond113 diff --git a/Cargo.lock b/Cargo.lock index 1c4d4b4..0642c81 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -259,6 +259,12 @@ dependencies = [ "memchr", ] +[[package]] +name = "aliasable" +version = "0.1.3" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "250f629c0161ad8107cf89319e990051fae62832fd343083bea452d93e2205fd" + [[package]] name = "alloc-no-stdlib" version = "2.0.4" @@ -773,7 +779,7 @@ version = "4.5.32" source = "registry+https://github.com/rust-lang/crates.io-index" checksum = "09176aae279615badda0765c0c0b3f6ed53f4709118af73cf4655d85d1530cd7" dependencies = [ - "heck", + "heck 0.5.0", "proc-macro2", "quote", "syn 2.0.100", @@ -2421,6 +2427,12 @@ dependencies = [ "foldhash", ] +[[package]] +name = "heck" +version = "0.4.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "95505c38b4572b2d910cecb0281560f54b440a19336cbbcb27bf6ce6adc6f5a8" + [[package]] name = "heck" version = "0.5.0" @@ -3448,6 +3460,30 @@ dependencies = [ "windows-sys 0.52.0", ] +[[package]] +name = "ouroboros" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "1e0f050db9c44b97a94723127e6be766ac5c340c48f2c4bb3ffa11713744be59" +dependencies = [ + "aliasable", + "ouroboros_macro", + "static_assertions", +] + +[[package]] +name = "ouroboros_macro" +version = "0.18.5" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "3c7028bdd3d43083f6d8d4d5187680d0d3560d54df4cc9d752005268b41e64d0" +dependencies = [ + "heck 0.4.1", + "proc-macro2", + "proc-macro2-diagnostics", + "quote", + "syn 2.0.100", +] + [[package]] name = "overload" version = "0.1.1" @@ -3531,6 +3567,7 @@ dependencies = [ "jiff", "keyring", "open", + "ouroboros", "paste", "pathdiff", "relative-path", @@ -3726,6 +3763,19 @@ dependencies = [ "unicode-ident", ] +[[package]] +name = "proc-macro2-diagnostics" +version = "0.10.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "af066a9c399a26e020ada66a034357a868728e72cd426f3adcd35f80d88d88c8" +dependencies = [ + "proc-macro2", + "quote", + "syn 2.0.100", + "version_check", + "yansi", +] + [[package]] name = "prodash" version = "29.0.2" @@ -5921,6 +5971,12 @@ dependencies = [ "windows-sys 0.59.0", ] +[[package]] +name = "yansi" +version = "1.0.1" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "cfe53a6657fd280eaa890a3bc59152892ffa3e30101319d168b781ed6529b049" + [[package]] name = "yoke" version = "0.7.5" diff --git a/Cargo.toml b/Cargo.toml index 64d7e76..4b76c61 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -69,6 +69,7 @@ wax = { version = "0.6.0", default-features = false } fs-err = { version = "3.1.0", features = ["tokio"] } urlencoding = "2.1.3" async_zip = { version = "0.0.17", features = ["tokio", "deflate", "deflate64", "tokio-fs"] } +ouroboros = "0.18.5" # TODO: remove this when gitoxide adds support for: committing, pushing, adding git2 = { version = "0.20.1", optional = true } @@ -189,7 +190,6 @@ needless_collect = "deny" needless_bitwise_bool = "deny" mut_mut = "deny" must_use_candidate = "warn" -mem_forget = "deny" maybe_infinite_iter = "deny" match_wildcard_for_single_variants = "deny" match_bool = "warn" diff --git a/docs/src/content/docs/guides/engines.mdx b/docs/src/content/docs/guides/engines.mdx index 8c472ec..b4c0f5d 100644 --- a/docs/src/content/docs/guides/engines.mdx +++ b/docs/src/content/docs/guides/engines.mdx @@ -20,16 +20,7 @@ lune = "^0.8.9" ``` After you add the engines to your manifest run `pesde install` to set up the -necessary files in pesde's bin directory. Then, you should execute the engine to -ensure it is properly downloaded & setup. - -```sh -lune -``` - -This is only required if you're installing the version for the first time, or if -this is a requirement which none of your local installations of the engine -fulfill. After doing so you can start using the engine as normal. +necessary files in pesde's bin directory.