build(just): one justfile for the three platforms

The root justfile now has the recipes of all three: the Windows ones (PowerShell loops
through [windows] recipes, as before) and unix variants of install, build and schemapub,
the KDE ones (lint, check-js, the VM recipes, run-kde, wsl2-probe, nixgen-linux), the
macOS nixgen, and jsonschema/docgen-local that write schemas/<platform> and
docs/<platform>/cli for the platform they run on. Package names are the unified ones (one
komorebic, komorebi, komorebi-bar everywhere) and all paths are the final directories.
komorebi-for-kde/justfile and komorebi-for-mac/justfile are deleted. The KDE
`just check` recipe (cargo test --workspace) is dropped: on Linux it builds the Windows crates;
the commands in docs/dev/build-and-test.md replace it.

Verified: just --list parses; just --dry-run jsonschema prints the right commands on Linux.
The recipes themselves were not run.
This commit is contained in:
LGUG2Z committed 2026-11-05 15:03:27 -08:00
1 parent 138a97e95c
commit d726ec8ddb
3 files changed
+128 -205

No files matched your search

+128 -23
View File
@@ -2,63 +2,111 @@ set windows-shell := ["pwsh.exe", "-NoLogo", "-Command"]
export RUST_BACKTRACE := "full"
# The binaries are the same three packages on every platform; Windows has three more.
windows_targets := "komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts"
unix_targets := "komorebic komorebi komorebi-bar"
# the platform of the schemas and docs that `jsonschema` and `docgen` write
platform := if os() == "windows" { "windows" } else if os() == "macos" { "macos" } else { "linux" }
clean:
cargo clean
# format the Rust sources with the nightly rustfmt (tools/format-all does it for every file, as the nix checks do)
fmt:
cargo +nightly fmt
cargo +stable clippy
prettier --write .github/ISSUE_TEMPLATE/bug_report.yml
prettier --write .github/ISSUE_TEMPLATE/config.yml
prettier --write .github/ISSUE_TEMPLATE/feature_request.yml
prettier --write .github/dependabot.yml
prettier --write .github/FUNDING.yml
prettier --write .github/workflows/windows.yaml
fix:
cargo clippy --fix --allow-dirty
# the macros the codebase has agreed not to use, the workflows (actionlint, shellcheck) and the probe script
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)
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
[unix]
install-targets *targets:
for target in {{ targets }}; do just install-target $target; done
[windows]
install-targets *targets:
"{{ targets }}" -split ' ' | ForEach-Object { just install-target $_ }
install-target target:
cargo +stable install --path {{ target }} --locked --no-default-features
[unix]
install-targets-with-jsonschema *targets:
for target in {{ targets }}; do just install-target-with-jsonschema $target; done
[windows]
install-targets-with-jsonschema *targets:
"{{ targets }}" -split ' ' | ForEach-Object { just install-target-with-jsonschema $_ }
install-target-with-jsonschema target:
cargo +stable install --path {{ target }} --locked
[unix]
install:
just install-targets komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts
just install-targets {{ unix_targets }}
[windows]
install:
just install-targets {{ windows_targets }}
[unix]
install-with-jsonschema:
just install-targets-with-jsonschema komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts
just install-targets-with-jsonschema {{ unix_targets }}
[windows]
install-with-jsonschema:
just install-targets-with-jsonschema {{ windows_targets }}
[unix]
build-targets *targets:
for target in {{ targets }}; do just build-target $target; done
[windows]
build-targets *targets:
"{{ targets }}" -split ' ' | ForEach-Object { just build-target $_ }
build-target target:
cargo +stable build --package {{ target }} --locked --release --no-default-features
[unix]
build:
just build-targets komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts
just build-targets {{ unix_targets }}
[windows]
build:
just build-targets {{ windows_targets }}
[windows]
copy-target target:
cp .\target\release\{{ target }}.exe $Env:USERPROFILE\.cargo\bin
[windows]
copy-targets *targets:
"{{ targets }}" -split ' ' | ForEach-Object { just copy-target $_ }
[windows]
wpm target:
just build-target {{ target }} && wpmctl stop {{ target }}; just copy-target {{ target }} && wpmctl start {{ target }}
[windows]
copy:
just copy-targets komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts
just copy-targets {{ windows_targets }}
run target:
cargo +stable run --bin {{ target }} --locked --no-default-features
run target *args:
cargo +stable run --bin {{ target }} --locked --no-default-features -- {{ args }}
warn target $RUST_LOG="warn":
just run {{ target }}
@@ -75,24 +123,52 @@ trace target $RUST_LOG="trace":
deadlock $RUST_LOG="trace":
cargo +stable run --bin komorebi --locked --no-default-features --features deadlock_detection
docgen starlight:
rm {{ starlight }}/src/data/cli/windows/*.md
cargo run --package komorebic -- docgen --output {{ starlight }}/src/data/cli/windows
schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-windows.mdx --title "komorebi.json (Windows)" --description "komorebi for Windows configuration schema reference"
schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-windows.mdx --title "komorebi.bar.json (Windows)" --description "komorebi-bar for Windows configuration schema reference"
# the JSON Schemas of the platform this runs on, from the Rust types, into schemas/<platform>/
jsonschema:
cargo run --package komorebic -- static-config-schema > schema.json
cargo run --package komorebic -- application-specific-configuration-schema > schema.asc.json
cargo run --package komorebi-bar -- --schema > schema.bar.json
cargo run --package komorebic --locked -- static-config-schema > schemas/{{ platform }}/schema.json
cargo run --package komorebic --locked -- application-specific-configuration-schema > schemas/{{ platform }}/schema.asc.json
{{ if platform == "linux" { "true" } else { "cargo run --package komorebi-bar --locked -- --schema > schemas/" + platform + "/schema.bar.json" } }}
# the help of every komorebic subcommand of the platform this runs on, one page each: docs/cli (Windows),
# docs/linux/cli or docs/macos/cli
docgen-local:
cargo run --package komorebic --locked -- docgen --output {{ if platform == "windows" { "docs/cli" } else { "docs/" + platform + "/cli" } }}
# the reference pages of the Windows or macOS site, from the schemas and the command line
docgen starlight:
rm {{ starlight }}/src/data/cli/{{ platform }}/*.md
cargo run --package komorebic -- docgen --output {{ starlight }}/src/data/cli/{{ platform }}
schemars-docgen ./schemas/{{ platform }}/schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-{{ platform }}.mdx --title "komorebi.json ({{ platform }})" --description "komorebi configuration schema reference for {{ platform }}"
schemars-docgen ./schemas/{{ platform }}/schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-{{ platform }}.mdx --title "komorebi.bar.json ({{ platform }})" --description "komorebi-bar configuration schema reference for {{ platform }}"
# the options of the NixOS module (KDE) and the darwin module (macOS), from the schemas; needs schemars-nixgen
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"
nixgen-macos:
schemars-nixgen schemas/macos/schema.json -o nix/macos/komorebi-options.nix --name komorebi --description "komorebi for Mac configuration"
schemars-nixgen schemas/macos/schema.bar.json -o nix/macos/komorebi-bar-options.nix --name komorebi-bar --description "komorebi for Mac bar configuration"
nix fmt nix/macos/
nix build -f nix/macos/tests/default.nix
version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi") | .version'`
[unix]
schemapub:
rm -rf komorebi-schema
mkdir -p komorebi-schema
cp schemas/{{ platform }}/schema.json komorebi-schema/komorebi.{{ version }}.schema.json
cp schemas/{{ platform }}/schema.bar.json komorebi-schema/komorebi.bar.{{ version }}.schema.json
npx wrangler pages deploy --project-name komorebi --branch main ./komorebi-schema
[windows]
schemapub:
rm -Force komorebi-schema
mkdir -Force komorebi-schema
cp schema.json komorebi-schema/komorebi.{{ version }}.schema.json
cp schema.bar.json komorebi-schema/komorebi.bar.{{ version }}.schema.json
cp schemas/windows/schema.json komorebi-schema/komorebi.{{ version }}.schema.json
cp schemas/windows/schema.bar.json komorebi-schema/komorebi.bar.{{ version }}.schema.json
npx wrangler pages deploy --project-name komorebi --branch main .\komorebi-schema
depcheck:
@@ -107,6 +183,35 @@ depgen:
cargo deny check
cargo deny list --format json | jq 'del(.unlicensed)' > dependencies.json
[windows]
procdump:
cargo build --bin komorebi
.\procdump.exe -ma -e -x . .\target\debug\komorebi.exe
# probe a NixOS-WSL2 machine for KVM, WSLg, a GPU and RDP (docs/linux/dev/wsl2-probe.md): `just wsl2-probe --dry-run`
wsl2-probe *args:
nix run .#wsl2-probe -- {{ args }}
# one KDE VM test on this machine: `just vm kwin` (docs/linux/dev/vm-tests.md)
vm name:
#!/usr/bin/env bash
set -euo pipefail
if [ "$(uname)" = Darwin ]; then
scripts/linux/vm-mac {{ name }}
else
nix build -L .#checks.{{ arch() }}-linux.vm-{{ name }}
fi
# every KDE VM test, in the order of the flake
vm-all:
#!/usr/bin/env bash
set -euo pipefail
system=$(nix eval --raw --impure --expr builtins.currentSystem)
for name in $(nix eval --json ".#legacyPackages.$system.vm" --apply builtins.attrNames | jq -r '.[]'); do
just vm "$name"
done
# the demo guest in a virtual machine, with komorebi tiling a few windows (docs/linux/trying-it.md);
# `just run-kde --doctor` says what this machine is missing
run-kde *args:
nix run .#run-kde -- {{ args }}
-77
View File
@@ -1,77 +0,0 @@
export RUST_BACKTRACE := "full"
# format the Rust sources (needs a nightly rustfmt: rustfmt.toml uses unstable options)
fmt:
cargo fmt
# everything a change has to pass before it is pushed
check: lint check-js
cargo fmt --check
cargo clippy --workspace --all-targets --locked -- -D warnings
cargo test --workspace --locked
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
# the KWin bridge, which is JavaScript: its types, checked by tsc from its JSDoc comments, and its
# tests, which node runs against a fake KWin (no package.json, no build step)
check-js:
cd komorebi/src/kwin && tsc -p tsconfig.json
node --test komorebi/src/kwin/bridge.test.js
# the macros the codebase has agreed not to use, the workflows, which actionlint checks (with
# shellcheck over their scripts), and the probe script, all with the tools of the nixpkgs flake.lock pins
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/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/wsl2-probe.sh
# the JSON Schemas of komorebi.json and of applications.json, from the Rust types
jsonschema:
cargo run --package komorebic-linux --locked -- static-config-schema > schema.json
cargo run --package komorebic-linux --locked -- application-specific-configuration-schema > schema.asc.json
# the options of the module's `config`, from schema.json, with the hash of the schema they were
# made from in the first line (written by schemars-nixgen; the check `schema-fresh` compares it); needs schemars-nixgen
# (`cargo install schemars-nixgen`), which the dev shell does not have
nixgen:
schemars-nixgen schema.json -o nix/komorebi-options.nix --name komorebi --description "komorebi for KDE Plasma configuration"
nix fmt nix/komorebi-options.nix
nix build -L --no-link ".#checks.$(nix eval --raw --impure --expr builtins.currentSystem).nix-options-validation"
# probe a NixOS-WSL2 machine for KVM, WSLg, a GPU and RDP (docs/dev/wsl2-probe.md): `just wsl2-probe --dry-run`
wsl2-probe *args:
nix run .#wsl2-probe -- {{ args }}
# one VM test, on this machine: `just vm kwin`. Linux boots the guest under KVM through the
# flake check; a Mac builds the guest on a builder and runs the driver (see docs/dev/vm-tests.md)
vm name:
#!/usr/bin/env bash
set -euo pipefail
if [ "$(uname)" = Darwin ]; then
scripts/vm-mac {{ name }}
else
nix build -L .#checks.{{ arch() }}-linux.vm-{{ name }}
fi
# every VM test, in the order of the flake
vm-all:
#!/usr/bin/env bash
set -euo pipefail
system=$(nix eval --raw --impure --expr builtins.currentSystem)
for name in $(nix eval --json ".#legacyPackages.$system.vm" --apply builtins.attrNames | jq -r '.[]'); do
just vm "$name"
done
# write the help of every komorebic subcommand to docs/cli, one page each
docgen:
rm -f docs/cli/*.md
cargo run --package komorebic-linux --locked -- docgen --output docs/cli
# the demo guest in a virtual machine, with komorebi tiling a few windows (docs/trying-it.md);
# `just run-kde --doctor` says what this machine is missing
run-kde *args:
nix run .#run-kde -- {{ args }}
run target *args:
cargo run --bin {{ target }} --locked -- {{ args }}
-105
View File
@@ -1,105 +0,0 @@
export RUST_BACKTRACE := "full"
fmt:
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/src)" || (echo "println! macro not allowed"; false)
cargo clippy
prettier --write README.md
nix fmt
fix:
cargo clippy --fix --allow-dirty
clean:
cargo clean
install-targets *targets:
for target in {{ targets }}; do just install-target $target; done
install-target target:
cargo install --path {{ target }} --locked --no-default-features
install-targets-with-jsonschema *targets:
for target in {{ targets }}; do just install-target-with-jsonschema $target; done
install-target-with-jsonschema target:
cargo install --path {{ target }} --locked
install:
just install-targets komorebic komorebi komorebi-bar
install-with-jsonschema:
just install-targets-with-jsonschema komorebic komorebic-no-console komorebi komorebi-bar komorebi-gui komorebi-shortcuts
build-targets *targets:
for target in {{ targets }}; do just build-target $target; done
build-target target:
cargo build --package {{ target }} --locked --release --no-default-features
build:
just build-targets komorebic komorebi komorebi-bar
run target:
cargo run --bin {{ target }} --locked
error target $RUST_LOG="komorebi=error":
just run {{ target }}
warn target $RUST_LOG="komorebi=warn":
just run {{ target }}
info target $RUST_LOG="komorebi=info":
just run {{ target }}
debug target $RUST_LOG="komorebi=debug":
just run {{ target }}
trace target $RUST_LOG="komorebi=trace":
just run {{ target }}
deadlock $RUST_LOG="trace":
cargo run --bin komorebi --locked --no-default-features --features deadlock_detection
docgen starlight:
rm {{ starlight }}/src/data/cli/macos/*.md
cargo run --package komorebic-macos -- docgen --output {{ starlight }}/src/data/cli/macos
schemars-docgen ./schema.json --output {{ starlight }}/src/content/docs/reference/komorebi-macos.mdx --title "komorebi.json (macOS)" --description "komorebi for Mac configuration schema reference"
schemars-docgen ./schema.bar.json --output {{ starlight }}/src/content/docs/reference/bar-macos.mdx --title "komorebi.bar.json (macOS)" --description "komorebi-bar for Mac configuration schema reference"
jsonschema:
cargo run --package komorebic-macos -- static-config-schema > schema.json
cargo run --package komorebic-macos -- application-specific-configuration-schema > schema.asc.json
cargo run --package komorebi-bar-macos -- --schema > schema.bar.json
nixgen:
schemars-nixgen schema.json -o nix/komorebi-options.nix --name komorebi --description "komorebi for Mac configuration"
schemars-nixgen schema.bar.json -o nix/komorebi-bar-options.nix --name komorebi-bar --description "komorebi for Mac bar configuration"
nix fmt nix/
nix build -f nix/tests/default.nix
version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi-macos") | .version'`
schemapub:
rm -rf komorebi-schema
mkdir -p komorebi-schema
cp schema.json komorebi-schema/komorebi.{{ version }}.schema.json
cp schema.bar.json komorebi-schema/komorebi.bar.{{ version }}.schema.json
wrangler pages deploy --project-name komorebi-for-mac --branch main ./komorebi-schema
depcheck:
cargo outdated --depth 2
cargo udeps --quiet
deps:
cargo update
just depgen
depgen:
cargo deny check
cargo deny list --format json | jq 'del(.unlicensed)' > dependencies.json
push:
git push origin master
git push komocorp master