Files
komorebi/e2e/platforms/qemu_windows/build-ref.sh
T
LGUG2Z f7f444efb6 build(tools): tools, justfile and scripts name the outputs of the one flake
fast-check classifies the paths of the final directories (komorebi-linux, komorebi-macos,
komorebi-hotkeys, nix/{windows,linux,macos}, docs and schemas per platform), runs the Linux
check from the repository root and evaluates one check and one package per platform in the
root flake; kde-closure-check reads nix/linux/root-crates.json and compares it with the cargo
tree of the Linux packages (the listed crates besides komorebi-linux, komorebi-hotkeys and
komorebi-daemon); mac-check.sh drops the nested-workspace branch; e2e-needed treats nix/windows,
nix/workspace-src.nix, nix/lib.nix and nix/common.nix as fixed inputs of the Windows binaries
and the Linux and macOS trees as outside them; build-ref.sh builds `windows-NAME` for a REF with
the one-flake layout and keeps the old names for an older REF with its own flake. The justfile
names linux-nix-options-validation and runs a VM suite as legacyPackages.<system>.vm.NAME
(the vm-* checks are heavyChecks for now). scripts/linux/{run-kde,vm-mac,sync-e2e-core,
scenario-status} find the repository root and the VM library from scripts/linux/ and nix/linux/
(on the rebase onto wip-cutover-all the coordinator versions of run-kde, vm-mac and
scenario-status were kept: same change).

Not touched: scripts/linux/compare-gen.py, a migration comparison between the three old trees
that still looks for komorebi-for-mac/ (obsolete; open).

Verified: bash -n on the changed scripts; tools/kde-closure-check passes (14 root crates);
tools/fast-check --list classifies this revision as nix-only. fast-check commands for the
platforms were not run.
2026-11-05 15:03:27 -08:00

53 lines
2.0 KiB
Bash
Executable File

#!/usr/bin/env bash
# Builds the binaries of another komorebi commit, to run the e2e scenarios
# against them: `KOMOREBI_E2E_BINS=OUTDIR nix run .#e2e-windows -- ...`.
#
# usage: build-ref.sh REF OUTDIR
# REF is anything git knows (a commit, a branch, a tag); it is fetched from
# origin if it is not here yet. The checkout of REF is built with this
# tree's flake (see below), because the nix build of an older commit may not
# work any more; the test window is this tree's. OUTDIR gets
# komorebi.exe, komorebic.exe, komorebi-testwin.exe and `commit`, the full
# hash, which the runner writes into every result.json.
# needs on PATH: git nix
set -euo pipefail
ref=$1 out=$2
here=$(cd "$(dirname "$0")" && pwd)
root=$(git -C "$here" rev-parse --show-toplevel)
if ! git -C "$root" cat-file -e "$ref^{commit}" 2>/dev/null; then
git -C "$root" fetch origin "+refs/heads/*:refs/remotes/origin/*"
fi
commit=$(git -C "$root" rev-parse "$ref^{commit}")
tree=$(mktemp -d)
cleanup() {
git -C "$root" worktree remove --force "$tree" 2>/dev/null || rm -rf "$tree"
}
trap cleanup EXIT
git -C "$root" worktree add --detach "$tree" "$commit"
# A REF of the layout with one root flake (nix/windows/) is built with this tree's flake.nix, flake.lock and
# nix/, whose Windows outputs are `windows-NAME`. An older REF (the Windows flake with `komorebi/` and the
# nested flakes) keeps its own flake: its outputs are `NAME`, and its file layout is not one this tree's
# flake can read.
if [ -e "$tree/nix/windows/flake-module.nix" ]; then
rm -rf "$tree/nix"
cp -r "$root/nix" "$tree/nix"
cp "$root/flake.nix" "$root/flake.lock" "$tree/"
prefix=windows-
else
prefix=
fi
mkdir -p "$out"
for package in komorebi komorebic komorebi-bar; do
path=$(nix build "$tree#$prefix$package" --no-link --print-out-paths)
cp "$path/bin/$package.exe" "$out/"
done
path=$(nix build "$root#windows-komorebi-testwin-e2e" --no-link --print-out-paths)
cp "$path/bin/komorebi-testwin.exe" "$out/"
chmod u+w "$out"/*.exe
echo "$commit" > "$out/commit"
echo "built $commit into $out"