From a97d04ab06de637cd8f69963b9aa497e77c945b2 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Fri, 23 Dec 2022 14:28:35 +0100 Subject: [PATCH] Cli: Don't regenerate idl in read_all_programs() (#2332) --- CHANGELOG.md | 2 ++ cli/src/config.rs | 16 +++++++--------- 2 files changed, 9 insertions(+), 9 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 602465d7..0c03d062 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -16,6 +16,8 @@ The minor version will be incremented upon a breaking change and the patch versi ### Fixes +- cli: Don't regenerate idl in read_all_programs(). ([#2332](https://github.com/coral-xyz/anchor/pull/2332)) + ### Breaking - lang: Remove `state` and `interface` attributes ([#2285](https://github.com/coral-xyz/anchor/pull/2285)). diff --git a/cli/src/config.rs b/cli/src/config.rs index dec473c3..abeee873 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -174,20 +174,18 @@ impl WithPath { .collect()) } - // TODO: this should read idl dir instead of parsing source. pub fn read_all_programs(&self) -> Result> { let mut r = vec![]; for path in self.get_program_list()? { let cargo = Manifest::from_path(&path.join("Cargo.toml"))?; let lib_name = cargo.lib_name()?; - let version = cargo.version(); - let idl = anchor_syn::idl::file::parse( - path.join("src/lib.rs"), - version, - self.features.seeds, - false, - false, - )?; + + let idl_filepath = format!("target/idl/{}.json", lib_name); + let idl = fs::read(idl_filepath) + .ok() + .map(|bytes| serde_json::from_reader(&*bytes)) + .transpose()?; + r.push(Program { lib_name, path,