Use binary name when searching for artifacts (#1747)

* Use binary name when searching for artifacts

When there is a single binary declared in the manifest and
it differs from the package name, add it to the list of handles
used for pre-built artifact fetching.

* Simplify `binary_name` assignment with a `match`

* Add e2e test

* Only attempt to use the binary name with `GhCrateMeta` fetcher

* Avoid too much over-allocating.

Technically it should also check if gh-crate-meta resolver is enabled, but it is unlikely for it to be disabled and overallocating for extra n-target should be fine, it is an improvement over doubling the space allocated if the binary_name is Some.

* Fix fmt in crates/binstalk/src/ops/resolve.rs

---------

Co-authored-by: Jiahao XU <Jiahao_XU@outlook.com>
This commit is contained in:
Tomas Olvecky 2024-06-14 06:52:37 +02:00 committed by GitHub
parent a220952fd6
commit dfa230f039
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
5 changed files with 82 additions and 39 deletions

View file

@ -15,6 +15,8 @@ use crate::{
SignaturePolicy, SignatureVerifier, TargetDataErased, DEFAULT_GH_API_RETRY_DURATION,
};
pub const FETCHER_GH_CRATE_META: &str = "GhCrateMeta";
pub(crate) mod hosting;
pub struct GhCrateMeta {
@ -391,7 +393,7 @@ impl super::Fetcher for GhCrateMeta {
}
fn fetcher_name(&self) -> &'static str {
"GhCrateMeta"
FETCHER_GH_CRATE_META
}
fn is_third_party(&self) -> bool {