# Camper Widget Build Configuration set shell := ["/usr/bin/bash", "-cu"] # Required tools (validated at parse time) _rustc := require("rustc") _cargo := require("cargo") _kpackagetool6 := require("kpackagetool6") _dbus_daemon := require("dbus-daemon") # Help command help: @echo "This justfile supports the following targets:" @echo " - build - Build service (release)" @echo " - install - Install widget (kpackagetool6) + service" @echo " - install-widget - Install/update widget via kpackagetool6" @echo " - install-service - Build and install systemd service" @echo " - uninstall - Uninstall widget + clean old artifacts" @echo " - run - Run applet in plasmoidviewer" @echo " - run-service - Run service (release)" @echo " - fmt - Format Rust code (service)" @echo " - check - Check Rust code (format, clippy, check)" @echo " - test - Run Rust tests (service)" @echo " - verify - Run check + build" @echo " - build-service - Build camper-widget-refresh (Release)" @echo " - check-service - Check service only" @echo " - check-deps - Print versions of required tools" @echo " - ci - Full CI pipeline (check + test)" @echo " - ci-quick - Quick CI (check only, no build/test)" @echo " - clean - Delete build artifacts" @echo " - help - Print help" @echo # Build (service only — widget is pure QML, no compilation needed) build: build-service # Install widget via kpackagetool6 + service via cargo install: install-widget install-service # Install/update widget KPackage install-widget: kpackagetool6 -t Plasma/Applet -u package/ 2>/dev/null || kpackagetool6 -t Plasma/Applet -i package/ # Uninstall widget + clean old compiled plugin artifacts uninstall: -kpackagetool6 -t Plasma/Applet -r craftknight.camper_widget rm -f ~/.local/lib/qt6/plugins/plasma/applets/craftknight.camper_widget.so rm -rf ~/.local/share/plasma/plasmoids/craftknight.camper_widget rm -rf ~/.local/lib/qt6/qml/craftknight/camper_widget # Run applet in plasmoidviewer run: plasmoidviewer -a craftknight.camper_widget # Service commands [working-directory: 'service'] build-service: cargo build --release [working-directory: 'service'] run-service: cargo run --release [working-directory: 'service'] install-service: build-service @echo "Installing camper-widget-refresh..." mkdir -p ~/.config/systemd/user mkdir -p ~/.local/bin cp config/camper-widget-refresh.service ~/.config/systemd/user/ systemctl --user daemon-reload systemctl stop --user camper-widget-refresh cp target/release/camper-widget-refresh ~/.local/bin/camper-widget-refresh chmod +x ~/.local/bin/camper-widget-refresh systemctl start --user camper-widget-refresh @echo "Installation complete!" @echo "To enable: systemctl --user enable camper-widget-refresh" @echo "To start: systemctl --user start camper-widget-refresh" # Rust commands (service only) [working-directory: 'service'] fmt: cargo fmt --all [working-directory: 'service'] check: cargo fmt --all -- --check cargo clippy --all-targets --all-features -- -D warnings cargo check --all-targets check-service: check [working-directory: 'service'] test: cargo test # Clean build artifacts clean: rm -rf service/target # Print versions of all required tools [group: 'ci'] check-deps: @echo "Required tools:" @echo " rustc: $(rustc --version)" @echo " cargo: $(cargo --version)" @echo " kpackagetool6: $(kpackagetool6 --version)" @echo " dbus-daemon: $(dbus-daemon --version | head -1)" @echo " just: $(just --version)" # Full CI pipeline: deps → lint/format → all tests [group: 'ci'] ci: check-deps check test @echo "" @echo "CI pipeline passed." # Quick CI: deps + lint/format only (no build/test) [group: 'ci'] ci-quick: check-deps check @echo "" @echo "Quick CI passed." # Combined verify command verify: check build