Merge rust-bitcoin/rust-bitcoin#3765: contrib: check if the user has cargo-public-api

f01f071751 api: document the need of cargo nightly (Jose Storopoli)
ff67eadc7f contributing: clarify API changes (Jose Storopoli)
04852958b9 contrib: check if the user has cargo-public-api (Jose Storopoli)

Pull request description:

  Closes #3764.

  yancyribbens can you test it locally? It works in my end both with and without `cargo-public-api`. Of course without gives the error message that I was supposed to see.

  EDIT: You can run it with `just check-api`.

ACKs for top commit:
  apoelstra:
    ACK f01f071751332bb6aa8b9affa4677f913035de7f; successfully ran local tests
  tcharding:
    ACK f01f071751

Tree-SHA512: 7acf8332731191de47afc02e24c151bc53c1f38685217eccbea1b64c216674f31729ba703e132765cba67183dff95757aa949d653c5cbe538240371c2db52c14
This commit is contained in:
merge-script 2024-12-16 23:53:49 +00:00
commit d2c9fab460
No known key found for this signature in database
GPG Key ID: C588D63CE41B97C1
3 changed files with 12 additions and 1 deletions

View File

@ -157,6 +157,9 @@ running `just check-api`.
- `primitives`
- `units`
Check the [API text files](api/README.md) for more information
on how to install the dependencies and create the text files.
### Repository maintainers
Pull request merge requirements:

View File

@ -6,7 +6,7 @@ enabled. To create these files run `../contrib/check-for-api-changes.sh`:
Requires `cargo-public-api`, install with:
```
cargo +stable install cargo-public-api --locked
cargo +nightly install cargo-public-api --locked
```
ref: https://github.com/enselic/cargo-public-api

View File

@ -22,6 +22,7 @@ export LC_ALL=C
main() {
need_nightly
need_cargo_public_api
generate_api_files "hashes"
generate_api_files "io"
@ -81,6 +82,13 @@ need_nightly() {
fi
}
need_cargo_public_api() {
if command -v cargo-public-api > /dev/null; then
return
fi
err "cargo-public-api is not installed; please run 'cargo +nightly install cargo-public-api --locked'"
}
err() {
echo "$1" >&2
exit 1