Skip to content

Commit

Permalink
add --skip-build option for verify command (#2387)
Browse files Browse the repository at this point in the history
  • Loading branch information
pplisd authored Feb 7, 2023
1 parent eef9888 commit 5099044
Show file tree
Hide file tree
Showing 2 changed files with 26 additions and 16 deletions.
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ The minor version will be incremented upon a breaking change and the patch versi
- cli: Add `idl close` command to close a program's IDL account ([#2329](https://github.com/coral-xyz/anchor/pull/2329)).
- cli: `idl init` now supports very large IDL files ([#2329](https://github.com/coral-xyz/anchor/pull/2329)).
- spl: Add `transfer_checked` function ([#2353](https://github.com/coral-xyz/anchor/pull/2353)).
- cli: Add `--skip-build` option to the verify command ([#2387](https://github.com/coral-xyz/anchor/pull/2387)).
- client: Add support for multithreading to the rust client: use flag `--multithreaded` ([#2321](https://github.com/coral-xyz/anchor/pull/2321)).
- client: Add `async_rpc` a method which returns a nonblocking solana rpc client ([2322](https://github.com/coral-xyz/anchor/pull/2322)).

Expand Down
41 changes: 25 additions & 16 deletions cli/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -150,6 +150,10 @@ pub enum Command {
/// Arguments to pass to the underlying `cargo build-bpf` command.
#[clap(required = false, last = true)]
cargo_args: Vec<String>,
/// Flag to skip building the program in the workspace,
/// use this to save time when running verify and the program code is already built.
#[clap(long, required = false)]
skip_build: bool,
},
#[clap(name = "test", alias = "t")]
/// Runs integration tests against a localnetwork.
Expand Down Expand Up @@ -432,6 +436,7 @@ pub fn entry(opts: Opts) -> Result<()> {
bootstrap,
env,
cargo_args,
skip_build,
} => verify(
&opts.cfg_override,
program_id,
Expand All @@ -441,6 +446,7 @@ pub fn entry(opts: Opts) -> Result<()> {
bootstrap,
env,
cargo_args,
skip_build,
),
Command::Clean => clean(&opts.cfg_override),
Command::Deploy {
Expand Down Expand Up @@ -1349,6 +1355,7 @@ fn verify(
bootstrap: BootstrapMode,
env_vars: Vec<String>,
cargo_args: Vec<String>,
skip_build: bool,
) -> Result<()> {
// Change to the workspace member directory, if needed.
if let Some(program_name) = program_name.as_ref() {
Expand All @@ -1361,22 +1368,24 @@ fn verify(

// Build the program we want to verify.
let cur_dir = std::env::current_dir()?;
build(
cfg_override,
None, // idl
None, // idl ts
true, // verifiable
true, // skip lint
None, // program name
solana_version.or_else(|| cfg.solana_version.clone()), // solana version
docker_image, // docker image
bootstrap, // bootstrap docker image
None, // stdout
None, // stderr
env_vars,
cargo_args,
false,
)?;
if !skip_build {
build(
cfg_override,
None, // idl
None, // idl ts
true, // verifiable
true, // skip lint
None, // program name
solana_version.or_else(|| cfg.solana_version.clone()), // solana version
docker_image, // docker image
bootstrap, // bootstrap docker image
None, // stdout
None, // stderr
env_vars,
cargo_args,
false,
)?;
}
std::env::set_current_dir(cur_dir)?;

// Verify binary.
Expand Down

1 comment on commit 5099044

@vercel
Copy link

@vercel vercel bot commented on 5099044 Feb 7, 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-lang.com
anchor-docs-git-master-200ms.vercel.app
anchor-docs-200ms.vercel.app
www.anchor-lang.com

Please sign in to comment.