noctua/justfile
mow c85f35310e chore: inital commit
Split project into a Cargo workspace with two crates:

- core/ (noctua_core): UI-independent document library
- ui/ (noctua_ui): COSMIC application scaffold (empty)

justfile for workspace (run, run-cli, check, test, build)
2026-03-07 20:29:18 +01:00

110 lines
3.4 KiB
Makefile

# Name of the application binary (produced by the ui crate).
name := 'noctua'
# The unique ID of the application.
appid := 'org.codeberg.wfx.Noctua'
# Path to root file system, which defaults to `/`.
rootdir := ''
# The prefix for the `/usr` directory.
prefix := '/usr'
# The location of the cargo target directory.
cargo-target-dir := env('CARGO_TARGET_DIR', 'target')
# Application's appstream metadata
appdata := appid + '.metainfo.xml'
# Application's desktop entry
desktop := appid + '.desktop'
# Application's icon.
icon-svg := appid + '.svg'
# Install destinations
base-dir := absolute_path(clean(rootdir / prefix))
appdata-dst := base-dir / 'share' / 'metainfo' / appdata
bin-dst := base-dir / 'bin' / name
desktop-dst := base-dir / 'share' / 'applications' / desktop
icons-dst := base-dir / 'share' / 'icons' / 'hicolor'
icon-svg-dst := icons-dst / 'scalable' / 'apps' / icon-svg
# Default recipe
default: build-release
# Runs `cargo clean`
clean:
cargo clean
# Removes vendored dependencies
clean-vendor:
rm -rf .cargo vendor vendor.tar
# `cargo clean` and removes vendored dependencies
clean-dist: clean clean-vendor
# Compiles the entire workspace with debug profile
build-debug *args:
cargo build --workspace {{args}}
# Compiles with release profile
build-release *args: (build-debug '--release' args)
# Compiles release profile with vendored dependencies
build-vendored *args: vendor-extract (build-release '--frozen --offline' args)
# Runs clippy on the entire workspace
check *args:
cargo clippy --workspace --all-features {{args}} -- -W clippy::pedantic
# Runs clippy with JSON message format
check-json: (check '--message-format=json')
# Runs tests on the entire workspace
test *args:
cargo test --workspace {{args}}
# Runs the COSMIC UI application
run *args:
env RUST_BACKTRACE=full cargo run --release -p noctua_ui {{args}}
# Runs the CLI test harness (core only, no UI deps)
run-cli *args:
env RUST_BACKTRACE=full cargo run --example cli -p noctua_core {{args}}
# Installs files
install:
install -Dm0755 {{ cargo-target-dir / 'release' / name }} {{bin-dst}}
install -Dm0644 {{ 'resources' / desktop }} {{desktop-dst}}
install -Dm0644 {{ 'resources' / appdata }} {{appdata-dst}}
install -Dm0644 {{ 'resources' / 'icons' / 'hicolor' / 'scalable' / 'apps' / icon-svg }} {{icon-svg-dst}}
# Update icon cache and desktop database after install
post-install:
-gtk-update-icon-cache -f -t {{icons-dst}}
-update-desktop-database {{base-dir / 'share' / 'applications'}}
# Uninstalls installed files
uninstall:
rm -f {{bin-dst}} {{desktop-dst}} {{appdata-dst}} {{icon-svg-dst}}
-gtk-update-icon-cache -f -t {{icons-dst}}
-update-desktop-database {{base-dir / 'share' / 'applications'}}
# Vendor dependencies locally
vendor:
mkdir -p .cargo
cargo vendor | head -n -1 > .cargo/config.toml
echo 'directory = "vendor"' >> .cargo/config.toml
tar pcf vendor.tar vendor
rm -rf vendor
# Extracts vendored dependencies
vendor-extract:
rm -rf vendor
tar pxf vendor.tar
# Bump version in all crates, commit and tag
tag version:
find -type f -name Cargo.toml -exec sed -i '0,/^version/s/^version.*/version = "{{version}}"/' '{}' \; -exec git add '{}' \;
cargo check --workspace
cargo clean
git add Cargo.lock
git commit -m 'release: {{version}}'
git commit --amend
git tag -a {{version}} -m ''