Skip to content
Open
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
10 changes: 5 additions & 5 deletions avm-transpiler/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,13 +13,13 @@ function build_native {
echo_header "avm-transpiler build_native"
artifact=avm-transpiler-$hash.tar.gz
if ! cache_download $artifact; then
# Serialize cargo/rustup operations to avoid race conditions when running parallel builds
# Cargo may trigger rustup to install components (rust-src, etc.) in shared directories
# Serialize cargo/rustup operations to avoid race conditions with noir build
# which may run in parallel and share the same RUSTUP_HOME/CARGO_HOME.
(
flock -x 200
denoise "cargo build --release --locked --bin avm-transpiler"
denoise "cargo build --release --locked --lib"
) 200>/tmp/rustup-avm-transpiler.lock
) 200>/tmp/rustup.lock

denoise "cargo fmt --check"
denoise "cargo clippy"
Expand Down Expand Up @@ -54,7 +54,7 @@ function build_cross {
;;
esac

# Serialize rustup operations to avoid race conditions when running parallel builds
# Serialize rustup operations to avoid race conditions with noir build
(
flock -x 200
if ! command -v cargo-zigbuild >/dev/null 2>&1; then
Expand All @@ -65,7 +65,7 @@ function build_cross {
echo "Installing Rust target: $rust_target"
rustup target add "$rust_target"
fi
) 200>/tmp/rustup-avm-transpiler.lock
) 200>/tmp/rustup.lock

cargo zigbuild --release --target "$rust_target" --lib

Expand Down
22 changes: 13 additions & 9 deletions noir/bootstrap.sh
Original file line number Diff line number Diff line change
Expand Up @@ -77,15 +77,19 @@ function build_packages {

function install_deps {
set -euo pipefail
# TODO: Move to build image?
if ! command -v cargo-binstall &>/dev/null; then
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
fi
if ! command -v just &>/dev/null; then
cargo-binstall just --version 1.42.4 -y --secure
fi
just --justfile ./noir-repo/justfile install-rust-tools
just --justfile ./noir-repo/justfile install-js-tools
# Serialize rustup/cargo-binstall operations to avoid race conditions with avm-transpiler
# which may run in parallel and share the same RUSTUP_HOME/CARGO_HOME.
(
flock -x 200
if ! command -v cargo-binstall &>/dev/null; then
curl -L --proto '=https' --tlsv1.2 -sSf https://raw.githubusercontent.com/cargo-bins/cargo-binstall/main/install-from-binstall-release.sh | bash
fi
if ! command -v just &>/dev/null; then
cargo-binstall just --version 1.42.4 -y --secure
fi
just --justfile ./noir-repo/justfile install-rust-tools
just --justfile ./noir-repo/justfile install-js-tools
) 200>/tmp/rustup.lock
}

export -f build_native build_packages install_deps
Expand Down
Loading