cli: add --skip-build flag to publish command (#1841)
This commit is contained in:
parent
e6155dbc7d
commit
a298bcd650
|
@ -12,6 +12,8 @@ The minor version will be incremented upon a breaking change and the patch versi
|
||||||
|
|
||||||
### Features
|
### Features
|
||||||
|
|
||||||
|
* cli: Add `--skip-build` to `anchor publish` ([#1786](https://github.
|
||||||
|
com/project-serum/anchor/pull/1841)).
|
||||||
* cli: Add `--program-keypair` to `anchor deploy` ([#1786](https://github.com/project-serum/anchor/pull/1786)).
|
* cli: Add `--program-keypair` to `anchor deploy` ([#1786](https://github.com/project-serum/anchor/pull/1786)).
|
||||||
* spl: Add more derived traits to `TokenAccount` to `Mint` ([#1818](https://github.com/project-serum/anchor/pull/1818)).
|
* spl: Add more derived traits to `TokenAccount` to `Mint` ([#1818](https://github.com/project-serum/anchor/pull/1818)).
|
||||||
* cli: Add compilation optimizations to cli template ([#1807](https://github.com/project-serum/anchor/pull/1807)).
|
* cli: Add compilation optimizations to cli template ([#1807](https://github.com/project-serum/anchor/pull/1807)).
|
||||||
|
|
|
@ -258,6 +258,10 @@ pub enum Command {
|
||||||
last = true
|
last = true
|
||||||
)]
|
)]
|
||||||
cargo_args: Vec<String>,
|
cargo_args: Vec<String>,
|
||||||
|
/// Flag to skip building the program in the workspace,
|
||||||
|
/// use this to save time when publishing the program
|
||||||
|
#[clap(long)]
|
||||||
|
skip_build: bool,
|
||||||
},
|
},
|
||||||
/// Keypair commands.
|
/// Keypair commands.
|
||||||
Keys {
|
Keys {
|
||||||
|
@ -470,7 +474,8 @@ pub fn entry(opts: Opts) -> Result<()> {
|
||||||
Command::Publish {
|
Command::Publish {
|
||||||
program,
|
program,
|
||||||
cargo_args,
|
cargo_args,
|
||||||
} => publish(&opts.cfg_override, program, cargo_args),
|
skip_build,
|
||||||
|
} => publish(&opts.cfg_override, program, cargo_args, skip_build),
|
||||||
Command::Keys { subcmd } => keys(&opts.cfg_override, subcmd),
|
Command::Keys { subcmd } => keys(&opts.cfg_override, subcmd),
|
||||||
Command::Localnet {
|
Command::Localnet {
|
||||||
skip_build,
|
skip_build,
|
||||||
|
@ -2845,6 +2850,7 @@ fn publish(
|
||||||
cfg_override: &ConfigOverride,
|
cfg_override: &ConfigOverride,
|
||||||
program_name: String,
|
program_name: String,
|
||||||
cargo_args: Vec<String>,
|
cargo_args: Vec<String>,
|
||||||
|
skip_build: bool,
|
||||||
) -> Result<()> {
|
) -> Result<()> {
|
||||||
// Discover the various workspace configs.
|
// Discover the various workspace configs.
|
||||||
let cfg = Config::discover(cfg_override)?.expect("Not in workspace.");
|
let cfg = Config::discover(cfg_override)?.expect("Not in workspace.");
|
||||||
|
@ -2956,6 +2962,7 @@ fn publish(
|
||||||
unpack_archive(&tarball_filename)?;
|
unpack_archive(&tarball_filename)?;
|
||||||
|
|
||||||
// Build the program before sending it to the server.
|
// Build the program before sending it to the server.
|
||||||
|
if !skip_build {
|
||||||
build(
|
build(
|
||||||
cfg_override,
|
cfg_override,
|
||||||
None,
|
None,
|
||||||
|
@ -2971,9 +2978,7 @@ fn publish(
|
||||||
cargo_args,
|
cargo_args,
|
||||||
true,
|
true,
|
||||||
)?;
|
)?;
|
||||||
|
}
|
||||||
// Success. Now we can finally upload to the server without worrying
|
|
||||||
// about a build failure.
|
|
||||||
|
|
||||||
// Upload the tarball to the server.
|
// Upload the tarball to the server.
|
||||||
let token = registry_api_token(cfg_override)?;
|
let token = registry_api_token(cfg_override)?;
|
||||||
|
|
Loading…
Reference in New Issue