Upstream is a periodic one-way export of xAI's monorepo (linear "Synced from monorepo" commits, SOURCE_REV pinning the internal SHA) and explicitly refuses external contributions. So local changes can never be upstreamed, and upstream re-drops the whole tree on every sync -- structurally the same problem CraftBukkit has with Mojang. Adopt the Spigot/BuildTools model: patches/ is the source of truth, work/ is a disposable build artifact regenerated from upstream.rev plus patches/. scripts/apply-patches.sh ~ applyPatches.sh scripts/rebuild-patches.sh ~ rebuildPatches.sh scripts/update-upstream.sh forward-ports patches onto a new sync scripts/setup.sh toolchain: rust 1.94.0, dotslash/protoc upstream.rev ~ BuildTools versions/*.json pin format-patch uses --zero-commit so rebases do not rewrite the From line of every patch, and apply's git clean preserves work/target so replaying patches does not cost a cold Rust rebuild. Ships two [EXAMPLE PATCH] commits demonstrating a source edit and a new-file addition; both are safe to delete. Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
32 lines
981 B
Bash
Executable File
32 lines
981 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Compile the patched tree. Any extra arguments are passed straight to cargo,
|
|
# e.g. ./scripts/build.sh --release
|
|
#
|
|
# Set CARGO_CMD to run something other than `build` (check, test, clippy, run).
|
|
|
|
source "$(dirname "${BASH_SOURCE[0]}")/lib.sh"
|
|
setup_path
|
|
|
|
assert_work_ready
|
|
require_cmd cargo "Run 'make setup' first."
|
|
|
|
CARGO_CMD="${CARGO_CMD:-build}"
|
|
PKG="${PKG:-$BIN_PKG}"
|
|
|
|
cd "$WORK_DIR"
|
|
|
|
# bin/protoc is a DotSlash wrapper; it needs dotslash on PATH to self-resolve.
|
|
# If that is unavailable, hand the build script a system protoc instead so it
|
|
# does not silently skip codegen.
|
|
if ! ./bin/protoc --version >/dev/null 2>&1; then
|
|
if command -v protoc >/dev/null 2>&1 && [[ -z "${PROTOC:-}" ]]; then
|
|
export PROTOC="$(command -v protoc)"
|
|
warn "bin/protoc unusable (dotslash missing?) -- using PROTOC=$PROTOC"
|
|
else
|
|
die "no working protoc. Run 'make setup'."
|
|
fi
|
|
fi
|
|
|
|
info "cargo $CARGO_CMD -p $PKG ${*:-}"
|
|
exec cargo "$CARGO_CMD" -p "$PKG" "$@"
|