Skip to content

Commit ab46aa1

Browse files
Add a compilation flag to avoid recompiling aggregation programs on tests
1 parent e9ae7e5 commit ab46aa1

File tree

2 files changed

+24
-0
lines changed

2 files changed

+24
-0
lines changed

Makefile

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -252,6 +252,9 @@ proof_aggregator_start_dev: is_aggregator_set reset_last_aggregated_block ./aggr
252252
proof_aggregator_start_dev_ethereum_package: is_aggregator_set reset_last_aggregated_block ./aggregation_mode/target/release/proof_aggregator_dev ## Starts proof aggregator with mock proofs (DEV mode) in ethereum package. Parameters: AGGREGATOR=<sp1|risc0>
253253
AGGREGATOR=$(AGGREGATOR) RISC0_DEV_MODE=1 ./aggregation_mode/target/release/proof_aggregator_dev config-files/config-proof-aggregator-mock-ethereum-package.yaml
254254

255+
proof_aggregator_test_without_compiling_agg_programs:
256+
cd aggregation_mode && SKIP_AGG_PROGRAMS_BUILD=1 cargo test -p proof_aggregator --tests -- --nocapture
257+
255258
### All CPU proof aggregator receipts
256259
./aggregation_mode/target/release/proof_aggregator_cpu: $(AGGREGATION_MODE_SOURCES)
257260
AGGREGATOR=$(AGGREGATOR) cargo build --features prove --manifest-path ./aggregation_mode/Cargo.toml --release --bin proof_aggregator_cpu

aggregation_mode/proof_aggregator/build.rs

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,29 @@
11
use risc0_build::{DockerOptionsBuilder, GuestOptionsBuilder};
22
use std::collections::HashMap;
3+
use std::path::PathBuf;
34

45
// Reference: https://docs.succinct.xyz/docs/sp1/writing-programs/compiling#advanced-build-options-1
56
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.
9+
if std::env::var("SKIP_AGG_PROGRAMS_BUILD")
10+
.map(|v| v == "1")
11+
.unwrap_or(false)
12+
{
13+
let out_dir = std::env::var("OUT_DIR").unwrap();
14+
let methods_path = PathBuf::from(out_dir).join("methods.rs");
15+
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+
}
25+
}
26+
627
sp1_build::build_program_with_args("./aggregation_programs/sp1", {
728
sp1_build::BuildArgs {
829
output_directory: Some("./aggregation_programs/sp1/elf".to_string()),

0 commit comments

Comments
 (0)