From 3ad131cfcd19bb370950eed7c335a2330fcb4c6a Mon Sep 17 00:00:00 2001 From: CeciliaZ030 Date: Mon, 1 Apr 2024 23:02:12 +0000 Subject: [PATCH 1/3] added --ignore-rust-version to cargo prove build --- cli/src/build.rs | 37 +++++++++++++++++++++++++++---------- 1 file changed, 27 insertions(+), 10 deletions(-) diff --git a/cli/src/build.rs b/cli/src/build.rs index fe1d984f24..241e2ce8fc 100644 --- a/cli/src/build.rs +++ b/cli/src/build.rs @@ -23,6 +23,12 @@ pub(crate) struct BuildArgs { env = "SP1_DOCKER" )] pub(crate) docker: bool, + #[clap( + long, + action, + help = "Ignore Rust version check.", + )] + pub(crate) ignore_rust_version: bool, } pub fn build_program(args: &BuildArgs) -> Result { @@ -47,16 +53,22 @@ pub fn build_program(args: &BuildArgs) -> Result { exit(1); } + let workspace_root_path = format!("{}:/root/program", metadata.workspace_root); + let mut child_agrs = vec![ + "run", + "--rm", + "-v", + workspace_root_path.as_str(), + image.as_str(), + "prove", + "check", + ]; + if args.ignore_rust_version { + child_agrs.push("--ignore-rust-version"); + } + let mut child = Command::new("docker") - .args([ - "run", - "--rm", - "-v", - format!("{}:/root/program", metadata.workspace_root).as_str(), - image.as_str(), - "prove", - "build", - ]) + .args(&child_agrs) .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn() @@ -92,10 +104,15 @@ pub fn build_program(args: &BuildArgs) -> Result { "panic=abort", ]; + let mut cargo_args = vec!["build", "--release", "--target", build_target, "--locked"]; + if args.ignore_rust_version { + cargo_args.push("--ignore-rust-version"); + } + let result = Command::new("cargo") .env("RUSTUP_TOOLCHAIN", "succinct") .env("CARGO_ENCODED_RUSTFLAGS", rust_flags.join("\x1f")) - .args(["build", "--release", "--target", build_target, "--locked"]) + .args(&cargo_args) .status() .context("Failed to run cargo command.")?; From 2319274721cad08659a9a3eca84e6751867ef213 Mon Sep 17 00:00:00 2001 From: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com> Date: Wed, 3 Apr 2024 22:07:11 -0700 Subject: [PATCH 2/3] Update build.rs --- cli/src/build.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cli/src/build.rs b/cli/src/build.rs index 241e2ce8fc..e99b277dac 100644 --- a/cli/src/build.rs +++ b/cli/src/build.rs @@ -61,7 +61,7 @@ pub fn build_program(args: &BuildArgs) -> Result { workspace_root_path.as_str(), image.as_str(), "prove", - "check", + "build", ]; if args.ignore_rust_version { child_agrs.push("--ignore-rust-version"); From a7be900c77a6697c8174df221cfd9730779c7ef3 Mon Sep 17 00:00:00 2001 From: CeciliaZ030 <45245961+CeciliaZ030@users.noreply.github.com> Date: Thu, 4 Apr 2024 12:59:55 -0700 Subject: [PATCH 3/3] Update build.rs --- cli/src/build.rs | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/cli/src/build.rs b/cli/src/build.rs index e99b277dac..c88e3bf1ec 100644 --- a/cli/src/build.rs +++ b/cli/src/build.rs @@ -54,7 +54,7 @@ pub fn build_program(args: &BuildArgs) -> Result { } let workspace_root_path = format!("{}:/root/program", metadata.workspace_root); - let mut child_agrs = vec![ + let mut child_args = vec![ "run", "--rm", "-v", @@ -64,11 +64,11 @@ pub fn build_program(args: &BuildArgs) -> Result { "build", ]; if args.ignore_rust_version { - child_agrs.push("--ignore-rust-version"); + child_args.push("--ignore-rust-version"); } let mut child = Command::new("docker") - .args(&child_agrs) + .args(&child_args) .stdout(Stdio::piped()) .stderr(Stdio::piped()) .spawn()