Files
marqdo-lint/scripts/package-tool.sh
T

25 lines
938 B
Bash
Executable File

#!/bin/sh
set -eu
ROOT=$(CDPATH= cd -- "$(dirname -- "$0")/.." && pwd)
DEST=${1:-"$ROOT/.cache/tool-bundle"}
export CARGO_HOME=${CARGO_HOME:-"$ROOT/.cache/cargo-home"}
export CARGO_TARGET_DIR=${CARGO_TARGET_DIR:-"$ROOT/.cache/marqdo-lint-release-target"}
export TMPDIR=${TMPDIR:-"$ROOT/.cache/tmp"}
mkdir -p "$TMPDIR" "$DEST/bin"
python3 - "$ROOT/tool.json" <<'PYCHECK'
import json, sys
value = json.load(open(sys.argv[1]))
assert value["schema"] == "marqdo.cli-tool" and value["schema_version"] == 1
assert value["requires"] == {"api_revision": 1, "analysis": 3}
assert "compatibility" not in value
PYCHECK
cargo build --locked --release --manifest-path "$ROOT/Cargo.toml"
install -m 755 "$CARGO_TARGET_DIR/release/marqdo-lint" "$DEST/bin/marqdo-lint"
cp "$ROOT/tool.json" "$DEST/tool.json"
sha256sum "$DEST/bin/marqdo-lint"
printf 'tool.json sha256: '
sha256sum "$DEST/tool.json" | awk '{print $1}'
printf 'Tool bundle: %s\n' "$DEST"