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

@ -8,7 +8,9 @@ unset CARGO_INSTALL_ROOT
# to find versions matching <= 1.3.3
# - `cargo-quickinstall` would test `fetch_crate_cratesio_version_matched` ability
# to find latest stable version.
crates="b3sum@<=1.3.3 cargo-release@0.24.9 cargo-binstall@0.20.1 cargo-watch@8.4.0 miniserve@0.23.0 sccache@0.3.3 cargo-quickinstall jj-cli@0.18.0"
# - `git-mob-tool tests the using of using a binary name (`git-mob`) different
# from the package name.
crates="b3sum@<=1.3.3 cargo-release@0.24.9 cargo-binstall@0.20.1 cargo-watch@8.4.0 miniserve@0.23.0 sccache@0.3.3 cargo-quickinstall jj-cli@0.18.0 git-mob-tool@1.6.1"
CARGO_HOME=$(mktemp -d 2>/dev/null || mktemp -d -t 'cargo-home')
export CARGO_HOME
@ -59,3 +61,8 @@ jj_version="$(jj --version)"
echo "$jj_version"
[ "$jj_version" = "jj 0.18.0-9fb5307b7886e390c02817af7c31b403f0279144" ]
git_mob_version="$(git-mob --version)"
echo "$git_mob_version"
[ "$git_mob_version" = "git-mob-tool 1.6.1" ]