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

fix: Copy sp1-helper binary build #1279

Merged
merged 1 commit into from
Aug 7, 2024
Merged
Show file tree
Hide file tree
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
15 changes: 11 additions & 4 deletions build/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -224,18 +224,25 @@ fn copy_elf_to_output_dir(

// The ELF is written to a target folder specified by the program's package. If built with Docker,
// includes /docker after HELPER_TARGET_SUBDIR.
let target_dir_suffix = if args.docker {
format!("{}/{}", HELPER_TARGET_SUBDIR, "docker")
let mut target_dir_suffix = HELPER_TARGET_SUBDIR.to_string();
if args.docker {
target_dir_suffix = format!("{}/{}", HELPER_TARGET_SUBDIR, "docker");
}

// The ELF's file name is the binary name if it's specified. Otherwise, it is the root package
// name.
let original_elf_file_name = if !args.binary.is_empty() {
args.binary.clone()
} else {
HELPER_TARGET_SUBDIR.to_string()
root_package_name.unwrap().clone()
};

let original_elf_path = program_metadata
.target_directory
.join(target_dir_suffix)
.join(BUILD_TARGET)
.join("release")
.join(root_package_name.unwrap());
.join(original_elf_file_name);

// The order of precedence for the ELF name is:
// 1. --elf_name flag
Expand Down
12 changes: 4 additions & 8 deletions helper/src/lib.rs
Original file line number Diff line number Diff line change
Expand Up @@ -61,14 +61,10 @@ fn execute_build_cmd(
}

// Build the program with the given arguments.
let path_output = if let Some(args) = args {
sp1_build::build_program(&args, Some(program_dir.as_ref().to_path_buf()))
} else {
sp1_build::build_program(
&BuildArgs::default(),
Some(program_dir.as_ref().to_path_buf()),
)
};
let path_output = sp1_build::build_program(
&args.unwrap_or_default(),
Some(program_dir.as_ref().to_path_buf()),
);
if let Err(err) = path_output {
panic!("Failed to build SP1 program: {}.", err);
}
Expand Down