diff --git a/CHANGELOG.md b/CHANGELOG.md index 8db7abd745..6e5a2f57d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -23,6 +23,7 @@ The minor version will be incremented upon a breaking change and the patch versi - ts: Fix incorrect `maxSupportedTransactionVersion` in `AnchorProvider.send*()` methods ([#2922](https://github.com/coral-xyz/anchor/pull/2922)). - cli: Use npm's configured default license for new projects made with `anchor init` ([#2929](https://github.com/coral-xyz/anchor/pull/2929)). - cli: add filename to 'Unable to read keypair file' errors ([#2932](https://github.com/coral-xyz/anchor/pull/2932)). +- idl: Fix path resolution of the `Cargo.lock` of the project when generating idls for external types ([#2946](https://github.com/coral-xyz/anchor/pull/2946)). ### Breaking diff --git a/idl/src/build.rs b/idl/src/build.rs index 3fa12e369e..a67e8d7a36 100644 --- a/idl/src/build.rs +++ b/idl/src/build.rs @@ -95,6 +95,7 @@ fn build(program_path: &Path, resolution: bool, no_docs: bool) -> Result { "ANCHOR_IDL_BUILD_RESOLUTION", if resolution { "TRUE" } else { "FALSE" }, ) + .env("ANCHOR_IDL_BUILD_PROGRAM_PATH", program_path) .env("RUSTFLAGS", "--cfg procmacro2_semver_exempt") .current_dir(program_path) .stderr(Stdio::inherit()) diff --git a/lang/syn/src/idl/external.rs b/lang/syn/src/idl/external.rs index 2b8b48f4c6..414b6fe537 100644 --- a/lang/syn/src/idl/external.rs +++ b/lang/syn/src/idl/external.rs @@ -17,8 +17,9 @@ pub fn get_external_type(name: &str, path: impl AsRef) -> Result