Skip to content

Commit

Permalink
Cli: Don't regenerate idl in read_all_programs() (#2332)
Browse files Browse the repository at this point in the history
  • Loading branch information
ckamm committed Dec 23, 2022
1 parent e910d44 commit a97d04a
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 9 deletions.
2 changes: 2 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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)).
Expand Down
16 changes: 7 additions & 9 deletions cli/src/config.rs
Original file line number Diff line number Diff line change
Expand Up @@ -174,20 +174,18 @@ impl WithPath<Config> {
.collect())
}

// TODO: this should read idl dir instead of parsing source.
pub fn read_all_programs(&self) -> Result<Vec<Program>> {
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,
Expand Down

1 comment on commit a97d04a

@vercel
Copy link

@vercel vercel bot commented on a97d04a Dec 23, 2022

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

anchor-docs – ./

anchor-docs-200ms.vercel.app
anchor-docs-git-master-200ms.vercel.app
www.anchor-lang.com
anchor-lang.com

Please sign in to comment.