Refactor: Extract new crate simple-git (#1304)

`binstalk-downloader` contains stuff about http(s) before the
git code is moved into it and now it becomes http and git.

While git indeed uses http stuff, which is why I decided to put
it into binstalk-downloader, it is more than just downloading
since it is stateful (can be cached locally and updated)
where as http is stateless.

Also `binstalk-downloader`'s codegen time now increases
dramatically and it also creates extra dependencies for
binstalk-fetchers, delaying its execution.

The git code also don't use anything from `binstalk-downloader`
at all, it makes sense to be an independent crate.

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-08-19 11:08:55 +10:00 committed by GitHub
parent 20a57a9a9b
commit dc77a1ab93
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
17 changed files with 258 additions and 24 deletions

View file

@ -26,6 +26,7 @@ leon = { version = "2.0.1", path = "../leon" }
maybe-owned = "0.3.4"
miette = "5.9.0"
semver = { version = "1.0.17", features = ["serde"] }
simple-git = { version = "0.0.0", path = "../simple-git", optional = true }
strum = "0.25.0"
target-lexicon = { version = "0.12.11", features = ["std"] }
tempfile = "3.5.0"
@ -37,8 +38,8 @@ url = { version = "2.3.1", features = ["serde"] }
[features]
default = ["static", "rustls", "git"]
git = ["binstalk-registry/git"]
git-max-perf = ["git", "binstalk-downloader/git-max-perf"]
git = ["binstalk-registry/git", "simple-git"]
git-max-perf = ["git", "simple-git/git-max-perf"]
static = ["binstalk-downloader/static"]
pkg-config = ["binstalk-downloader/pkg-config"]

View file

@ -6,9 +6,9 @@ pub mod tasks;
pub(crate) use binstalk_downloader::download;
pub use binstalk_downloader::gh_api_client;
#[cfg(feature = "git")]
pub(crate) use binstalk_downloader::git;
pub(crate) use cargo_toml_workspace::{self, cargo_toml};
#[cfg(feature = "git")]
pub(crate) use simple_git as git;
pub(crate) fn is_universal_macos(target: &str) -> bool {
["universal-apple-darwin", "universal2-apple-darwin"].contains(&target)