49 lines
1.5 KiB
Bash
Executable File
49 lines
1.5 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
set -euo pipefail
|
|
|
|
here="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)"
|
|
repo="$(cd "${here}/../../.." && pwd)"
|
|
cargoxx_bin="${CARGOXX_BIN:-${repo}/build/debug/cargoxx}"
|
|
|
|
if [[ ! -x "${cargoxx_bin}" ]]; then
|
|
echo "error: cargoxx binary not found at ${cargoxx_bin}" >&2
|
|
echo "build it first: nix develop --command cmake --build build/debug" >&2
|
|
exit 1
|
|
fi
|
|
|
|
work="$(mktemp -d -t cargoxx-e2e-pathdep-XXXXXX)"
|
|
trap 'rm -rf "${work}"' EXIT
|
|
|
|
cp -r "${here}/." "${work}/"
|
|
sed -i "s|path:\\.\\./\\.\\./\\.\\.|path:${repo}|" "${work}/flake.nix"
|
|
|
|
cd "${work}"
|
|
|
|
echo "=== cargoxx build --no-build in greeter (path dep generates its own lock)"
|
|
(cd greeter && "${cargoxx_bin}" build --no-build)
|
|
|
|
echo "=== cargoxx build --no-build in consumer"
|
|
"${cargoxx_bin}" build --no-build
|
|
|
|
[[ -f Cargoxx.lock ]] || { echo "Cargoxx.lock missing"; exit 1; }
|
|
grep -q "source_kind = 'cargoxx-path'" Cargoxx.lock || \
|
|
{ echo "Cargoxx.lock missing source_kind = cargoxx-path"; exit 1; }
|
|
|
|
# nix build needs the source tree to be a git tree so 'path:' input copies
|
|
# Cargoxx.lock into the store. Init a throwaway git here.
|
|
git init -q
|
|
git add -A
|
|
git -c user.email=e2e@cargoxx -c user.name=e2e commit -q -m fixture
|
|
|
|
echo "=== nix build .#default"
|
|
out="$(nix build .#default --no-link --print-out-paths \
|
|
--extra-experimental-features 'nix-command flakes')"
|
|
|
|
[[ -n "${out}" ]] || { echo "nix build produced no output path"; exit 1; }
|
|
[[ -x "${out}/bin/consumer" ]] || { echo "missing ${out}/bin/consumer"; exit 1; }
|
|
|
|
echo "=== execute"
|
|
"${out}/bin/consumer"
|
|
|
|
echo "ok"
|