diff --git a/Makefile b/Makefile index 79de2fa421a5..14183d261028 100644 --- a/Makefile +++ b/Makefile @@ -47,7 +47,7 @@ endef # PHONY TARGETS - List every target that has a file/dir of the same name. #============================================================================== -.PHONY: noir barretenberg noir-projects l1-contracts release-image boxes playground docs aztec-up spartan +.PHONY: noir barretenberg noir-projects noir-projects-deps l1-contracts release-image boxes playground docs aztec-up spartan #============================================================================== # BOOTSTRAP TARGETS @@ -284,19 +284,26 @@ claude-tests: # Noir Projects #============================================================================== -noir-protocol-circuits: noir bb-cpp-native +# Serial pre-step that caches the shared `noir-lang/*` git dependencies into +# ~/.nargo/. Without this, the four noir-projects targets below race on the +# same cache and one of the parallel `nargo` invocations can fail (e.g. with +# a "Could not resolve host" git clone error) before the others populate it. +noir-projects-deps: noir + $(call run_command,$@,$(ROOT)/noir-projects,$(ROOT)/ci3/denoise './bootstrap.sh prep') + +noir-protocol-circuits: noir bb-cpp-native noir-projects-deps $(call build,$@,noir-projects/noir-protocol-circuits) noir-protocol-circuits-tests: noir noir-protocol-circuits $(call test,$@,noir-projects/noir-protocol-circuits) -mock-protocol-circuits: noir bb-cpp-native +mock-protocol-circuits: noir bb-cpp-native noir-projects-deps $(call build,$@,noir-projects/mock-protocol-circuits) -noir-contracts: noir bb-cpp-native +noir-contracts: noir bb-cpp-native noir-projects-deps $(call build,$@,noir-projects/noir-contracts) -aztec-nr: noir bb-cpp-native +aztec-nr: noir bb-cpp-native noir-projects-deps $(call build,$@,noir-projects/aztec-nr) # These tests are not included in the dep tree. diff --git a/noir-projects/bootstrap.sh b/noir-projects/bootstrap.sh index 006f75495900..098a8d7469c7 100755 --- a/noir-projects/bootstrap.sh +++ b/noir-projects/bootstrap.sh @@ -1,21 +1,23 @@ #!/usr/bin/env bash source $(git rev-parse --show-toplevel)/ci3/source_bootstrap +# Use fmt as a trick to download dependencies. +# Otherwise parallel runs of nargo will trip over each other trying to download dependencies. +# Also doubles up as our formatting check. +# Exposed as a top-level command so the root Makefile can run it as a serial barrier +# before the parallel noir-projects sub-builds. +function prep { + set -eu + (cd noir-protocol-circuits && yarn && node ./scripts/generate_variants.js) + for dir in noir-contracts noir-protocol-circuits mock-protocol-circuits aztec-nr; do + (cd $dir && ../../noir/noir-repo/target/release/nargo fmt --check) + done +} +export -f prep + function build { echo_header "noir-projects build" - # Use fmt as a trick to download dependencies. - # Otherwise parallel runs of nargo will trip over each other trying to download dependencies. - # Also doubles up as our formatting check. - function prep { - set -eu - (cd noir-protocol-circuits && yarn && node ./scripts/generate_variants.js) - for dir in noir-contracts noir-protocol-circuits mock-protocol-circuits aztec-nr; do - (cd $dir && ../../noir/noir-repo/target/release/nargo fmt --check) - done - } - export -f prep - denoise prep parallel --tag --line-buffered --joblog joblog.txt --halt now,fail=1 denoise "'./{}/bootstrap.sh $cmd'" ::: \