From e08a583cba0d69de43d2bee21036e72b880080f0 Mon Sep 17 00:00:00 2001 From: Christian Kamm Date: Thu, 14 Jul 2022 09:57:44 +0200 Subject: [PATCH] Don't regenerate idl in read_all_programs() --- cli/src/config.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/cli/src/config.rs b/cli/src/config.rs index 6a8c0aec..ee584cb6 100644 --- a/cli/src/config.rs +++ b/cli/src/config.rs @@ -171,19 +171,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, - )?; + + 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,