Skip to content

Commit

Permalink
avm: Install from version-commit and refactor (#2671)
Browse files Browse the repository at this point in the history
  • Loading branch information
acheroncrypto authored Oct 15, 2023
1 parent 4f996d0 commit 88a75af
Show file tree
Hide file tree
Showing 5 changed files with 162 additions and 151 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- cli: Add `test.upgradeable`, `test.genesis.upgradeable` setting in anchor.toml to support testing upgradeable programs ([#2641](https://github.com/coral-xyz/anchor/pull/2642)).
- cli, client, lang, spl: Update Solana toolchain and dependencies to `1.17.0`, `1.16` remains supported ([#2645](https://github.com/coral-xyz/anchor/pull/2645)).
- spl: Add support for memo program ([#2661](https://github.com/coral-xyz/anchor/pull/2661)).
- avm: Add `anchor-cli` installation from commit ([#2659](https://github.com/coral-xyz/anchor/pull/2659)).
- cli: Add `toolchain` property in `Anchor.toml` to override Anchor and Solana versions ([#2649](https://github.com/coral-xyz/anchor/pull/2649)).

### Fixes
Expand Down
2 changes: 1 addition & 1 deletion avm/Cargo.toml
Original file line number Diff line number Diff line change
Expand Up @@ -15,11 +15,11 @@ path = "src/anchor/main.rs"
[dependencies]
anyhow = "1.0.32"
cfg-if = "1.0.0"
cargo_toml = "0.15.3"
clap = { version = "4.2.4", features = ["derive"] }
dirs = "4.0.0"
once_cell = "1.8.0"
reqwest = { version = "0.11.9", default-features = false, features = ["blocking", "json", "rustls-tls"] }
semver = "1.0.4"
serde = { version = "1.0.136", features = ["derive"] }
tempfile = "3.3.0"
cargo_toml = "0.15.3"
5 changes: 3 additions & 2 deletions avm/src/anchor/main.rs
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
use std::{env, fs, process::Command};
use std::{env, process::Command};

fn main() -> anyhow::Result<()> {
let args = env::args().skip(1).collect::<Vec<String>>();
Expand All @@ -7,13 +7,14 @@ fn main() -> anyhow::Result<()> {
.map_err(|_e| anyhow::anyhow!("Anchor version not set. Please run `avm use latest`."))?;

let binary_path = avm::version_binary_path(&version);
if fs::metadata(&binary_path).is_err() {
if !binary_path.exists() {
anyhow::bail!(
"anchor-cli {} not installed. Please run `avm use {}`.",
version,
version
);
}

let exit = Command::new(binary_path)
.args(args)
.spawn()?
Expand Down
Loading

1 comment on commit 88a75af

@vercel
Copy link

@vercel vercel bot commented on 88a75af Oct 15, 2023

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-lang.com
www.anchor-lang.com
anchor-docs-git-master-200ms.vercel.app

Please sign in to comment.