Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: recursive idl gen #2946

Merged
merged 4 commits into from
May 7, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
1 change: 1 addition & 0 deletions idl/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ fn build(program_path: &Path, resolution: bool, no_docs: bool) -> Result<Idl> {
"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())
Expand Down
5 changes: 3 additions & 2 deletions lang/syn/src/idl/external.rs
Original file line number Diff line number Diff line change
Expand Up @@ -17,8 +17,9 @@ pub fn get_external_type(name: &str, path: impl AsRef<Path>) -> Result<Option<sy
.ok_or_else(|| anyhow!("`{name}` not found in use statements"))?;

// Get crate name and version from lock file
let lib_path = find_path("lib.rs", path)?;
let lock_path = find_path("Cargo.lock", lib_path)?;
let program_path =
std::env::var("ANCHOR_IDL_BUILD_PROGRAM_PATH").expect("Failed to get program path");
let lock_path = find_path("Cargo.lock", program_path)?;
let lock_file = parse_lock_file(lock_path)?;
let registry_path = get_registry_path()?;

Expand Down
Loading