Skip to content
Merged
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
3 changes: 3 additions & 0 deletions deploy/docker/Dockerfile.images
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,7 @@ COPY crates/openshell-router/Cargo.toml crates/openshell-router/Cargo.toml
COPY crates/openshell-sandbox/Cargo.toml crates/openshell-sandbox/Cargo.toml
COPY crates/openshell-server/Cargo.toml crates/openshell-server/Cargo.toml
COPY crates/openshell-tui/Cargo.toml crates/openshell-tui/Cargo.toml
COPY crates/openshell-prover/Cargo.toml crates/openshell-prover/Cargo.toml
COPY crates/openshell-core/build.rs crates/openshell-core/build.rs
COPY proto/ proto/

Expand All @@ -67,6 +68,7 @@ RUN mkdir -p \
crates/openshell-router/src \
crates/openshell-sandbox/src \
crates/openshell-server/src \
crates/openshell-prover/src \
crates/openshell-tui/src && \
touch crates/openshell-bootstrap/src/lib.rs && \
printf 'fn main() {}\n' > crates/openshell-cli/src/main.rs && \
Expand All @@ -79,6 +81,7 @@ RUN mkdir -p \
printf 'fn main() {}\n' > crates/openshell-sandbox/src/main.rs && \
touch crates/openshell-server/src/lib.rs && \
printf 'fn main() {}\n' > crates/openshell-server/src/main.rs && \
touch crates/openshell-prover/src/lib.rs && \
touch crates/openshell-tui/src/lib.rs

FROM rust-builder-skeleton AS rust-deps
Expand Down
27 changes: 26 additions & 1 deletion scripts/bin/openshell
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,8 @@ else
return 0 ;;
crates/openshell-cli/*|crates/openshell-core/*|crates/openshell-bootstrap/*)
return 0 ;;
crates/openshell-prover/*)
return 0 ;;
crates/openshell-policy/*|crates/openshell-providers/*|crates/openshell-tui/*)
return 0 ;;
*)
Expand Down Expand Up @@ -89,7 +91,28 @@ fi

if [[ "$needs_build" == "1" ]]; then
echo "Recompiling openshell..." >&2
cargo build --package openshell-cli --quiet
build_args=(--package openshell-cli --quiet)
if ! command -v pkg-config >/dev/null 2>&1 || ! pkg-config --exists z3 >/dev/null 2>&1; then
z3_prefix=""
if command -v brew >/dev/null 2>&1; then
z3_prefix=$(brew --prefix z3 2>/dev/null || true)
fi

for candidate in "$z3_prefix" /opt/homebrew/opt/z3 /usr/local/opt/z3; do
if [[ -n "$candidate" && -f "$candidate/include/z3.h" && -d "$candidate/lib" ]]; then
echo "Using local Z3 from ${candidate} for CLI build." >&2
export Z3_SYS_Z3_HEADER="${candidate}/include/z3.h"
export Z3_LIBRARY_PATH_OVERRIDE="${candidate}/lib"
break
fi
done

if [[ -z "${Z3_SYS_Z3_HEADER:-}" ]]; then
echo "Falling back to bundled Z3 for local CLI build." >&2
build_args+=(--features bundled-z3)
fi
fi
cargo build "${build_args[@]}"
# Persist state after successful build
mkdir -p "$(dirname "$STATE_FILE")"
cd "$PROJECT_ROOT"
Expand All @@ -110,6 +133,8 @@ if [[ "$needs_build" == "1" ]]; then
return 0 ;;
crates/openshell-cli/*|crates/openshell-core/*|crates/openshell-bootstrap/*)
return 0 ;;
crates/openshell-prover/*)
return 0 ;;
crates/openshell-policy/*|crates/openshell-providers/*|crates/openshell-tui/*)
return 0 ;;
*)
Expand Down
Loading