Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

feat: added --ignore-rust-version to cargo prove build #462

Merged
merged 3 commits into from
Apr 18, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
37 changes: 27 additions & 10 deletions cli/src/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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<Utf8PathBuf> {
Expand All @@ -47,16 +53,22 @@ pub fn build_program(args: &BuildArgs) -> Result<Utf8PathBuf> {
exit(1);
}

let workspace_root_path = format!("{}:/root/program", metadata.workspace_root);
let mut child_args = vec![
"run",
"--rm",
"-v",
workspace_root_path.as_str(),
image.as_str(),
"prove",
"build",
];
if args.ignore_rust_version {
child_args.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_args)
.stdout(Stdio::piped())
.stderr(Stdio::piped())
.spawn()
Expand Down Expand Up @@ -92,10 +104,15 @@ pub fn build_program(args: &BuildArgs) -> Result<Utf8PathBuf> {
"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.")?;

Expand Down
Loading