Skip to content

Commit

Permalink
ci: add option to disable building of statically linked binaries
Browse files Browse the repository at this point in the history
Builds compile dependencies twice if binaries are built statically. Adding
an option to disable static binary builds lets one build the binaries in
the same cargo build as the rest of the Rust crates. This is useful when
we're trying to save time building during integration tests.

Signed-off-by: Niladri Halder <[email protected]>
  • Loading branch information
niladrih committed Oct 17, 2024
1 parent 108d1b2 commit 7fdfb67
Showing 1 changed file with 7 additions and 1 deletion.
8 changes: 7 additions & 1 deletion scripts/release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -257,6 +257,10 @@ parse_common_arg() {
BUILD_BINARIES="$DEFAULT_BINARIES"
shift
;;
--no-static-linking)
STATIC_LINKING=false
shift
;;
--skip-bins)
shift
BUILD_BINARIES=
Expand Down Expand Up @@ -558,7 +562,7 @@ build_bins() {
mkdir -p "$BINARY_OUT_LINK"
for name in $BUILD_BINARIES; do
echo "Building static $name ..."
$NIX_BUILD --out-link "$BINARY_OUT_LINK/$name" -A "$PROJECT.$BUILD_TYPE.$name" --arg static true
$NIX_BUILD --out-link "$BINARY_OUT_LINK/$name" -A "$PROJECT.$BUILD_TYPE.$name" --arg allInOne "$ALL_IN_ONE" --arg static $STATIC_LINKING
done
fi
}
Expand Down Expand Up @@ -594,6 +598,7 @@ common_help() {
--tag <tag> Explicit tag (overrides the git tag).
--incremental Builds components in two stages allowing for faster rebuilds during development.
--build-bins Builds all the static binaries.
--no-static-linking Avoid building statically linked binaries.
--build-bin Specify which binary to build.
--skip-bins Don't build the static binaries.
--build-binary-out <path> Specify the outlink path for the binaries (otherwise it's the current directory).
Expand Down Expand Up @@ -631,6 +636,7 @@ ALL_IN_ONE="true"
INCREMENTAL="false"
DEFAULT_BINARIES=${BUILD_BINARIES:-}
BUILD_BINARIES=
STATIC_LINKING=true
BINARY_OUT_LINK="."
CARGO_VENDOR_DIR=${CARGO_VENDOR_DIR:-}
CARGO_VENDOR_ATTEMPTS=${CARGO_VENDOR_ATTEMPTS:-25}
Expand Down

0 comments on commit 7fdfb67

Please sign in to comment.