Skip to content

Commit

Permalink
Refactored options creation for better reuse
Browse files Browse the repository at this point in the history
Closes: #480
  • Loading branch information
awelc authored and bors-diem committed Mar 21, 2023
1 parent 725168d commit 53d46a9
Showing 1 changed file with 10 additions and 9 deletions.
19 changes: 10 additions & 9 deletions language/tools/move-cli/src/base/prove.rs
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,15 @@ impl Prove {
Some(ProverOptions::Options(opts)) => opts,
_ => vec![],
};
run_move_prover(config, &rerooted_path, &target_filter, for_test, &opts)
let mut args = vec!["package".to_string()];
let prover_toml = Path::new(&rerooted_path).join("Prover.toml");
if prover_toml.exists() {
args.push(format!("--config={}", prover_toml.to_string_lossy()));
}
args.extend(opts.iter().cloned());
let options = move_prover::cli::Options::create_from_args(&args)?;

run_move_prover(config, &rerooted_path, &target_filter, for_test, options)
}
}

Expand Down Expand Up @@ -146,18 +154,11 @@ pub fn run_move_prover(
path: &Path,
target_filter: &Option<String>,
for_test: bool,
options: &[String],
mut options: move_prover::cli::Options,
) -> anyhow::Result<()> {
// Always run the prover in dev mode, so addresses get default assignments
config.dev_mode = true;

let mut args = vec!["package".to_string()];
let prover_toml = Path::new(&path).join("Prover.toml");
if prover_toml.exists() {
args.push(format!("--config={}", prover_toml.to_string_lossy()));
}
args.extend(options.iter().cloned());
let mut options = move_prover::cli::Options::create_from_args(&args)?;
if !options.move_sources.is_empty() {
bail!(
"move prover options must not specify sources as those are given \
Expand Down

0 comments on commit 53d46a9

Please sign in to comment.