From c57356e87039c23faa929bd69b1dafed5dfea833 Mon Sep 17 00:00:00 2001 From: Jiahao XU Date: Sat, 12 Aug 2023 17:20:26 +1000 Subject: [PATCH] Refactor: Move mod `git` into `binstalk-downloader` (#1285) To speedup codegen time for `binstalk`, also fixed the docs.rs build for `binstalk-downloader`. Signed-off-by: Jiahao XU --- Cargo.lock | 2 +- crates/binstalk-downloader/Cargo.toml | 6 +++++- .../src/helpers => binstalk-downloader/src}/git.rs | 0 .../src}/git/progress_tracing.rs | 0 crates/binstalk-downloader/src/lib.rs | 3 +++ crates/binstalk/Cargo.toml | 5 ++--- crates/binstalk/src/helpers.rs | 5 +++-- 7 files changed, 14 insertions(+), 7 deletions(-) rename crates/{binstalk/src/helpers => binstalk-downloader/src}/git.rs (100%) rename crates/{binstalk/src/helpers => binstalk-downloader/src}/git/progress_tracing.rs (100%) diff --git a/Cargo.lock b/Cargo.lock index 00823806..52d55f17 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -243,7 +243,6 @@ dependencies = [ "compact_str", "detect-targets", "either", - "gix", "glob", "home", "itertools", @@ -286,6 +285,7 @@ dependencies = [ "flate2", "futures-util", "generic-array", + "gix", "httpdate", "percent-encoding", "quinn 0.10.2", diff --git a/crates/binstalk-downloader/Cargo.toml b/crates/binstalk-downloader/Cargo.toml index 46a27a24..bf54fcdd 100644 --- a/crates/binstalk-downloader/Cargo.toml +++ b/crates/binstalk-downloader/Cargo.toml @@ -20,6 +20,7 @@ compact_str = "0.7.0" flate2 = { version = "1.0.26", default-features = false } futures-util = "0.3.28" generic-array = "0.14.7" +gix = { version = "0.51.0", features = ["blocking-http-transport-reqwest-rust-tls"], optional = true } httpdate = "1.0.2" reqwest = { version = "0.11.18", features = ["stream", "gzip", "brotli", "deflate"], default-features = false } percent-encoding = "2.2.0" @@ -91,6 +92,9 @@ cross-lang-fat-lto = ["zstd/fat-lto"] gh-api-client = ["json"] json = ["serde", "serde_json"] +git = ["dep:gix"] +git-max-perf = ["gix?/max-performance"] + [package.metadata.docs.rs] -all-features = true +features = ["gh-api-client", "git"] rustdoc-args = ["--cfg", "docsrs"] diff --git a/crates/binstalk/src/helpers/git.rs b/crates/binstalk-downloader/src/git.rs similarity index 100% rename from crates/binstalk/src/helpers/git.rs rename to crates/binstalk-downloader/src/git.rs diff --git a/crates/binstalk/src/helpers/git/progress_tracing.rs b/crates/binstalk-downloader/src/git/progress_tracing.rs similarity index 100% rename from crates/binstalk/src/helpers/git/progress_tracing.rs rename to crates/binstalk-downloader/src/git/progress_tracing.rs diff --git a/crates/binstalk-downloader/src/lib.rs b/crates/binstalk-downloader/src/lib.rs index c4a23c84..970cbb12 100644 --- a/crates/binstalk-downloader/src/lib.rs +++ b/crates/binstalk-downloader/src/lib.rs @@ -12,4 +12,7 @@ pub mod gh_api_client; pub mod remote; +#[cfg(feature = "git")] +pub mod git; + mod utils; diff --git a/crates/binstalk/Cargo.toml b/crates/binstalk/Cargo.toml index cc3e0cba..89e2058b 100644 --- a/crates/binstalk/Cargo.toml +++ b/crates/binstalk/Cargo.toml @@ -19,7 +19,6 @@ command-group = { version = "2.1.0", features = ["with-tokio"] } compact_str = { version = "0.7.0", features = ["serde"] } detect-targets = { version = "0.1.10", path = "../detect-targets" } either = "1.8.1" -gix = { version = "0.51.0", features = ["blocking-http-transport-reqwest-rust-tls"], optional = true } glob = "0.3.1" home = "0.5.5" itertools = "0.11.0" @@ -53,8 +52,8 @@ windows = { version = "0.48.0", features = ["Win32_Storage_FileSystem", "Win32_F [features] default = ["static", "rustls", "git"] -git = ["dep:gix"] -git-max-perf = ["gix?/max-performance"] +git = ["binstalk-downloader/git"] +git-max-perf = ["binstalk-downloader/git-max-perf"] static = ["binstalk-downloader/static"] pkg-config = ["binstalk-downloader/pkg-config"] diff --git a/crates/binstalk/src/helpers.rs b/crates/binstalk/src/helpers.rs index fb137fa5..f0b4bdc4 100644 --- a/crates/binstalk/src/helpers.rs +++ b/crates/binstalk/src/helpers.rs @@ -1,7 +1,5 @@ pub(crate) mod cargo_toml_workspace; pub(crate) mod futures_resolver; -#[cfg(feature = "git")] -pub(crate) mod git; pub mod jobserver_client; pub mod remote; pub mod signal; @@ -11,6 +9,9 @@ pub mod tasks; pub use binstalk_downloader::gh_api_client; pub(crate) use binstalk_downloader::{bytes, download}; +#[cfg(feature = "git")] +pub(crate) use binstalk_downloader::git; + pub(crate) fn is_universal_macos(target: &str) -> bool { ["universal-apple-darwin", "universal2-apple-darwin"].contains(&target) }