mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-20 15:41:38 +01:00
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.
This commit is contained in:
1 parent
333624efa8
commit
f7f444efb6
7 files changed
+73
-83
No files matched your search
@@ -5,8 +5,8 @@
|
||||
# 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.nix and flake.lock, because the nix build of an older commit
|
||||
# may not work any more; the test window is this tree's. OUTDIR gets
|
||||
# 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
|
||||
@@ -27,14 +27,25 @@ cleanup() {
|
||||
}
|
||||
trap cleanup EXIT
|
||||
git -C "$root" worktree add --detach "$tree" "$commit"
|
||||
cp "$root/flake.nix" "$root/flake.lock" "$tree/"
|
||||
# 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#$package" --no-link --print-out-paths)
|
||||
path=$(nix build "$tree#$prefix$package" --no-link --print-out-paths)
|
||||
cp "$path/bin/$package.exe" "$out/"
|
||||
done
|
||||
path=$(nix build "$root#komorebi-testwin-e2e" --no-link --print-out-paths)
|
||||
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"
|
||||
|
||||
@@ -145,7 +145,7 @@ docgen starlight:
|
||||
nixgen-linux:
|
||||
schemars-nixgen schemas/linux/schema.json -o nix/linux/komorebi-options.nix --name komorebi --description "komorebi for KDE Plasma configuration"
|
||||
nix fmt nix/linux/komorebi-options.nix
|
||||
nix build -L --no-link ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem).nix-options-validation"
|
||||
nix build -L --no-link ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem).linux-nix-options-validation"
|
||||
|
||||
nixgen-macos:
|
||||
schemars-nixgen schemas/macos/schema.json -o nix/macos/komorebi-options.nix --name komorebi --description "komorebi for Mac configuration"
|
||||
@@ -199,7 +199,7 @@ vm name:
|
||||
if [ "$(uname)" = Darwin ]; then
|
||||
scripts/linux/vm-mac {{ name }}
|
||||
else
|
||||
nix build -L .#checks.{{ arch() }}-linux.vm-{{ name }}
|
||||
nix build -L .#legacyPackages.{{ arch() }}-linux.vm.{{ name }}
|
||||
fi
|
||||
|
||||
# every KDE VM test, in the order of the flake
|
||||
|
||||
+10
-10
@@ -13,7 +13,7 @@ the xwin cross toolchain), so it needs no Windows host. `shellcheck` and `bash -
|
||||
| `fast-check` | runs only the checks the touched paths need (tiers below) |
|
||||
| `mac-check.sh` | the macOS type-check on Linux, unconditionally (the macOS step of `fast-check`) |
|
||||
| `cc-fake.sh` | the fake C compiler `mac-check.sh` and `fast-check` use for `aarch64-apple-darwin` |
|
||||
| `kde-closure-check` | fails when `komorebi-for-kde/nix/root-crates.json` and the KDE cargo closure differ |
|
||||
| `kde-closure-check` | fails when `nix/linux/root-crates.json` (the Linux source filter) and the Linux cargo closure differ |
|
||||
| `e2e-needed` | says whether a diff touches anything the Windows e2e binaries are built from |
|
||||
| `trim-target` | deletes stale test executables from the persistent target directories |
|
||||
| `gate-lock` | a host-wide FIFO lock for heavy gates (optional) |
|
||||
@@ -31,12 +31,12 @@ this tool.
|
||||
|
||||
| touched | check (tier) |
|
||||
|---|---|
|
||||
| `komorebi-for-kde/**` | `cargo check`, `cargo test --lib` and `--test schemas -- --test-threads=1` of the KDE daemon package (1) |
|
||||
| `komorebi-for-mac/**` | `cargo check --target aarch64-apple-darwin --all-targets` with the fake CC; type-check only, cannot link or test (2) |
|
||||
| root Windows tree (`komorebi*/`, `e2e/`, `Cargo.*`) | `nix develop --command cargo clippy --locked --all-targets -- -D warnings` (2) |
|
||||
| `komorebi-linux/**`, `komorebi-hotkeys/**`, `scripts/linux/**`, the Linux files of `komorebic`/`komorebi-client`/`komorebi-daemon` | `cargo check`, `cargo test --lib` and `--test schemas -- --test-threads=1` of the Linux daemon package (1) |
|
||||
| `komorebi-macos/**`, the macOS files of `komorebic`/`komorebi-client`/`komorebi-bar` | `cargo check --target aarch64-apple-darwin --all-targets` with the fake CC; type-check only, cannot link or test (2) |
|
||||
| the Windows crates (`komorebi-windows/`, `komorebi-gui/`, ..., `e2e/`), `Cargo.*` | `nix develop --command cargo clippy --locked --all-targets -- -D warnings` (2) |
|
||||
| `komorebi-layouts/`, `komorebi-scrolling/` | native `cargo test` of both plus the Windows check |
|
||||
| `crates/**` | native tests, plus the KDE, macOS and Windows checks |
|
||||
| `*.nix`, `flake.lock` | evaluation only: `nix flake show` and `nix eval ...drvPath` of the named checks (no `nix flake check`) |
|
||||
| `flake.nix`, `flake.lock`, `nix/**` | evaluation only: `nix flake show` and `nix eval ...drvPath` of one check and one package per platform (no `nix flake check`) |
|
||||
| `*.md`, `docs/`, `tools/`, images, `.github` | nothing |
|
||||
|
||||
Persistent target directories live under `$FAST_CHECK_SCRATCH` (default `${XDG_CACHE_HOME:-~/.cache}/komorebi-fast-check`):
|
||||
@@ -49,13 +49,13 @@ Measured warm times (2026-10-31, jj revision c89651fa, WSL2 host): Windows clipp
|
||||
|
||||
Caveats
|
||||
|
||||
- Windows clippy here is NOT the pre-landing gate: still run `nix build .#checks.x86_64-linux.komorebi-workspace-clippy`
|
||||
- Windows clippy here is NOT the pre-landing gate: still run `nix build .#checks.x86_64-linux.windows-clippy`
|
||||
(about 3.5 min) before landing; it uses crane's filtered source and catches filter bugs.
|
||||
- macOS needs `COMMIT_HASH` (the tools set `dev`) when there is no `.git`.
|
||||
- In a jj workspace without `.git`, `nix flake check --no-build` fails with `attribute 'dirtyRev' missing`, and it
|
||||
evaluates every check (15-16 GB). `fast-check` therefore evaluates attributes with `nix flake show` and `nix eval`.
|
||||
- KDE `tests/schemas.rs` shares a pid-only socket path; keep `--test-threads=1`.
|
||||
- Single KDE test file: `CARGO_TARGET_DIR=$FAST_CHECK_SCRATCH/kde-target nix shell nixpkgs#gcc -c cargo test -p komorebi-linux --test <name>`.
|
||||
- Single Linux test file: `CARGO_TARGET_DIR=$FAST_CHECK_SCRATCH/kde-target nix shell nixpkgs#gcc -c cargo test -p komorebi-linux --test <name>`.
|
||||
|
||||
## macOS type-check (mac-check.sh, cc-fake.sh)
|
||||
|
||||
@@ -68,8 +68,8 @@ code type-checks, nothing about behaviour. `fast-check` uses the same script whe
|
||||
|
||||
## kde-closure-check
|
||||
|
||||
`tools/kde-closure-check [repo]` (2 s) compares `komorebi-for-kde/nix/root-crates.json` (the root crates the KDE
|
||||
flake's source filter takes) with `cargo metadata` / `cargo tree` of the KDE packages. Run it after any
|
||||
`tools/kde-closure-check [repo]` (15 s) compares `nix/linux/root-crates.json` (the crates besides the Linux-only
|
||||
ones that the Linux source filter of `nix/workspace-src.nix` takes) with `cargo tree` of the Linux packages. Run it after any
|
||||
`Cargo.toml` dependency change in the KDE tree or in the crates it uses; it exits 1 and prints the differences
|
||||
when the list is stale (a stale list breaks the KDE nix build or rebuilds the VM suites needlessly).
|
||||
|
||||
@@ -96,7 +96,7 @@ e2e, KDE `commands`/`core-e2e`) is not disturbed. Bash plus `flock`; state in `$
|
||||
(`GATE_LOCK_DIR` overrides).
|
||||
|
||||
```
|
||||
tools/gate-lock run --class heavy --label "clippy" --est 5 -- nix build -L --no-link .#checks.x86_64-linux.komorebi-workspace-clippy
|
||||
tools/gate-lock run --class heavy --label "clippy" --est 5 -- nix build -L --no-link .#checks.x86_64-linux.windows-clippy
|
||||
tools/gate-lock run --class timing --label "win e2e" --est 60 --idle-load 3 -- nix run .#e2e-windows -- ...
|
||||
tools/gate-lock run --class light -- cargo check -p komorebi # never waits; throttled while a timing gate is held
|
||||
tools/gate-lock status [--short] | wait [--max SEC] | history [N] | adopt PID
|
||||
|
||||
+5
-5
@@ -1,7 +1,7 @@
|
||||
#!/usr/bin/env bash
|
||||
# e2e-needed: does a diff touch anything the Windows e2e binaries are built from?
|
||||
# e2e-needed [--range | --since REV] [--to REV] [--closure] (run in a jj workspace root)
|
||||
# The Windows e2e runs komorebi.exe, komorebic.exe and komorebi-testwin.exe (flake e2eBuild). Their
|
||||
# The Windows e2e runs komorebi.exe, komorebic.exe and komorebi-testwin.exe (windows-komorebi-testwin-e2e in flake.nix). Their
|
||||
# inputs are (a) the source directories of the workspace crates they depend on, from `cargo tree
|
||||
# --target x86_64-pc-windows-msvc -e normal,build` (dev-dependencies are not in the binaries),
|
||||
# (b) files pulled in with include_str!/include_bytes!/include! from those crates, (c) fixed
|
||||
@@ -60,10 +60,10 @@ while IFS= read -r f; do
|
||||
[ -n "$f" ] || continue
|
||||
reason=""
|
||||
case "$f" in
|
||||
Cargo.lock|Cargo.toml|rust-toolchain.toml|flake.nix|flake.lock) reason="fixed input" ;;
|
||||
Cargo.lock|Cargo.toml|rust-toolchain.toml|flake.nix|flake.lock|nix/windows/*|nix/workspace-src.nix|nix/lib.nix|nix/common.nix) reason="fixed input" ;;
|
||||
e2e/*) reason="e2e harness / guest" ;;
|
||||
*/build.rs) reason="build script" ;;
|
||||
komorebi-for-kde/*|komorebi-for-mac/*) ;; # separate trees, not in the Windows closure
|
||||
komorebi-linux/*|komorebi-hotkeys/*|komorebi-macos/*|nix/linux/*|nix/macos/*|scripts/linux/*|schemas/linux/*|schemas/macos/*) ;; # the other platforms, not in the Windows closure
|
||||
*.md|docs/*|tools/*|.github/*) ;; # docs and dev tools (include!-ed docs are caught below)
|
||||
esac
|
||||
if [ -z "$reason" ]; then
|
||||
@@ -79,8 +79,8 @@ while IFS= read -r f; do
|
||||
fi
|
||||
if [ -z "$reason" ]; then
|
||||
case "$f" in
|
||||
komorebi-for-kde/*|komorebi-for-mac/*|*.md|docs/*|tools/*|.github/*) ;;
|
||||
komorebi-bar/*|komorebi-gui/*|komorebi-shortcuts/*|komorebic-no-console/*|crates/komorebi-bar-core/*|schema*.json|komorebic.lib.ahk|wix/*|justfile|mkdocs.yml|deny.toml|rustfmt.toml|*.json)
|
||||
komorebi-linux/*|komorebi-hotkeys/*|komorebi-macos/*|nix/linux/*|nix/macos/*|scripts/linux/*|schemas/linux/*|schemas/macos/*|*.md|docs/*|tools/*|.github/*) ;;
|
||||
komorebi-bar/*|komorebi-gui/*|komorebi-shortcuts/*|komorebic-no-console/*|crates/komorebi-bar-core/*|schemas/windows/*|schema*.json|komorebic.lib.ahk|wix/*|justfile|mkdocs.yml|deny.toml|rustfmt.toml|*.json)
|
||||
# known Windows-tree paths outside the closure (crates not in the closure were checked above)
|
||||
case "$f" in */*.json|*.json) [ "$f" = dependencies.json ] || [ "${f#schema}" != "$f" ] || reason="json file outside known oracle files: treated as needed" ;; esac ;;
|
||||
*) reason="not understood: treated as needed" ;;
|
||||
|
||||
+27
-36
@@ -20,17 +20,15 @@ Env: FAST_CHECK_SCRATCH base dir for the persistent target dirs (default: ${XDG
|
||||
USAGE
|
||||
}
|
||||
|
||||
# Evaluation-only nix check, attribute level: `nix flake show` (about 9 s, 0.4 GB). `nix flake check
|
||||
# --no-build` forces every check of the system (15-16 GB RSS for 5-8 minutes, measured by `flow`) and fails
|
||||
# Evaluation-only nix check, attribute level: `nix flake show` (about 9 s, 0.4 GB) and the drvPath of one check
|
||||
# and one package of each platform (the Windows, Linux and macOS groups of the one root flake). `nix flake check
|
||||
# --no-build` forces every check of every system (up to 28 GB RSS for 5 minutes with --all-systems) and fails
|
||||
# without .git anyway (decision D9). Not caught here: an error inside a check's derivation body; the
|
||||
# pre-landing `nix build` of the check still catches that.
|
||||
nix_eval() {
|
||||
# current system only: since the source of the merged workspace is a derivation that crane reads at evaluation,
|
||||
# evaluating another system's checks needs a builder for that system (see docs/dev/unified-binaries.md)
|
||||
systemd-run --user --scope -q -p MemoryMax=6G nice -n 19 nix flake show >/dev/null || return 1
|
||||
[ -d komorebi-for-kde ] || return 0 # a nested flake: attribute level only
|
||||
for a in checks.x86_64-linux.komorebi-workspace-clippy checks.x86_64-linux.kfde-komorebi-workspace-clippy \
|
||||
packages.x86_64-linux.komorebic packages.x86_64-linux.kfde-komorebic; do
|
||||
for a in checks.x86_64-linux.windows-clippy checks.x86_64-linux.linux-clippy checks.aarch64-darwin.macos-clippy \
|
||||
packages.x86_64-linux.windows-komorebic packages.x86_64-linux.komorebic packages.aarch64-darwin.komorebic; do
|
||||
systemd-run --user --scope -q -p MemoryMax=6G nice -n 19 nix eval --raw ".#$a.drvPath" >/dev/null || return 1
|
||||
done
|
||||
}
|
||||
@@ -56,23 +54,27 @@ else
|
||||
FILES="$(jj diff --name-only -r @)" || exit 2
|
||||
fi
|
||||
|
||||
want_kde=0 want_mac=0 want_win=0 want_native=0 want_nix=0 want_nixkde=0 want_nixmac=0
|
||||
want_kde=0 want_mac=0 want_win=0 want_native=0 want_nix=0
|
||||
unclassified=()
|
||||
while IFS= read -r f; do
|
||||
[ -z "$f" ] && continue
|
||||
case "$f" in
|
||||
komorebi-for-kde/flake.nix | komorebi-for-kde/flake.lock | komorebi-for-kde/nix/*) want_nixkde=1 ;;
|
||||
komorebi-for-mac/flake.nix | komorebi-for-mac/flake.lock | komorebi-for-mac/nix/*) want_nixmac=1 ;;
|
||||
komorebi-for-kde/*.md | komorebi-for-kde/docs/* | komorebi-for-kde/LICENSE* | komorebi-for-kde/.github/*) ;;
|
||||
komorebi-for-mac/*.md | komorebi-for-mac/docs/* | komorebi-for-mac/LICENSE* | komorebi-for-mac/.github/*) ;;
|
||||
Cargo.toml | Cargo.lock | .cargo/*) want_win=1; want_kde=1; want_mac=1 ;;
|
||||
komorebi-for-kde/*) want_kde=1 ;;
|
||||
komorebi-for-mac/*) want_mac=1 ;;
|
||||
flake.nix | flake.lock | nix/* | *.nix) want_nix=1 ;;
|
||||
# the files the Rust sources include or read, before the docs are ignored
|
||||
docs/linux/komorebi.example.json | docs/linux/skhdrc.sample | schemas/linux/*) want_kde=1 ;;
|
||||
docs/macos/*.json | docs/macos/*.sample | docs/macos/cli/* | schemas/macos/*) want_mac=1 ;;
|
||||
docs/*.json | docs/*.sample | schemas/windows/*) want_win=1 ;;
|
||||
Cargo.toml | Cargo.lock | .cargo/* | rust-toolchain.toml | rustfmt.toml | deny.toml) want_win=1; want_kde=1; want_mac=1 ;;
|
||||
crates/*) want_native=1; want_kde=1; want_mac=1; want_win=1 ;;
|
||||
komorebi-layouts/* | komorebi-scrolling/*) want_native=1; want_win=1 ;;
|
||||
flake.nix | flake.lock | *.nix) want_nix=1 ;;
|
||||
komorebi-linux/* | komorebi-hotkeys/* | scripts/linux/*) want_kde=1 ;;
|
||||
komorebi-macos/*) want_mac=1 ;;
|
||||
komorebic/src/linux* | komorebic/tests/linux_* | komorebi-client/src/linux.rs | komorebi-client/tests/linux_* | komorebi-daemon/tests/linux_*) want_kde=1 ;;
|
||||
komorebic/src/macos* | komorebi-client/src/macos.rs | komorebi-bar/src/macos*) want_mac=1 ;;
|
||||
komorebi-bar/*) want_win=1; want_mac=1 ;;
|
||||
komorebi-daemon/* | komorebic/* | komorebi-client/*) want_win=1; want_kde=1; want_mac=1 ;;
|
||||
*.md | docs/* | tools/* | LICENSE* | .github/* | *.png | *.jpg | *.gif) ;;
|
||||
komorebi/* | komorebic/* | komorebi-bar/* | komorebi-client/* | komorebi-gui/* | komorebi-themes/* | e2e/* | rust-toolchain.toml | deny.toml)
|
||||
komorebi-windows/* | komorebi-gui/* | komorebi-shortcuts/* | komorebic-no-console/* | komorebi-themes/* | e2e/*)
|
||||
want_win=1 ;;
|
||||
*) unclassified+=("$f") ;;
|
||||
esac
|
||||
@@ -85,32 +87,21 @@ if [ "$want_native" = 1 ]; then
|
||||
add "native: shared crates tests" "." \
|
||||
"CARGO_TARGET_DIR=$S/target-fast-native nix shell nixpkgs#gcc -c cargo test --locked -p komorebi-layouts -p komorebi-scrolling"
|
||||
fi
|
||||
# One root workspace (after the package merge) or three (before it): detect which, since agents' trees differ.
|
||||
if [ -f komorebi-for-kde/Cargo.toml ]; then MERGED=0; else MERGED=1; fi
|
||||
if [ "$want_win" = 1 ]; then
|
||||
# a bare cargo command builds default-members (the Windows crates) in the merged workspace
|
||||
WS=--workspace; [ $MERGED = 1 ] && WS=
|
||||
# a bare cargo command builds default-members (the Windows crates) of the one workspace
|
||||
add "windows: clippy --all-targets -D warnings (dev shell, cross)" "." \
|
||||
"CARGO_TARGET_DIR=$S/target-fast-win nix develop --command cargo clippy $WS --locked --all-targets -- -D warnings"
|
||||
"CARGO_TARGET_DIR=$S/target-fast-win nix develop --command cargo clippy --locked --all-targets -- -D warnings"
|
||||
fi
|
||||
if [ "$want_kde" = 1 ]; then
|
||||
if [ $MERGED = 1 ]; then KD=.; else KD=komorebi-for-kde; fi
|
||||
add "kde: cargo check + lib tests (komorebi)" "$KD" \
|
||||
"export CARGO_TARGET_DIR=$S/kde-target COMMIT_HASH=\${COMMIT_HASH:-dev}; K=komorebi; grep -q 'name = \"komorebi-linux\"' $( [ $MERGED = 1 ] && echo komorebi-for-kde/ )komorebi/Cargo.toml && K=komorebi-linux; export K; nix shell nixpkgs#gcc -c bash -c 'cargo check --locked -p \$K && { [ -d komorebi-daemon ] && cargo check --locked -p komorebi || true; } && cargo test --locked -p \$K --lib && cargo test --locked -p \$K --test schemas -- --test-threads=1'"
|
||||
add "kde: cargo check + lib tests (komorebi-linux)" "." \
|
||||
"export CARGO_TARGET_DIR=$S/kde-target COMMIT_HASH=\${COMMIT_HASH:-dev}; nix shell nixpkgs#gcc -c bash -c 'cargo check --locked -p komorebi-linux && cargo check --locked -p komorebi && cargo test --locked -p komorebi-linux --lib && cargo test --locked -p komorebi-linux --test schemas -- --test-threads=1'"
|
||||
fi
|
||||
if [ "$want_mac" = 1 ]; then
|
||||
if [ $MERGED = 1 ]; then MD=.; MP="-p komorebi -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar"; else MD=komorebi-for-mac; MP=--workspace; fi
|
||||
add "macos: type-check only (fake CC, cannot link)" "$MD" \
|
||||
"export CARGO_TARGET_DIR=$S/target-fast-mac COMMIT_HASH=\${COMMIT_HASH:-dev} CC_aarch64_apple_darwin=$HERE/cc-fake.sh AR_aarch64_apple_darwin=ar; PKG_CONFIG_PATH=\$(nix build --no-link --print-out-paths nixpkgs#openssl.dev)/lib/pkgconfig; export PKG_CONFIG_PATH; nix shell nixpkgs#gcc nixpkgs#pkg-config nixpkgs#openssl.dev -c cargo check --locked --target aarch64-apple-darwin $MP --all-targets"
|
||||
add "macos: type-check only (fake CC, cannot link)" "." \
|
||||
"export CARGO_TARGET_DIR=$S/target-fast-mac COMMIT_HASH=\${COMMIT_HASH:-dev} CC_aarch64_apple_darwin=$HERE/cc-fake.sh AR_aarch64_apple_darwin=ar; PKG_CONFIG_PATH=\$(nix build --no-link --print-out-paths nixpkgs#openssl.dev)/lib/pkgconfig; export PKG_CONFIG_PATH; nix shell nixpkgs#gcc nixpkgs#pkg-config nixpkgs#openssl.dev -c cargo check --locked --target aarch64-apple-darwin -p komorebi -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar --all-targets"
|
||||
fi
|
||||
if [ "$want_nix" = 1 ] || [ "$want_nixkde" = 1 ] || [ "$want_nixmac" = 1 ]; then
|
||||
add "nix: root flake evaluation only (flake check --no-build; flake show if dirtyRev missing)" "." "$SELF --nix-eval"
|
||||
fi
|
||||
if [ "$want_nixkde" = 1 ] && [ "$want_nix" = 0 ]; then
|
||||
add "nix: kde flake evaluation only (flake check --no-build; flake show if dirtyRev missing)" "komorebi-for-kde" "$SELF --nix-eval"
|
||||
fi
|
||||
if [ "$want_nixmac" = 1 ] && [ "$want_nix" = 0 ]; then
|
||||
add "nix: mac flake evaluation only (flake check --no-build; flake show if dirtyRev missing)" "komorebi-for-mac" "$SELF --nix-eval"
|
||||
if [ "$want_nix" = 1 ]; then
|
||||
add "nix: root flake evaluation only (flake show and the drvPath of one check and package per platform)" "." "$SELF --nix-eval"
|
||||
fi
|
||||
|
||||
if [ "${#unclassified[@]}" -gt 0 ]; then
|
||||
|
||||
+11
-18
@@ -1,26 +1,19 @@
|
||||
#!/usr/bin/env bash
|
||||
# Fails if the crates outside komorebi-for-kde that the KDE packages depend on differ from the list the KDE
|
||||
# source filter uses (komorebi-for-kde/nix/root-crates.json).
|
||||
# Fails if the crates outside the Linux-only crates that the KDE packages depend on differ from the list the
|
||||
# Linux source filter uses (nix/linux/root-crates.json, read by nix/workspace-src.nix).
|
||||
# Usage: tools/kde-closure-check [REPO_ROOT] (default: the repository this script is in)
|
||||
# Works for the merged workspace (one root Cargo.toml) and for the old KDE workspace.
|
||||
set -euo pipefail
|
||||
root=$(cd "${1:-$(dirname "$0")/..}" && pwd)
|
||||
[ -d "$root/komorebi-for-kde" ] || root=$(cd "$root/.." && pwd)
|
||||
want=$(jq -r '.[]' "$root/komorebi-for-kde/nix/root-crates.json" | sort)
|
||||
if [ -f "$root/komorebi-for-kde/Cargo.toml" ]; then
|
||||
have=$(cd "$root/komorebi-for-kde" && nice -n 19 cargo metadata --offline --format-version 1 \
|
||||
| jq -r --arg r "$root/" '.packages[] | select(.source == null) | .manifest_path
|
||||
| select(startswith($r) and (startswith($r + "komorebi-for-kde/") | not))
|
||||
| ltrimstr($r) | sub("/Cargo.toml$"; "")' | sort)
|
||||
else
|
||||
# merged workspace: the closure of the KDE packages on a Linux target
|
||||
have=$(cd "$root" && for p in komorebi-linux komorebic komorebi-client komorebi-hotkeys; do
|
||||
nice -n 19 cargo tree --offline --locked -p "$p" --target x86_64-unknown-linux-gnu --prefix none -e normal,build,dev 2>/dev/null
|
||||
done | grep -o "($root/[^)]*)" | tr -d '()' | sed "s#^$root/##" | grep -v '^komorebi-for-kde' | sort -u)
|
||||
fi
|
||||
# the list holds the crates the Linux source needs besides komorebi-linux, komorebi-hotkeys and komorebi-daemon
|
||||
want=$(jq -r '.[]' "$root/nix/linux/root-crates.json" | sort)
|
||||
# the closure of the Linux packages on a Linux target
|
||||
have=$(cd "$root" && for p in komorebi-linux komorebic komorebi-client komorebi-hotkeys komorebi; do
|
||||
nice -n 19 cargo tree --offline --locked -p "$p" --target x86_64-unknown-linux-gnu --prefix none -e normal,build,dev 2>/dev/null
|
||||
done | grep -o "($root/[^)]*)" | tr -d '()' | sed "s#^$root/##" \
|
||||
| grep -vx -e komorebi-linux -e komorebi-hotkeys -e komorebi-daemon | sort -u)
|
||||
if [ "$want" != "$have" ]; then
|
||||
echo "KDE source filter and cargo closure differ" >&2
|
||||
echo "Linux source filter and cargo closure differ" >&2
|
||||
diff <(echo "$want") <(echo "$have") | sed 's/^</ only in root-crates.json:/; s/^>/ only in cargo closure: /' >&2
|
||||
exit 1
|
||||
fi
|
||||
echo "ok: $(echo "$want" | wc -l) root crates match the KDE cargo closure"
|
||||
echo "ok: $(echo "$want" | wc -l) root crates match the Linux cargo closure"
|
||||
+2
-7
@@ -8,13 +8,8 @@ S="${FAST_CHECK_SCRATCH:-${XDG_CACHE_HOME:-$HOME/.cache}/komorebi-fast-check}"
|
||||
HERE="$(dirname "$(readlink -f "${BASH_SOURCE[0]}")")"
|
||||
ROOT="$(jj root 2>/dev/null || git rev-parse --show-toplevel)"
|
||||
cd "$ROOT"
|
||||
# merged root workspace (one Cargo.toml for the three platforms) or the old separate komorebi-for-mac workspace
|
||||
if [ -f komorebi-for-kde/Cargo.toml ]; then
|
||||
cd komorebi-for-mac
|
||||
PKGS=(--workspace)
|
||||
else
|
||||
PKGS=(-p komorebi -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar)
|
||||
fi
|
||||
# the macOS packages of the one workspace of the repository
|
||||
PKGS=(-p komorebi -p komorebi-macos -p komorebic -p komorebi-client -p komorebi-bar)
|
||||
export CARGO_TARGET_DIR="$S/target-fast-mac" COMMIT_HASH="${COMMIT_HASH:-dev}"
|
||||
export CC_aarch64_apple_darwin="$HERE/cc-fake.sh" AR_aarch64_apple_darwin=ar
|
||||
PKG_CONFIG_PATH="$(nix build --no-link --print-out-paths nixpkgs#openssl.dev)/lib/pkgconfig"
|
||||
|
||||
Reference in new issue
Block a user