Files
komorebi/justfile
T
LGUG2Z af77e2c944 perf(deps): minimize objc2 cargo features to reduce build time
This commit optimizes the objc2 dependency tree by disabling default
features and enabling only the minimal set of features actually used
by the codebase. This reduces compilation time and dependency bloat.

I was meant to do this earlier but during the initial implementation it was
easier to just pull in everything. Now that we are getting ready for a public
release it's time to improve on this.

I ended up:

* Removing unused direct dependencies:
  - objc2-core-services
  - objc2-core-video

* Setting `default-features = false` on all objc2 crates and added only
  the specific features required for the types and methods used

* Updating objc2, objc2-app-kit, objc2-foundation,
  objc2-application-services, objc2-core-foundation, objc2-core-graphics,
  and objc2-quartz-core with minimal feature sets

After all those changes, the following transitive dependencies are no longer
pulled in: objc2-metal, objc2-core-image, objc2-core-data, objc2-cloud-kit,
objc2-core-text, and loads of unused Foundation/AppKit class bindings.

Some before and after numbers:

| Metric                          | Before  | After   | Change   |
|---------------------------------|---------|---------|----------|
| objc2 dep lines (komorebi)      | 84      | 50      | -40.5%   |
| objc2 dep lines (komorebi-bar)  | 91      | 59      | -35.2%   |
| Dependency tree (komorebi)      | 973     | 917     | -5.8%    |
| Dependency tree (komorebi-bar)  | 1181    | 1131    | -4.2%    |
| Clean build time                | 3m 05s  | 2m 21s  | -23.8%   |

The almost 24% reduction in clean build time is a big win!
2025-12-23 19:38:11 -08:00

75 lines
2.4 KiB
Makefile

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 +stable clippy
prettier --write README.md
nix fmt
fix:
cargo clippy --fix --allow-dirty
clean:
cargo clean
install-with-jsonschema target:
cargo +stable install --path {{ target }} --locked --target-dir ~/.cargo/bin
install target:
cargo +stable install --path {{ target }} --locked --target-dir ~/.cargo/bin --no-default-features
build target:
cargo +stable build --package {{ target }} --locked --release
run target:
cargo +stable 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 +stable run --bin komorebi --locked --no-default-features --features deadlock_detection
docgen:
cargo run --package komorebic -- docgen
find docs/cli -type f -exec sed -i.bak 's/Usage: /Usage: komorebic /g' {} \; && find docs/cli -name "*.bak" -delete
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
version := `cargo metadata --format-version 1 --no-deps | jq -r '.packages[] | select(.name == "komorebi") | .version'`
schemagen:
mkdir -p komorebi-schema
schemars-docgen schema.json -o komorebi-schema/komorebi.html
schemars-docgen schema.bar.json -o komorebi-schema/bar.html
cp schema.json komorebi-schema/komorebi.{{ version }}.schema.json
cp schema.bar.json komorebi-schema/komorebi.bar.{{ version }}.schema.json
schemapub:
wrangler pages deploy --project-name komorebi-for-mac --branch main ./komorebi-schema
depgen:
cargo deny check
cargo deny list --format json | jq 'del(.unlicensed)' > dependencies.json
push:
git push origin master
git push komocorp master