Skip to content
Closed
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
1 change: 1 addition & 0 deletions noir/.noir-repo.hash
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
dcdb5564d53ea588
1 change: 1 addition & 0 deletions noir/.noir-repo.hash_tests
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
5a2582f95f4f49a9
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can probably get rid of the test distinction imho

36 changes: 23 additions & 13 deletions noir/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -22,28 +22,38 @@ export SOURCE_DATE_EPOCH=0
export GIT_DIRTY=false
export RUSTFLAGS="-Dwarnings"

# A file that contains the latest hash of the noir-repo, so that we can use it
# with `cache_content_hash` to recover a historical hash, which the build uses.
NOIR_REPO_HASH=.noir-repo.hash
NOIR_REPO_HASH_TESTS=.noir-repo.hash_tests

# Calculate the content hash for caching, taking into account that `noir-repo`
# is not part of the `aztec-packages` repo itself, so the `git ls-tree` used
# by `cache_content_hash` would not take those files into account.
function noir_repo_content_hash {
echo $(REPO_PATH=./noir-repo AZTEC_CACHE_COMMIT=HEAD cache_content_hash $@)
}

# Update the noir-repo and compute hashes.
function noir_sync {
# The sync.sh script strives not to send anything to `stdout`, so as not to interfere with `test_cmds` and `hash`.
DENOISE=0 denoise "scripts/sync.sh init && scripts/sync.sh update"
# Write the resulting hashes into the files that we can commit into aztec-packages.
# If the hashes change, then the cache will be disabled until the files are committed.
echo $(noir_repo_content_hash .noir-repo.rebuild_patterns) > .noir-repo.hash
echo $(noir_repo_content_hash .noir-repo.rebuild_patterns .noir-repo.rebuild_patterns_tests) > .noir-repo.hash_tests
}

# Calculate the content hash for caching, taking into account that `noir-repo`
# is not part of the `aztec-packages` repo itself, so the `git ls-tree` used
# by `cache_content_hash` would not take those files into account.
# Get the cache content hash. It should only be based on files committed to `aztec-packages`
# in order to be able to support using `AZTEC_CACHE_COMMIT` for historical queries.
function noir_content_hash {
function noir_repo_content_hash {
echo $(REPO_PATH=./noir-repo cache_content_hash $@)
}
with_tests=${1:-0}
noir_hash=$(cache_content_hash .rebuild_patterns)
noir_repo_hash=$(noir_repo_content_hash .noir-repo.rebuild_patterns)
if [ "$with_tests" == "1" ]; then
noir_repo_hash_tests=$(noir_repo_content_hash .noir-repo.rebuild_patterns_tests)
tests=${1:-0}

if [ "$tests" == "1" ]; then
echo $(cache_content_hash .rebuild_patterns ^noir/.noir-repo.hash)
else
noir_repo_hash_tests=""
echo $(cache_content_hash .rebuild_patterns ^noir/.noir-repo.hash_tests)
fi
echo $(hash_str $noir_hash $noir_repo_hash $noir_repo_hash_tests)
}

# Builds nargo, acvm and profiler binaries.
Expand Down