diff --git a/crates/bin/src/entry.rs b/crates/bin/src/entry.rs index d38ec5b0f..0e1243dd8 100644 --- a/crates/bin/src/entry.rs +++ b/crates/bin/src/entry.rs @@ -10,6 +10,7 @@ use binstalk::{ fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy}, get_desired_targets, helpers::{ + cacher::HTTPCacher, gh_api_client::GhApiClient, jobserver_client::LazyJobserverClient, remote::{Certificate, Client}, @@ -151,6 +152,7 @@ pub fn install_crates( client, gh_api_client, + cacher: HTTPCacher::default(), jobserver_client, registry: if let Some(index) = args.index { index diff --git a/crates/binstalk-fetchers/src/lib.rs b/crates/binstalk-fetchers/src/lib.rs index 3144d46bc..e7cc7e490 100644 --- a/crates/binstalk-fetchers/src/lib.rs +++ b/crates/binstalk-fetchers/src/lib.rs @@ -1,6 +1,6 @@ #![cfg_attr(docsrs, feature(doc_auto_cfg))] -use std::{borrow::Cow, path::Path, sync::Arc}; +use std::{path::Path, sync::Arc}; use binstalk_downloader::{ download::DownloadError, gh_api_client::GhApiError, remote::Error as RemoteError, diff --git a/crates/binstalk/src/helpers.rs b/crates/binstalk/src/helpers.rs index 058813de7..91cce4e56 100644 --- a/crates/binstalk/src/helpers.rs +++ b/crates/binstalk/src/helpers.rs @@ -4,7 +4,7 @@ pub(crate) mod target_triple; pub mod tasks; pub(crate) use binstalk_downloader::download; -pub use binstalk_downloader::gh_api_client; +pub use binstalk_downloader::{cacher, gh_api_client}; pub(crate) use cargo_toml_workspace::{self, cargo_toml}; #[cfg(feature = "git")] diff --git a/crates/binstalk/src/ops.rs b/crates/binstalk/src/ops.rs index 2124c14e3..18cd26b4b 100644 --- a/crates/binstalk/src/ops.rs +++ b/crates/binstalk/src/ops.rs @@ -7,7 +7,8 @@ use semver::VersionReq; use crate::{ fetchers::{Data, Fetcher, SignaturePolicy, TargetDataErased}, helpers::{ - self, gh_api_client::GhApiClient, jobserver_client::LazyJobserverClient, remote::Client, + self, cacher::HTTPCacher, gh_api_client::GhApiClient, + jobserver_client::LazyJobserverClient, remote::Client, }, manifests::cargo_toml_binstall::PkgOverride, registry::Registry, @@ -16,8 +17,14 @@ use crate::{ pub mod resolve; -pub type Resolver = - fn(Client, GhApiClient, Arc, Arc, SignaturePolicy) -> Arc; +pub type Resolver = fn( + Client, + GhApiClient, + HTTPCacher, + Arc, + Arc, + SignaturePolicy, +) -> Arc; #[derive(Debug)] #[non_exhaustive] @@ -50,6 +57,7 @@ pub struct Options { pub client: Client, pub gh_api_client: GhApiClient, + pub cacher: HTTPCacher, pub jobserver_client: LazyJobserverClient, pub registry: Registry, diff --git a/crates/binstalk/src/ops/resolve.rs b/crates/binstalk/src/ops/resolve.rs index f19c96c97..ed459eb81 100644 --- a/crates/binstalk/src/ops/resolve.rs +++ b/crates/binstalk/src/ops/resolve.rs @@ -124,6 +124,7 @@ async fn resolve_inner( let fetcher = f( opts.client.clone(), opts.gh_api_client.clone(), + opts.cacher.clone(), data.clone(), target_data, opts.signature_policy,