Fixed compilation of cargo-binstall

Signed-off-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Jiahao XU 2023-10-14 00:11:32 +11:00
parent 6f194aa302
commit 2d980e454b
5 changed files with 16 additions and 5 deletions

View file

@ -9,6 +9,7 @@ use binstalk::{
fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy}, fetchers::{Fetcher, GhCrateMeta, QuickInstall, SignaturePolicy},
get_desired_targets, get_desired_targets,
helpers::{ helpers::{
cacher::HTTPCacher,
gh_api_client::GhApiClient, gh_api_client::GhApiClient,
jobserver_client::LazyJobserverClient, jobserver_client::LazyJobserverClient,
remote::{Certificate, Client}, remote::{Certificate, Client},
@ -157,6 +158,7 @@ pub fn install_crates(
client, client,
gh_api_client, gh_api_client,
cacher: HTTPCacher::default(),
jobserver_client, jobserver_client,
registry: if let Some(index) = args.index { registry: if let Some(index) = args.index {
index index

View file

@ -1,6 +1,6 @@
#![cfg_attr(docsrs, feature(doc_auto_cfg))] #![cfg_attr(docsrs, feature(doc_auto_cfg))]
use std::{borrow::Cow, path::Path, sync::Arc}; use std::{path::Path, sync::Arc};
use binstalk_downloader::{ use binstalk_downloader::{
download::DownloadError, gh_api_client::GhApiError, remote::Error as RemoteError, download::DownloadError, gh_api_client::GhApiError, remote::Error as RemoteError,

View file

@ -4,7 +4,7 @@ pub(crate) mod target_triple;
pub mod tasks; pub mod tasks;
pub(crate) use binstalk_downloader::download; 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}; pub(crate) use cargo_toml_workspace::{self, cargo_toml};
#[cfg(feature = "git")] #[cfg(feature = "git")]

View file

@ -7,7 +7,8 @@ use semver::VersionReq;
use crate::{ use crate::{
fetchers::{Data, Fetcher, SignaturePolicy, TargetDataErased}, fetchers::{Data, Fetcher, SignaturePolicy, TargetDataErased},
helpers::{ 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, manifests::cargo_toml_binstall::PkgOverride,
registry::Registry, registry::Registry,
@ -16,8 +17,14 @@ use crate::{
pub mod resolve; pub mod resolve;
pub type Resolver = pub type Resolver = fn(
fn(Client, GhApiClient, Arc<Data>, Arc<TargetDataErased>, SignaturePolicy) -> Arc<dyn Fetcher>; Client,
GhApiClient,
HTTPCacher,
Arc<Data>,
Arc<TargetDataErased>,
SignaturePolicy,
) -> Arc<dyn Fetcher>;
#[derive(Debug)] #[derive(Debug)]
#[non_exhaustive] #[non_exhaustive]
@ -50,6 +57,7 @@ pub struct Options {
pub client: Client, pub client: Client,
pub gh_api_client: GhApiClient, pub gh_api_client: GhApiClient,
pub cacher: HTTPCacher,
pub jobserver_client: LazyJobserverClient, pub jobserver_client: LazyJobserverClient,
pub registry: Registry, pub registry: Registry,

View file

@ -124,6 +124,7 @@ async fn resolve_inner(
let fetcher = f( let fetcher = f(
opts.client.clone(), opts.client.clone(),
opts.gh_api_client.clone(), opts.gh_api_client.clone(),
opts.cacher.clone(),
data.clone(), data.clone(),
target_data, target_data,
opts.signature_policy, opts.signature_policy,