@@ -2,26 +2,29 @@ use risc0_build::{DockerOptionsBuilder, GuestOptionsBuilder};
22use std:: collections:: HashMap ;
33use std:: path:: PathBuf ;
44
5- // Reference: https://docs.succinct.xyz/docs/sp1/writing-programs/compiling#advanced-build-options-1
6- fn main ( ) {
7- // This allows us to skip the guest build in CI or local environments where it's not needed (reducing the build time)
8- // Note: To use this flag, the aggregation programs should be already compiled, otherwise the compilation will be done anyway.
5+ // This allows us to skip the guest build in CI or local environments where it's not needed (reducing the build time)
6+ // Note: To use this flag, the aggregation programs should be already compiled, otherwise the compilation will be done anyway.
7+ fn should_skip_build ( ) -> bool {
98 if std:: env:: var ( "SKIP_AGG_PROGRAMS_BUILD" )
109 . map ( |v| v == "1" )
1110 . unwrap_or ( false )
1211 {
1312 let out_dir = std:: env:: var ( "OUT_DIR" ) . unwrap ( ) ;
1413 let methods_path = PathBuf :: from ( out_dir) . join ( "methods.rs" ) ;
1514
16- if methods_path. exists ( ) {
17- println ! ( "cargo:warning=SKIP_AGG_PROGRAMS_BUILD=1: methods.rs already exists, skipping aggregation programs build" ) ;
18- return ;
19- } else {
20- println ! (
21- "cargo:warning=SKIP_AGG_PROGRAMS_BUILD=1 set, but {path} does not exist, running full build" ,
22- path = methods_path. display( )
23- ) ;
24- }
15+ methods_path. exists ( )
16+ } else {
17+ false
18+ }
19+ }
20+
21+ // Reference: https://docs.succinct.xyz/docs/sp1/writing-programs/compiling#advanced-build-options-1
22+ fn main ( ) {
23+ if should_skip_build ( ) {
24+ println ! ( "cargo:warning=SKIP_AGG_PROGRAMS_BUILD=1: methods.rs already exists, skipping aggregation programs build" ) ;
25+ return ;
26+ } else {
27+ println ! ( "cargo:warning=SKIP_AGG_PROGRAMS_BUILD=1 set, but path does not exist, running full build" ) ;
2528 }
2629
2730 sp1_build:: build_program_with_args ( "./aggregation_programs/sp1" , {
0 commit comments