feat: adopt local SQLite engineering memory and quality gates
This commit is contained in:
+18
-18
@@ -4,10 +4,11 @@ set -euo pipefail
|
||||
|
||||
usage() {
|
||||
cat <<'EOF'
|
||||
Usage: scripts/install-native.sh [--bin-dir DIR]
|
||||
Usage: scripts/install-native.sh [--bin-dir DIR] [--lib-dir DIR]
|
||||
|
||||
Build and install ai-engineering and the aie shortcut (Linux/macOS).
|
||||
Default destination: $HOME/.local/bin. Run again to update.
|
||||
Build and install a complete AIE + SQLite package (Linux/macOS).
|
||||
Default package: $HOME/.local/lib/ai-engineering; shortcuts: $HOME/.local/bin.
|
||||
Creates ai-engineering, aie and aie-sqlite3 shortcuts. Run again to update.
|
||||
|
||||
Uses GRAALVM_HOME, a compatible JAVA_HOME, or installs the GraalVM pinned in
|
||||
.sdkmanrc through SDKMAN (bootstrapped when absent). Requires JDK 25 with
|
||||
@@ -16,6 +17,7 @@ Does not install system packages or edit shell profiles.
|
||||
|
||||
Options:
|
||||
--bin-dir DIR Installation directory (no sudo needed for the default).
|
||||
--lib-dir DIR Package/releases directory; data stays in each project.
|
||||
-h, --help Show this help.
|
||||
EOF
|
||||
}
|
||||
@@ -24,6 +26,7 @@ die() { printf 'Error: %s\n' "$*" >&2; exit 1; }
|
||||
log() { printf '\n==> %s\n' "$*"; }
|
||||
|
||||
bin_dir="${HOME:?HOME must be set}/.local/bin"
|
||||
lib_dir="$HOME/.local/lib/ai-engineering"
|
||||
while [[ $# -gt 0 ]]; do
|
||||
case "$1" in
|
||||
--bin-dir)
|
||||
@@ -31,6 +34,11 @@ while [[ $# -gt 0 ]]; do
|
||||
bin_dir=$2
|
||||
shift 2
|
||||
;;
|
||||
--lib-dir)
|
||||
[[ $# -ge 2 && -n "$2" && "$2" != --* ]] || die '--lib-dir requires a directory.'
|
||||
lib_dir=$2
|
||||
shift 2
|
||||
;;
|
||||
-h|--help) usage; exit 0 ;;
|
||||
*) usage >&2; die "Unknown argument: $1" ;;
|
||||
esac
|
||||
@@ -48,7 +56,7 @@ case "$platform/$architecture" in
|
||||
esac
|
||||
|
||||
case "$bin_dir" in /*) ;; *) bin_dir="$PWD/$bin_dir" ;; esac
|
||||
for name in ai-engineering aie; do
|
||||
for name in ai-engineering aie aie-sqlite3; do
|
||||
[[ ! -d "$bin_dir/$name" ]] || die "Installation target is a directory: $bin_dir/$name"
|
||||
done
|
||||
|
||||
@@ -154,22 +162,14 @@ log "Building with $JAVA_HOME"
|
||||
"-Dorg.gradle.java.home=$JAVA_HOME" \
|
||||
"-Porg.gradle.java.installations.paths=$JAVA_HOME" \
|
||||
-Porg.gradle.java.installations.auto-detect=false \
|
||||
-Porg.gradle.java.installations.auto-download=false nativeCompile
|
||||
-Porg.gradle.java.installations.auto-download=false nativePackage
|
||||
)
|
||||
|
||||
native_binary="$project_dir/build/native/nativeCompile/ai-engineering"
|
||||
[[ -x "$native_binary" ]] || die "Build did not produce an executable: $native_binary"
|
||||
log "Installing in $bin_dir"
|
||||
mkdir -p -- "$bin_dir"
|
||||
bin_dir=$(cd -- "$bin_dir" && pwd -P)
|
||||
# Stage on the destination filesystem. Rename replaces old binaries/symlinks
|
||||
# without following a previous symlink back into this checkout.
|
||||
stage_dir=$(mktemp -d "$bin_dir/.aie-install.XXXXXXXX")
|
||||
install -m 755 "$native_binary" "$stage_dir/ai-engineering"
|
||||
"$stage_dir/ai-engineering" --help >/dev/null
|
||||
ln -s ai-engineering "$stage_dir/aie"
|
||||
mv -f -- "$stage_dir/ai-engineering" "$bin_dir/ai-engineering"
|
||||
mv -f -- "$stage_dir/aie" "$bin_dir/aie"
|
||||
native_package="$project_dir/build/native/package"
|
||||
[[ -x "$native_package/ai-engineering" ]] || die "Build did not produce a complete package: $native_package"
|
||||
command -v python3 >/dev/null 2>&1 || die 'Python 3 is required to verify and activate the package.'
|
||||
log "Verifying package before activation in $lib_dir"
|
||||
python3 "$project_dir/scripts/activate-native-package.py" "$native_package" --bin-dir "$bin_dir" --lib-dir "$lib_dir"
|
||||
log "Installed: $bin_dir/ai-engineering (shortcut: $bin_dir/aie)"
|
||||
case ":$PATH:" in
|
||||
*":$bin_dir:"*) ;;
|
||||
|
||||
Reference in New Issue
Block a user