File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -30,12 +30,29 @@ ENV RUSTFLAGS="$RUSTFLAGS"
3030ARG FEATURES=""
3131ENV FEATURES=$FEATURES
3232
33+ # Disable default features (e.g. for `shadow-integration`, which must drop the
34+ # default `jemalloc` and `devnet4` features). Empty for a normal build.
35+ ARG NO_DEFAULT_FEATURES=""
36+ ENV NO_DEFAULT_FEATURES=$NO_DEFAULT_FEATURES
37+
38+ # `--locked` by default; the Shadow build injects an uncommitted `[patch]` and so
39+ # must build unlocked (pass LOCKED= empty).
40+ ARG LOCKED="--locked"
41+ ENV LOCKED=$LOCKED
42+
3343# Build dependencies
34- RUN cargo chef cook --profile $BUILD_PROFILE --features "$FEATURES" --recipe-path recipe.json
44+ RUN cargo chef cook --profile $BUILD_PROFILE $NO_DEFAULT_FEATURES --features "$FEATURES" --recipe-path recipe.json
3545
3646# Build application
3747COPY --exclude=.git --exclude=dist . .
38- RUN cargo build --profile $BUILD_PROFILE --features "$FEATURES" --locked --bin ream
48+
49+ # Shadow simulator compatibility: the quinn-udp fallback is a Cargo `[patch]`,
50+ # which cannot be feature-gated and is therefore not committed. Set SHADOW=1 to
51+ # inject it into the manifest before building.
52+ ARG SHADOW=""
53+ RUN if [ -n "$SHADOW" ]; then bash shadow/inject-patch.sh; fi
54+
55+ RUN cargo build --profile $BUILD_PROFILE $NO_DEFAULT_FEATURES --features "$FEATURES" $LOCKED --bin ream
3956
4057# ARG is not resolved in COPY so we have to hack around it by copying the
4158# binary to a temporary location
Original file line number Diff line number Diff line change @@ -6,6 +6,10 @@ BIN_DIR = "dist/bin"
66# Cargo features for builds.
77FEATURES ?=
88
9+ # Devnet feature selected for Shadow builds (devnet4/devnet5 are mutually
10+ # exclusive, and `--no-default-features` drops the default `devnet4`).
11+ SHADOW_DEVNET ?= devnet5
12+
913# Cargo profile for builds.
1014PROFILE ?= release
1115
@@ -123,6 +127,23 @@ pr: lint update-book-cli clean-deps test # Run all checks for a PR.
123127build-% :
124128 cross build --bin ream --target $* --features " $( FEATURES) " --profile " $( PROFILE) " $(EXTRA_FLAGS )
125129
130+ # #@ Shadow simulator
131+
132+ .PHONY : shadow-build
133+ shadow-build : # Shadow-compatible binary (single-threaded, no jemalloc, quinn-udp patch).
134+ ./shadow/build.sh cargo build --profile " $( PROFILE) " \
135+ --no-default-features --features " shadow-integration $( SHADOW_DEVNET) " --bin ream
136+
137+ .PHONY : shadow-docker-build
138+ shadow-docker-build : # Build a Shadow-compatible Docker image, tagged ...:latest-shadow.
139+ docker build --file ./Dockerfile . \
140+ --build-arg SHADOW=1 \
141+ --build-arg NO_DEFAULT_FEATURES=--no-default-features \
142+ --build-arg FEATURES=" shadow-integration $( SHADOW_DEVNET) " \
143+ --build-arg LOCKED= \
144+ --build-arg BUILD_PROFILE=$(PROFILE ) \
145+ --tag ghcr.io/reamlabs/ream:latest-shadow
146+
126147.PHONY : docker-build-push
127148docker-build-push :
128149 $(MAKE ) build-x86_64-unknown-linux-gnu
You can’t perform that action at this time.
0 commit comments