cli: Warn if `anchor-spl/idl-build` is missing (#3133)
This commit is contained in:
parent
fb7ea68c0d
commit
895f01865a
|
@ -27,6 +27,7 @@ The minor version will be incremented upon a breaking change and the patch versi
|
|||
- client: Support non-8-byte discriminators ([#3125](https://github.com/coral-xyz/anchor/pull/3125)).
|
||||
- spl: Add `withdraw_withheld_tokens_from_accounts` instruction ([#3128]([https://github.com/coral-xyz/anchor/pull/3128)).
|
||||
- ts: Add optional `wallet` property to the `Provider` interface ([#3130](https://github.com/coral-xyz/anchor/pull/3130)).
|
||||
- cli: Warn if `anchor-spl/idl-build` is missing ([#3133](https://github.com/coral-xyz/anchor/pull/3133)).
|
||||
|
||||
### Fixes
|
||||
|
||||
|
|
|
@ -85,7 +85,10 @@ pub fn check_anchor_version(cfg: &WithPath<Config>) -> Result<()> {
|
|||
///
|
||||
/// **Note:** The check expects the current directory to be a program directory.
|
||||
pub fn check_idl_build_feature() -> Result<()> {
|
||||
Manifest::from_path("Cargo.toml")?
|
||||
let manifest = Manifest::from_path("Cargo.toml")?;
|
||||
|
||||
// Check if `idl-build` is enabled by default
|
||||
manifest
|
||||
.dependencies
|
||||
.iter()
|
||||
.filter(|(_, dep)| dep.req_features().contains(&"idl-build".into()))
|
||||
|
@ -100,5 +103,22 @@ pub fn check_idl_build_feature() -> Result<()> {
|
|||
)
|
||||
});
|
||||
|
||||
// Check `anchor-spl`'s `idl-build` feature
|
||||
manifest
|
||||
.dependencies
|
||||
.get("anchor-spl")
|
||||
.and_then(|_| manifest.features.get("idl-build"))
|
||||
.map(|feature_list| !feature_list.contains(&"anchor-spl/idl-build".into()))
|
||||
.unwrap_or_default()
|
||||
.then(|| {
|
||||
eprintln!(
|
||||
"WARNING: `idl-build` feature of `anchor-spl` is not enabled. \
|
||||
This is likely to result in cryptic compile errors.\n\n\t\
|
||||
To solve, add `anchor-spl/idl-build` to the `idl-build` feature list:\n\n\t\
|
||||
[features]\n\t\
|
||||
idl-build = [\"anchor-spl/idl-build\", ...]\n"
|
||||
)
|
||||
});
|
||||
|
||||
Ok(())
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue