build(tools): route the justfile and tools to crates/

This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:27 -08:00
1 parent 279ac0f759
commit c234b1d884
7 files changed
+42 -32

No files matched your search

+12 -2
View File
@@ -379,12 +379,22 @@ def main():
schemas = [
SchemaConfig(
schema_file="schema.json",
search_paths=["komorebi/src", "komorebi-themes/src"],
search_paths=[
"crates/komorebi-windows/src",
"crates/komorebi-config/src",
"crates/komorebi-settings/src",
"crates/komorebi-layouts/src",
"crates/komorebi-themes/src",
],
display_name="komorebi",
),
SchemaConfig(
schema_file="schema.bar.json",
search_paths=["komorebi-bar/src", "komorebi-themes/src"],
search_paths=[
"komorebi-bar/src",
"crates/komorebi-bar-core/src",
"crates/komorebi-themes/src",
],
display_name="komorebi-bar",
),
]
+1 -1
View File
@@ -153,7 +153,7 @@ say it can go).
## Pieces
`guest.py` (QEMU, swtpm, the overlay), `qmp.py` (keys, pointer, screenshots),
`agent.py` and `../../guest/agent` (windows, processes and files in the guest
`agent.py` and `../../../crates/komorebi-e2e-agent` (windows, processes and files in the guest
over TCP), `windows_platform.py` (the shared `Platform` protocol), `run.py`
(the runner), `extras/` (what only Windows checks), `display.ps1` (changes the
mode of a display), `w1_*.py` (probes, each prints what it saw).
+9 -12
View File
@@ -52,9 +52,6 @@ cargo_stable := "env -u CARGO_BUILD_TARGET cargo" + if env("IN_NIX_SHELL", "") =
[unix]
cargo_nightly := "env -u CARGO_BUILD_TARGET cargo" + if env("IN_NIX_SHELL", "") == "" { " +nightly" } else { "" }
# the directory of a target's package: the `komorebi` binary is the package in komorebi-daemon
daemon_dir := "komorebi-daemon"
clean:
cargo clean
@@ -70,14 +67,14 @@ fix:
lint:
test -z "$(rg 'eyre!' --type rust .)" || (echo "eyre! macro not allowed"; false)
test -z "$(rg 'dbg!' --type rust .)" || (echo "dbg! macro not allowed"; false)
test -z "$(rg 'println!' --type rust ./komorebi-linux/src ./komorebi-macos/src)" || (echo "println! macro not allowed"; false)
test -z "$(rg 'println!' --type rust ./crates/komorebi-linux/src ./crates/komorebi-macos/src)" || (echo "println! macro not allowed"; false)
nix shell --inputs-from . nixpkgs#actionlint nixpkgs#shellcheck --command actionlint .github/workflows/*.yaml
nix shell --inputs-from . nixpkgs#shellcheck --command shellcheck scripts/linux/wsl2-probe.sh
# the KWin bridge of the KDE daemon (JavaScript): its types by tsc, its tests by node against a fake KWin
check-js:
cd komorebi-linux/src/kwin && tsc -p tsconfig.json
node --test komorebi-linux/src/kwin/bridge.test.js
cd crates/komorebi-linux/src/kwin && tsc -p tsconfig.json
node --test crates/komorebi-linux/src/kwin/bridge.test.js
[unix]
install-targets *targets:
@@ -92,7 +89,7 @@ install-targets *targets:
check-target target ok=(if target =~ "^(" + replace(targets, " ", "|") + ")$" { "" } else { error(target + " is not built on " + platform + ", the targets are: " + targets) }):
install-target target: (check-target target)
{{ cargo_stable }} install --path {{ if target == "komorebi" { daemon_dir } else { target } }} --locked --no-default-features
{{ cargo_stable }} install --path {{ target }} --locked --no-default-features
[unix]
install-targets-with-jsonschema *targets:
@@ -103,7 +100,7 @@ install-targets-with-jsonschema *targets:
"{{ targets }}" -split ' ' | ForEach-Object { just install-target-with-jsonschema $_ }
install-target-with-jsonschema target: (check-target target)
{{ cargo_stable }} install --path {{ if target == "komorebi" { daemon_dir } else { target } }} --locked
{{ cargo_stable }} install --path {{ target }} --locked
install:
just install-targets {{ targets }}
@@ -167,12 +164,12 @@ jsonschema: && jsonschema-bar
{{ cargo_stable }} run --package komorebic --locked -- application-specific-configuration-schema > schemas/{{ platform }}/schema.asc.json
# Linux has no bar, so no schema of one
[private]
[linux]
[private]
jsonschema-bar:
[private]
[macos]
[private]
[windows]
jsonschema-bar:
{{ cargo_stable }} run --package komorebi-bar --locked -- --schema > schemas/{{ platform }}/schema.bar.json
@@ -183,8 +180,8 @@ jsonschema-bar:
docgen-local:
{{ cargo_stable }} run --package komorebic --locked -- docgen --output docs/cli
[macos]
[linux]
[macos]
docgen-local:
{{ cargo_stable }} run --package komorebic --locked -- docgen --output docs/{{ platform }}/cli
@@ -212,8 +209,8 @@ nixgen-macos:
version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi") | .version'`
[macos]
[linux]
[macos]
schemapub: schemapub-files
npx wrangler pages deploy --project-name komorebi --branch main ./komorebi-schema
+5 -5
View File
@@ -31,11 +31,11 @@ this tool.
| touched | check (tier) |
|---|---|
| `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 |
| `crates/komorebi-linux/**`, `crates/komorebi-hotkeys/**`, `scripts/linux/**`, the Linux files of `komorebic`/`crates/komorebi-client`/`komorebi` | `cargo check`, `cargo test --lib` and `--test schemas -- --test-threads=1` of the Linux daemon package (1) |
| `crates/komorebi-macos/**`, the macOS files of `komorebic`/`crates/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 (`crates/komorebi-windows/`, `komorebi-gui/`, `crates/komorebi-e2e-agent/`, ..., `e2e/`), `Cargo.*` | `nix develop --command cargo clippy --locked --all-targets -- -D warnings` (2) |
| `crates/komorebi-layouts/`, `crates/komorebi-scrolling/` | native `cargo test` of both plus the Windows check |
| the other `crates/**` | native tests, plus the KDE, macOS and Windows checks |
| `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 |
+3 -3
View File
@@ -61,9 +61,9 @@ while IFS= read -r f; do
reason=""
case "$f" in
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" ;;
e2e/*|crates/komorebi-e2e-agent/*) reason="e2e harness / guest" ;;
*/build.rs) reason="build script" ;;
komorebi-linux/*|komorebi-hotkeys/*|komorebi-macos/*|nix/linux/*|nix/macos/*|scripts/linux/*|schemas/linux/*|schemas/macos/*) ;; # the other platforms, not in the Windows closure
crates/komorebi-linux/*|crates/komorebi-hotkeys/*|crates/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,7 +79,7 @@ while IFS= read -r f; do
fi
if [ -z "$reason" ]; then
case "$f" in
komorebi-linux/*|komorebi-hotkeys/*|komorebi-macos/*|nix/linux/*|nix/macos/*|scripts/linux/*|schemas/linux/*|schemas/macos/*|*.md|docs/*|tools/*|.github/*) ;;
crates/komorebi-linux/*|crates/komorebi-hotkeys/*|crates/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 ;;
+10 -7
View File
@@ -65,16 +65,19 @@ while IFS= read -r f; do
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 ;;
# the platform crates and the crates of one set, before the `crates/*` catch-all
crates/komorebi-layouts/* | crates/komorebi-scrolling/*) want_native=1; want_win=1 ;;
crates/komorebi-linux/* | crates/komorebi-hotkeys/* | scripts/linux/*) want_kde=1 ;;
crates/komorebi-macos/*) want_mac=1 ;;
crates/komorebi-windows/* | crates/komorebi-themes/* | crates/komorebi-e2e-agent/* | crates/komorebi-testwin/*) want_win=1 ;;
komorebic/src/linux* | komorebic/tests/linux_* | crates/komorebi-client/src/linux.rs | crates/komorebi-client/tests/linux_* | komorebi/tests/linux_*) want_kde=1 ;;
komorebic/src/macos* | crates/komorebi-client/src/macos.rs | komorebi-bar/src/macos*) want_mac=1 ;;
crates/komorebi-client/*) 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 ;;
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 ;;
komorebi/* | komorebic/*) want_win=1; want_kde=1; want_mac=1 ;;
*.md | docs/* | tools/* | LICENSE* | .github/* | *.png | *.jpg | *.gif) ;;
komorebi-windows/* | komorebi-gui/* | komorebi-shortcuts/* | komorebic-no-console/* | komorebi-themes/* | e2e/*)
komorebi-gui/* | komorebi-shortcuts/* | komorebic-no-console/* | e2e/*)
want_win=1 ;;
*) unclassified+=("$f") ;;
esac
+2 -2
View File
@@ -4,13 +4,13 @@
# Usage: tools/kde-closure-check [REPO_ROOT] (default: the repository this script is in)
set -euo pipefail
root=$(cd "${1:-$(dirname "$0")/..}" && pwd)
# the list holds the crates the Linux source needs besides komorebi-linux, komorebi-hotkeys and komorebi-daemon
# the list holds the crates the Linux source needs besides crates/komorebi-linux, crates/komorebi-hotkeys and komorebi
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)
| grep -vx -e crates/komorebi-linux -e crates/komorebi-hotkeys -e komorebi | sort -u)
if [ "$want" != "$have" ]; then
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