mirror of
https://github.com/LGUG2Z/komorebi.git
synced 2026-11-13 12:23:38 +01:00
docs(recorder): the recorder is documented as part of the komorebi repository
This commit is contained in:
1 parent
a0f7d871e5
commit
e499ebb774
8 files changed
+37
-104
No files matched your search
@@ -140,8 +140,8 @@ Tiers (the `tier` in each suite's `default.nix`; CI runs `fast` on every pull re
|
||||
|
||||
To run only some steps of a suite: `E2E_ONLY=stacks,monocle nix build --impure .#legacyPackages.x86_64-linux.vm.core-e2e -L`
|
||||
(a substring of the printed `module.function`; `KFDE_ONLY` is the old name).
|
||||
To record a run: `KOMOREBI_RECORDER=$(nix build ~/komorebi-recorder#komorebi-recorder --no-link --print-out-paths)
|
||||
nix build --impure .#legacyPackages.x86_64-linux.vm.core-lock -L` (the recorder's repository is private; `core-e2e` and
|
||||
To record a run: `KOMOREBI_RECORDER=$(nix build .#komorebi-recorder --no-link --print-out-paths)
|
||||
nix build --impure .#legacyPackages.x86_64-linux.vm.core-lock -L` (`core-e2e` and
|
||||
`core-lock` keep `recording-NAME.tar.gz`). Details, the library and how to add a suite:
|
||||
[docs/linux/dev/vm-tests.md](../linux/dev/vm-tests.md). The suites use a daemon
|
||||
built once with the constant stamp, so a new commit does not rebuild it.
|
||||
|
||||
@@ -402,11 +402,11 @@ the fake and fails on KDE has found a bug in the fake, the library or the daemon
|
||||
|
||||
## Recording a run with komorebi-recorder
|
||||
|
||||
`komorebi-recorder`'s repository is private, so it is not an input of the flake. A run that wants
|
||||
it builds it elsewhere and passes the store path, evaluating with `--impure`:
|
||||
`komorebi-recorder` is a package of this flake (`.#komorebi-recorder`), but the suites do not depend on it:
|
||||
a run that wants it builds it and passes the store path, evaluating with `--impure`:
|
||||
|
||||
```sh
|
||||
KOMOREBI_RECORDER=$(nix build ~/komorebi-recorder#komorebi-recorder --no-link --print-out-paths) \
|
||||
KOMOREBI_RECORDER=$(nix build .#komorebi-recorder --no-link --print-out-paths) \
|
||||
nix build --impure .#legacyPackages.x86_64-linux.vm.core-lock -L
|
||||
```
|
||||
|
||||
|
||||
@@ -42,7 +42,7 @@ The rest of the crate never names a system API. [`platform`](../komorebi-recorde
|
||||
small modules (`clock`, `shell` and, as the recorder grows, `capture`, `power`, `session`, `trace`, `process`, `apps`
|
||||
and `window`), and `cfg` selects the directory behind it: `platform/macos/`, `platform/win/` or `platform/unsupported.rs`.
|
||||
Each host provides the same names with the same signatures. A missing or mismatched function is a compile error on the
|
||||
host being built, and on no other, so the Windows host is built from a Mac by `just check-windows` and by CI, and
|
||||
host being built, and on no other, so the Windows host is built from a Mac by `nix build .#checks.x86_64-linux.windows-clippy` and by CI, and
|
||||
`unsupported` (which exists so that the commands that only read a session directory work on a Linux agent box) is built
|
||||
only on a third OS.
|
||||
|
||||
@@ -103,7 +103,7 @@ schema, warnings, whether it was truncated and a cursor, and failures exit with
|
||||
|
||||
| Rule | Enforced by |
|
||||
|---|---|
|
||||
| Every host provides the same functions with the same signatures | the compiler, for the host being built; `just check-windows` and CI build the Windows host from a Mac; nothing builds `unsupported` |
|
||||
| Every host provides the same functions with the same signatures | the compiler, for the host being built; `nix build .#checks.x86_64-linux.windows-clippy` and CI build the Windows host from a Mac; nothing builds `unsupported` |
|
||||
| A timestamp in a session is on the master clock | convention, and the tests that place records at known times: the type is a plain `u64` |
|
||||
| An implementor of `Rules` answers every question that has no default | the type system: a missing method is E0046, proved by a `compile_fail` example on `Rules` |
|
||||
| Code that reads komorebi's output asks `Rules` and does not match on `Flavor` | convention only |
|
||||
|
||||
@@ -46,16 +46,17 @@ OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
||||
|
||||
## Development environment
|
||||
|
||||
The project is built with Nix. `nix develop` (or direnv, whose `.envrc` is `use flake`) provides the
|
||||
Rust toolchain with nightly `rustfmt`, `cargo-deny`, `cargo-nextest`, `ffmpeg`, `jq`, `just`,
|
||||
`resvg` and `ripgrep`, and sets `KOMOREBI_MAC_SRC` and `KOMOREBI_WINDOWS_SRC` (with `_COMMIT`) to the komorebi
|
||||
sources pinned in `flake.lock`. The tests that read komorebi's source need them, so run `cargo` inside
|
||||
the shell.
|
||||
The recorder is built in the komorebi repository, with Nix. `nix develop` provides the Rust toolchain with
|
||||
nightly `rustfmt`, `cargo-deny`, `cargo-nextest`, `ffmpeg`, `jq`, `just`, `resvg` and `ripgrep`, and on Linux the
|
||||
GStreamer libraries. The recorder indexes the log statements of the komorebi source around it
|
||||
(`komorebi-recorder/build.rs`), so the tests that read it need no setting: `KOMOREBI_SRC` and
|
||||
`KOMOREBI_COMMIT` are only for a build outside a checkout (nix).
|
||||
|
||||
The Windows code is type-checked from a Mac with `nix develop .#windows`, whose target is
|
||||
`x86_64-pc-windows-msvc`. Nothing there runs it: a change to a `cfg(windows)` line is first run by the
|
||||
`windows` job in CI.
|
||||
On a Windows machine, the steps in [docs/dev/windows-checkpoints.md](docs/dev/windows-checkpoints.md)
|
||||
The default `nix develop` shell cross-compiles for `x86_64-pc-windows-msvc`, which type-checks the Windows code
|
||||
from a Mac or Linux machine (`just` drops that target for the native recipes). `nix develop .#native` leaves the
|
||||
target out. Nothing there runs the Windows code: a change to a `cfg(windows)` line is first run by the
|
||||
Windows workflow in CI.
|
||||
On a Windows machine, the steps in [windows-checkpoints.md](dev/windows-checkpoints.md)
|
||||
say what to run and what to look for.
|
||||
|
||||
The icon is `komorebi-recorder/assets/watermelon.svg`. After changing it, run `just icon` to render the PNG that
|
||||
@@ -66,11 +67,13 @@ the windows set and the ICO that Windows embeds, and commit the three together.
|
||||
Before pushing, run
|
||||
|
||||
```sh
|
||||
just check
|
||||
just fmt
|
||||
just lint
|
||||
nix build -L .#checkSets.recorder-lint .#checkSets.recorder-test .#checkSets.fmt .#checkSets.deny
|
||||
```
|
||||
|
||||
which runs formatting, clippy and the tests for macOS, clippy for Windows, rustdoc with its warnings as
|
||||
errors for both hosts, and `cargo deny`. `just --list` shows the other recipes.
|
||||
which formats, runs the macros the codebase does not allow, and runs clippy and the tests of the recorder, the
|
||||
format checks and `cargo deny` of the workspace. `just --list` shows the other recipes.
|
||||
|
||||
## Commits
|
||||
|
||||
|
||||
@@ -196,5 +196,5 @@ desktop, so an analysis of a KDE session says so, as it does for Windows.
|
||||
prints nowhere, and start komorebi with `--log-level debug` and `RUST_LOG=komorebi=debug`.
|
||||
- **Investigating on any host.** A session is read the same everywhere. `ffmpeg` is needed only for `frames` and
|
||||
`selftest`.
|
||||
- **Changing code that has a host-specific part.** Provide the function on every host, and run `just check-windows` from a
|
||||
- **Changing code that has a host-specific part.** Provide the function on every host, and run `nix build .#checks.x86_64-linux.windows-clippy` from a
|
||||
Mac: it type-checks every `cfg(windows)` line, tests included.
|
||||
@@ -20,9 +20,9 @@ ls result-windows/bin
|
||||
```
|
||||
|
||||
Copy `komorebi-recorder.exe` to the Windows machine. The `windows` job of CI builds the same executables natively and
|
||||
uploads them, with the installer, as artifacts of the run. To check that the Windows code still type-checks
|
||||
without building it: `nix flake check` (the `komorebi-recorder-windows-clippy` check) or
|
||||
`nix develop .#windows --command cargo clippy --all-targets`.
|
||||
uploads them, with the komorebi installer that carries them, as artifacts of the run. To check that the Windows
|
||||
code still type-checks without building it: `nix build .#checks.x86_64-linux.windows-clippy` or, in the default
|
||||
`nix develop` shell, `cargo clippy -p komorebi-recorder --all-targets`.
|
||||
|
||||
## W0: what komorebi for Windows really sends
|
||||
|
||||
|
||||
@@ -24,16 +24,17 @@ SmartScreen and Defender may warn about them.
|
||||
|
||||
### From source
|
||||
|
||||
The repository is a Nix flake. In a checkout:
|
||||
The recorder is a crate of the komorebi repository, and ships in the komorebi release, installer included. In a
|
||||
checkout of the repository:
|
||||
|
||||
```sh
|
||||
nix develop # the toolchain and the pinned komorebi sources
|
||||
nix develop # the toolchain, ffmpeg and the rest
|
||||
cargo install --path komorebi-recorder --locked
|
||||
```
|
||||
|
||||
`nix build` makes the macOS binary in `./result/bin`, and `nix build .#komorebi-recorder-windows` cross-compiles
|
||||
`komorebi-recorder.exe` and, with it, `komorebi-recorder-gui.exe` from a Mac. `nix run github:LGUG2Z/komorebi-recorder`
|
||||
runs the latest commit without a checkout.
|
||||
`nix build .#komorebi-recorder` makes the macOS or Linux binary, and `nix build .#windows-komorebi-recorder`
|
||||
cross-compiles `komorebi-recorder.exe` (and `.#windows-komorebi-recorder-gui` the viewer) from either.
|
||||
`nix run github:LGUG2Z/komorebi#komorebi-recorder` runs the latest commit without a checkout.
|
||||
|
||||
## Record a bug
|
||||
|
||||
@@ -106,9 +107,11 @@ rewritten after they are written.
|
||||
|
||||
## Checks
|
||||
|
||||
`just check` runs formatting, clippy and the tests for macOS, clippy for Windows (the Windows code is type-checked
|
||||
from a Mac, not run), rustdoc with its warnings as errors for both hosts, and `cargo deny`. It needs `nix develop`.
|
||||
CI runs the same checks, builds both platforms and, for Windows, the installer.
|
||||
The recorder is checked with the rest of the repository. `nix build .#checkSets.recorder-lint` and
|
||||
`.#checkSets.recorder-test` are its clippy and tests on this host, and the `windows-*` checks type-check its
|
||||
Windows code from a Mac or Linux machine (`windows-clippy`; the Windows tests only compile there, and run in the
|
||||
guest). CI runs the same sets, and the Windows workflow builds the executables and the komorebi installer that
|
||||
carries them.
|
||||
|
||||
## Documentation
|
||||
|
||||
|
||||
@@ -1,73 +0,0 @@
|
||||
export RUST_BACKTRACE := "full"
|
||||
|
||||
# everything CI checks, in order; run it inside `nix develop` (direnv does)
|
||||
check: fmt-check clippy check-windows test doc deny
|
||||
|
||||
# nightly rustfmt, which the devShell provides, and the macros this project does not allow
|
||||
fmt-check:
|
||||
test -z "$(rg 'eyre!' --type rust)" || (echo "eyre! macro not allowed"; false)
|
||||
test -z "$(rg 'dbg!' --type rust)" || (echo "dbg! macro not allowed"; false)
|
||||
cargo fmt --check
|
||||
|
||||
# format everything: Rust, TOML, Nix and this file
|
||||
fmt:
|
||||
cargo clippy --workspace --all-targets --locked
|
||||
nix fmt
|
||||
|
||||
fix:
|
||||
cargo clippy --workspace --all-targets --fix --allow-dirty
|
||||
|
||||
clippy:
|
||||
cargo clippy --workspace --all-targets --locked -- -D warnings
|
||||
|
||||
# type-check every `cfg(windows)` line, tests included, from a Mac (the Windows devShell targets x86_64-pc-windows-msvc)
|
||||
check-windows:
|
||||
nix develop .#windows --command cargo clippy --workspace --all-targets --locked -- -D warnings
|
||||
|
||||
# lib, integration and doc tests; the ones that read komorebi's source need KOMOREBI_MAC_SRC, which `nix develop` sets
|
||||
test:
|
||||
cargo test --workspace --locked
|
||||
|
||||
# rustdoc with its warnings as errors, for both hosts: links in `cfg(windows)` docs are only checked on Windows
|
||||
doc:
|
||||
RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
|
||||
nix develop .#windows --command env RUSTDOCFLAGS="-D warnings" cargo doc --workspace --no-deps --locked
|
||||
|
||||
deny:
|
||||
cargo deny check
|
||||
|
||||
clean:
|
||||
cargo clean
|
||||
|
||||
install:
|
||||
cargo install --path komorebi-recorder --locked
|
||||
|
||||
build:
|
||||
cargo build --package komorebi-recorder --locked --release
|
||||
|
||||
# the recorder opens the viewer as komorebi-recorder-gui, a separate executable beside it, which `cargo run` of
|
||||
# the recorder alone would not rebuild: build both
|
||||
run target:
|
||||
cargo build --bins --locked
|
||||
cargo run --bin {{ target }} --locked
|
||||
|
||||
# record a bug repro: screen + komorebi log/events + OS trace, then query it with `komorebi-recorder at`
|
||||
record *args:
|
||||
cargo build --bins --locked
|
||||
cargo run --bin komorebi-recorder --locked -- {{ args }}
|
||||
|
||||
# cross-compile komorebi-recorder.exe and komorebi-recorder-gui.exe into ./result-windows
|
||||
build-windows:
|
||||
nix build .#komorebi-recorder-windows --out-link result-windows
|
||||
|
||||
# render the icon: komorebi-recorder/assets/watermelon.svg into the PNG the windows set and the ICO Windows embeds
|
||||
icon:
|
||||
python3 komorebi-recorder/assets/generate.py
|
||||
|
||||
deps:
|
||||
cargo update
|
||||
just depgen
|
||||
|
||||
depgen:
|
||||
cargo deny check
|
||||
cargo deny list --format json | jq 'del(.unlicensed)' > dependencies.json
|
||||
Reference in new issue
Block a user