Hide benchmarking CLI behind the feature flag (#5600)

* Hide benchmarking CLI behind the feature flag

* Add a message
This commit is contained in:
Stanislav Tkach
2020-04-09 19:50:47 +03:00
committed by GitHub
parent ac9a852028
commit effc9bae92
2 changed files with 12 additions and 3 deletions
+4 -1
View File
@@ -149,7 +149,10 @@ cli = [
"structopt",
"substrate-build-script-utils",
]
runtime-benchmarks = [ "node-runtime/runtime-benchmarks" ]
runtime-benchmarks = [
"node-runtime/runtime-benchmarks",
"frame-benchmarking-cli",
]
[package.metadata.docs.rs]
targets = ["x86_64-unknown-linux-gnu"]
+8 -2
View File
@@ -80,9 +80,15 @@ pub fn run() -> Result<()> {
runner.sync_run(|config| cmd.run::<Block, RuntimeApi, Executor>(config))
}
Some(Subcommand::Benchmark(cmd)) => {
let runner = cli.create_runner(cmd)?;
if cfg!(feature = "runtime-benchmarks") {
let runner = cli.create_runner(cmd)?;
runner.sync_run(|config| cmd.run::<Block, Executor>(config))
runner.sync_run(|config| cmd.run::<Block, Executor>(config))
} else {
println!("Benchmarking wasn't enabled when building the node. \
You can enable it with `--features runtime-benchmarks`.");
Ok(())
}
}
Some(Subcommand::Factory(cmd)) => {
let runner = cli.create_runner(cmd)?;