diff --git a/justfile b/justfile index fca24cf..03ce529 100644 --- a/justfile +++ b/justfile @@ -1,65 +1,57 @@ # Owlry build and release automation -# Default recipe default: @just --list -# Build debug (all workspace members) +# === Build === + build: cargo build --workspace -# Build UI binary only build-ui: cargo build -p owlry -# Build core daemon only build-daemon: cargo build -p owlry-core -# Build core daemon release -release-daemon: - cargo build -p owlry-core --release - -# Run core daemon -run-daemon *ARGS: - cargo run -p owlry-core -- {{ARGS}} - -# Build release release: cargo build --workspace --release -# Run in debug mode +release-daemon: + cargo build -p owlry-core --release + +# === Run === + run *ARGS: cargo run -p owlry -- {{ARGS}} -# Run tests +run-daemon *ARGS: + cargo run -p owlry-core -- {{ARGS}} + +# === Quality === + test: cargo test --workspace -# Check code check: cargo check --workspace cargo clippy --workspace -# Format code fmt: cargo fmt --all -# Clean build artifacts clean: cargo clean -# Install locally (core + runtimes) +# === Install === + install-local: #!/usr/bin/env bash set -euo pipefail echo "Building release..." - # Build UI without embedded Lua (smaller binary) cargo build -p owlry --release --no-default-features - # Build core daemon cargo build -p owlry-core --release - # Build runtimes cargo build -p owlry-lua -p owlry-rune --release echo "Creating directories..." @@ -71,55 +63,21 @@ install-local: sudo install -Dm755 target/release/owlry-core /usr/bin/owlry-core echo "Installing runtimes..." - if [ -f "target/release/libowlry_lua.so" ]; then - sudo install -Dm755 target/release/libowlry_lua.so /usr/lib/owlry/runtimes/liblua.so - echo " → liblua.so" - fi - if [ -f "target/release/libowlry_rune.so" ]; then - sudo install -Dm755 target/release/libowlry_rune.so /usr/lib/owlry/runtimes/librune.so - echo " → librune.so" - fi + [ -f target/release/libowlry_lua.so ] && sudo install -Dm755 target/release/libowlry_lua.so /usr/lib/owlry/runtimes/liblua.so + [ -f target/release/libowlry_rune.so ] && sudo install -Dm755 target/release/libowlry_rune.so /usr/lib/owlry/runtimes/librune.so echo "Installing systemd service files..." - if [ -f "systemd/owlry-core.service" ]; then - sudo install -Dm644 systemd/owlry-core.service /usr/lib/systemd/user/owlry-core.service - echo " → owlry-core.service" - fi - if [ -f "systemd/owlry-core.socket" ]; then - sudo install -Dm644 systemd/owlry-core.socket /usr/lib/systemd/user/owlry-core.socket - echo " → owlry-core.socket" - fi + [ -f systemd/owlry-core.service ] && sudo install -Dm644 systemd/owlry-core.service /usr/lib/systemd/user/owlry-core.service + [ -f systemd/owlry-core.socket ] && sudo install -Dm644 systemd/owlry-core.socket /usr/lib/systemd/user/owlry-core.socket - echo "" - echo "Installation complete!" - echo " - /usr/bin/owlry (UI)" - echo " - /usr/bin/owlry-core (daemon)" - echo " - $(ls /usr/lib/owlry/runtimes/*.so 2>/dev/null | wc -l) runtimes" - echo " - systemd: owlry-core.service, owlry-core.socket" - echo "" - echo "To start the daemon:" - echo " systemctl --user enable --now owlry-core.service" - echo " OR add 'exec-once = owlry-core' to your compositor config" - echo "" - echo "Note: Install plugins separately from the owlry-plugins repo." + echo "Done. Start daemon: systemctl --user enable --now owlry-core.service" -# === Release Management === +# === Version Management === -# AUR package directories (relative to project root) -aur_core_dir := "aur/owlry" - -# Get current version from core crate -version := `grep '^version' crates/owlry/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/'` - -# Show current version -show-version: - @echo "Current version: {{version}}" - -# Show all crate versions show-versions: #!/usr/bin/env bash echo "=== Crate Versions ===" - for toml in Cargo.toml crates/*/Cargo.toml; do + for toml in crates/*/Cargo.toml; do name=$(grep '^name' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') ver=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') printf " %-30s %s\n" "$name" "$ver" @@ -129,20 +87,16 @@ show-versions: crate-version crate: @grep '^version' crates/{{crate}}/Cargo.toml | head -1 | sed 's/.*"\(.*\)"/\1/' -# Bump a specific crate version (usage: just bump-crate owlry-core 0.2.0) +# Bump a single crate version, update Cargo.lock, commit bump-crate crate new_version: #!/usr/bin/env bash set -euo pipefail toml="crates/{{crate}}/Cargo.toml" - if [ ! -f "$toml" ]; then - echo "Error: $toml not found" - exit 1 - fi + [ -f "$toml" ] || { echo "Error: $toml not found"; exit 1; } + old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - if [ "$old" = "{{new_version}}" ]; then - echo "{{crate}} is already at {{new_version}}, skipping" - exit 0 - fi + [ "$old" = "{{new_version}}" ] && { echo "{{crate}} already at {{new_version}}"; exit 0; } + echo "Bumping {{crate}} from $old to {{new_version}}" sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" cargo check -p {{crate}} @@ -150,7 +104,208 @@ bump-crate crate new_version: git commit -m "chore({{crate}}): bump version to {{new_version}}" echo "{{crate}} bumped to {{new_version}}" -# Bump meta-packages (no crate, just AUR version) +# Bump all crates to same version +bump-all new_version: + #!/usr/bin/env bash + set -euo pipefail + for toml in crates/*/Cargo.toml; do + crate=$(basename $(dirname "$toml")) + old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') + [ "$old" = "{{new_version}}" ] && continue + echo "Bumping $crate from $old to {{new_version}}" + sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" + done + cargo check --workspace + git add crates/*/Cargo.toml Cargo.lock + git commit -m "chore: bump all crates to {{new_version}}" + echo "All crates bumped to {{new_version}}" + +# Bump core UI only +bump new_version: + just bump-crate owlry {{new_version}} + +# === Tagging === + +# Tag a specific crate (format: {crate}-v{version}) +tag-crate crate: + #!/usr/bin/env bash + set -euo pipefail + ver=$(grep '^version' "crates/{{crate}}/Cargo.toml" | head -1 | sed 's/.*"\(.*\)"/\1/') + tag="{{crate}}-v$ver" + if git rev-parse "$tag" >/dev/null 2>&1; then + echo "Tag $tag already exists" + exit 0 + fi + git tag -a "$tag" -m "{{crate}} v$ver" + echo "Created tag $tag" + +# Push all local tags +push-tags: + git push --tags + +# === AUR Package Management === + +# Stage AUR files into the main repo git index. +# AUR subdirs have their own .git (for aur.archlinux.org), which makes +# git treat them as embedded repos. Temporarily hide .git to stage files. +aur-stage pkg: + #!/usr/bin/env bash + set -euo pipefail + dir="aur/{{pkg}}" + [ -d "$dir" ] || { echo "Error: $dir not found"; exit 1; } + + if [ -d "$dir/.git" ]; then + mv "$dir/.git" "$dir/.git.bak" + git add "$dir/PKGBUILD" "$dir/.SRCINFO" "$dir"/*.install 2>/dev/null || true + mv "$dir/.git.bak" "$dir/.git" + else + git add "$dir/PKGBUILD" "$dir/.SRCINFO" "$dir"/*.install 2>/dev/null || true + fi + +# Update a specific AUR package PKGBUILD with correct version + checksum +aur-update-pkg pkg: + #!/usr/bin/env bash + set -euo pipefail + aur_dir="aur/{{pkg}}" + [ -d "$aur_dir" ] || { echo "Error: $aur_dir not found"; exit 1; } + + # Determine version + case "{{pkg}}" in + owlry-meta-*) + ver=$(grep '^pkgver=' "$aur_dir/PKGBUILD" | sed 's/pkgver=//') + echo "Meta-package {{pkg}} at $ver (bump pkgrel manually if needed)" + (cd "$aur_dir" && makepkg --printsrcinfo > .SRCINFO) + exit 0 + ;; + *) + crate_dir="crates/{{pkg}}" + [ -d "$crate_dir" ] || { echo "Error: $crate_dir not found"; exit 1; } + ver=$(grep '^version' "$crate_dir/Cargo.toml" | head -1 | sed 's/.*"\(.*\)"/\1/') + ;; + esac + + tag="{{pkg}}-v$ver" + url="https://somegit.dev/Owlibou/owlry/archive/$tag.tar.gz" + + echo "Updating {{pkg}} to $ver (tag: $tag)" + sed -i "s/^pkgver=.*/pkgver=$ver/" "$aur_dir/PKGBUILD" + sed -i 's/^pkgrel=.*/pkgrel=1/' "$aur_dir/PKGBUILD" + + # Update checksum from the tagged tarball + if grep -q "^source=" "$aur_dir/PKGBUILD"; then + echo "Downloading tarball and computing checksum..." + hash=$(curl -sL "$url" | b2sum | cut -d' ' -f1) + if [ -z "$hash" ] || [ ${#hash} -lt 64 ]; then + echo "Error: failed to download or hash $url" + exit 1 + fi + sed -i "s|^b2sums=.*|b2sums=('$hash')|" "$aur_dir/PKGBUILD" + fi + + (cd "$aur_dir" && makepkg --printsrcinfo > .SRCINFO) + echo "{{pkg}} PKGBUILD updated to $ver" + +# Shortcut: update core UI AUR package +aur-update: + just aur-update-pkg owlry + +# Publish a specific AUR package to aur.archlinux.org +aur-publish-pkg pkg: + #!/usr/bin/env bash + set -euo pipefail + aur_dir="aur/{{pkg}}" + [ -d "$aur_dir/.git" ] || { echo "Error: $aur_dir has no AUR git repo"; exit 1; } + + cd "$aur_dir" + ver=$(grep '^pkgver=' PKGBUILD | sed 's/pkgver=//') + git add PKGBUILD .SRCINFO *.install 2>/dev/null || true + git commit -m "Update to v$ver" || { echo "Nothing to commit"; exit 0; } + git push origin master + echo "{{pkg}} v$ver published to AUR!" + +# Shortcut: publish core UI to AUR +aur-publish: + just aur-publish-pkg owlry + +# Update and publish ALL AUR packages +aur-update-all: + #!/usr/bin/env bash + set -euo pipefail + for dir in aur/*/; do + pkg=$(basename "$dir") + [ -f "$dir/PKGBUILD" ] || continue + echo "=== $pkg ===" + just aur-update-pkg "$pkg" + echo "" + done + echo "All updated. Run 'just aur-publish-all' to publish." + +aur-publish-all: + #!/usr/bin/env bash + set -euo pipefail + for dir in aur/*/; do + pkg=$(basename "$dir") + [ -d "$dir/.git" ] || continue + echo "=== $pkg ===" + just aur-publish-pkg "$pkg" + echo "" + done + echo "All published!" + +# Show AUR package status +aur-status: + #!/usr/bin/env bash + echo "=== AUR Package Status ===" + for dir in aur/*/; do + pkg=$(basename "$dir") + [ -f "$dir/PKGBUILD" ] || continue + ver=$(grep '^pkgver=' "$dir/PKGBUILD" | sed 's/pkgver=//') + if [ -d "$dir/.git" ]; then + printf " ✓ %-30s %s\n" "$pkg" "$ver" + else + printf " ✗ %-30s %s (no AUR repo)\n" "$pkg" "$ver" + fi + done + +# Commit AUR file changes to the main repo (handles embedded .git dirs) +aur-commit msg="chore(aur): update PKGBUILDs": + #!/usr/bin/env bash + set -euo pipefail + for dir in aur/*/; do + pkg=$(basename "$dir") + [ -f "$dir/PKGBUILD" ] || continue + just aur-stage "$pkg" + done + git diff --cached --quiet && { echo "No AUR changes to commit"; exit 0; } + git commit -m "{{msg}}" + +# === Release Workflows === + +# Release a single crate: bump → push → tag → update AUR → publish AUR +release-crate crate new_version: + #!/usr/bin/env bash + set -euo pipefail + + just bump-crate {{crate}} {{new_version}} + git push + + just tag-crate {{crate}} + just push-tags + + echo "Waiting for tag to propagate..." + sleep 3 + + just aur-update-pkg {{crate}} + just aur-commit "chore(aur): update {{crate}} to {{new_version}}" + git push + + just aur-publish-pkg {{crate}} + echo "" + echo "{{crate}} v{{new_version}} released and published to AUR!" + +# === Meta Package Management === + +# Bump meta-package versions bump-meta new_version: #!/usr/bin/env bash set -euo pipefail @@ -165,271 +320,14 @@ bump-meta new_version: done echo "Meta-packages bumped to {{new_version}}" -# Bump all crates (core UI + daemon + plugin-api + runtimes) to same version -bump-all new_version: - #!/usr/bin/env bash - set -euo pipefail - for toml in crates/*/Cargo.toml; do - crate=$(basename $(dirname "$toml")) - old=$(grep '^version' "$toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - if [ "$old" != "{{new_version}}" ]; then - echo "Bumping $crate from $old to {{new_version}}" - sed -i 's/^version = ".*"/version = "{{new_version}}"/' "$toml" - fi - done - cargo check --workspace - git add crates/*/Cargo.toml Cargo.lock - git commit -m "chore: bump all crates to {{new_version}}" - echo "All crates bumped to {{new_version}}" - -# Bump core version (usage: just bump 0.2.0) -bump new_version: - #!/usr/bin/env bash - set -euo pipefail - if [ "{{version}}" = "{{new_version}}" ]; then - echo "Version is already {{new_version}}, skipping bump" - exit 0 - fi - echo "Bumping core version from {{version}} to {{new_version}}" - sed -i 's/^version = ".*"/version = "{{new_version}}"/' crates/owlry/Cargo.toml - cargo check -p owlry - git add crates/owlry/Cargo.toml Cargo.lock - git commit -m "chore: bump version to {{new_version}}" - echo "Version bumped to {{new_version}}" - -# Create and push a release tag -tag: - #!/usr/bin/env bash - set -euo pipefail - if git rev-parse "v{{version}}" >/dev/null 2>&1; then - echo "Tag v{{version}} already exists, skipping" - exit 0 - fi - echo "Creating tag v{{version}}" - git tag -a "v{{version}}" -m "Release v{{version}}" - git push origin "v{{version}}" - echo "Tag v{{version}} pushed" - -# Update AUR package (core UI) -aur-update: - #!/usr/bin/env bash - set -euo pipefail - cd "{{aur_core_dir}}" - - url="https://somegit.dev/Owlibou/owlry" - - echo "Updating PKGBUILD to version {{version}}" - sed -i 's/^pkgver=.*/pkgver={{version}}/' PKGBUILD - sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD - - # Update checksums (b2sums) - echo "Updating checksums..." - b2sum=$(curl -sL "$url/archive/v{{version}}.tar.gz" | b2sum | cut -d' ' -f1) - sed -i "s/^b2sums=.*/b2sums=('$b2sum')/" PKGBUILD - - # Generate .SRCINFO - echo "Generating .SRCINFO..." - makepkg --printsrcinfo > .SRCINFO - - # Show diff - git diff - - echo "" - echo "AUR package updated. Review changes above." - echo "Run 'just aur-publish' to commit and push." - -# Publish AUR package (core UI) -aur-publish: - #!/usr/bin/env bash - set -euo pipefail - cd "{{aur_core_dir}}" - - git add PKGBUILD .SRCINFO - git commit -m "Update to v{{version}}" - git push - - echo "AUR package v{{version}} published!" - -# Test AUR package build locally (core UI) -aur-test: - #!/usr/bin/env bash - set -euo pipefail - cd "{{aur_core_dir}}" - - echo "Testing PKGBUILD..." - makepkg -sf - - echo "" - echo "Package built successfully!" - ls -lh *.pkg.tar.zst - -# === AUR Package Management (individual packages) === - -# Update a specific AUR package (usage: just aur-update-pkg owlry-core) -aur-update-pkg pkg: - #!/usr/bin/env bash - set -euo pipefail - aur_dir="aur/{{pkg}}" - - if [ ! -d "$aur_dir" ]; then - echo "Error: $aur_dir not found" - exit 1 - fi - - url="https://somegit.dev/Owlibou/owlry" - - # Determine crate version - case "{{pkg}}" in - owlry-meta-essentials|owlry-meta-tools|owlry-meta-widgets|owlry-meta-full) - # Meta-packages use static versioning (1.0.0), only bump pkgrel for dep changes - crate_ver=$(grep '^pkgver=' "$aur_dir/PKGBUILD" | sed 's/pkgver=//') - ;; - *) - # Get version from crate - crate_dir="crates/{{pkg}}" - if [ ! -d "$crate_dir" ]; then - echo "Error: $crate_dir not found" - exit 1 - fi - crate_ver=$(grep '^version' "$crate_dir/Cargo.toml" | head -1 | sed 's/.*"\(.*\)"/\1/') - ;; - esac - - cd "$aur_dir" - - echo "Updating {{pkg}} PKGBUILD:" - echo " pkgver=$crate_ver" - - sed -i "s/^pkgver=.*/pkgver=$crate_ver/" PKGBUILD - sed -i 's/^pkgrel=.*/pkgrel=1/' PKGBUILD - - # Update checksums - if grep -q "^source=" PKGBUILD; then - echo "Updating checksums..." - b2sum=$(curl -sL "$url/archive/v$crate_ver.tar.gz" | b2sum | cut -d' ' -f1) - sed -i "s/^b2sums=.*/b2sums=('$b2sum')/" PKGBUILD - fi - - # Generate .SRCINFO - echo "Generating .SRCINFO..." - makepkg --printsrcinfo > .SRCINFO - - git diff --stat - echo "" - echo "{{pkg}} updated. Run 'just aur-publish-pkg {{pkg}}' to publish." - -# Publish a specific AUR package -aur-publish-pkg pkg: - #!/usr/bin/env bash - set -euo pipefail - aur_dir="aur/{{pkg}}" - - if [ ! -d "$aur_dir" ]; then - echo "Error: $aur_dir not found" - exit 1 - fi - - cd "$aur_dir" - ver=$(grep '^pkgver=' PKGBUILD | sed 's/pkgver=//') - - git add PKGBUILD .SRCINFO - git commit -m "Update to v$ver" - git push origin master - - echo "{{pkg}} v$ver published!" +# === Testing === # Test a specific AUR package build locally aur-test-pkg pkg: #!/usr/bin/env bash set -euo pipefail cd "aur/{{pkg}}" - echo "Testing {{pkg}} PKGBUILD..." makepkg -sf - - echo "" echo "Package built successfully!" ls -lh *.pkg.tar.zst - -# List all AUR packages with their versions -aur-status: - #!/usr/bin/env bash - echo "=== AUR Package Status ===" - for dir in aur/*/; do - pkg=$(basename "$dir") - if [ -f "$dir/PKGBUILD" ]; then - ver=$(grep '^pkgver=' "$dir/PKGBUILD" | sed 's/pkgver=//') - if [ -d "$dir/.git" ]; then - status="✓" - else - status="✗ (not initialized)" - fi - printf " %s %-30s %s\n" "$status" "$pkg" "$ver" - fi - done - -# Update ALL AUR packages (core + daemon + runtimes + meta) -aur-update-all: - #!/usr/bin/env bash - set -euo pipefail - echo "=== Updating core UI ===" - just aur-update - echo "" - echo "=== Updating core daemon ===" - just aur-update-pkg owlry-core - echo "" - echo "=== Updating runtimes ===" - just aur-update-pkg owlry-lua - just aur-update-pkg owlry-rune - echo "" - echo "=== Updating meta-packages ===" - for pkg in owlry-meta-essentials owlry-meta-tools owlry-meta-widgets owlry-meta-full; do - echo "--- $pkg ---" - (cd "aur/$pkg" && makepkg --printsrcinfo > .SRCINFO) - done - echo "" - echo "All AUR packages updated. Run 'just aur-publish-all' to publish." - -# Publish ALL AUR packages -aur-publish-all: - #!/usr/bin/env bash - set -euo pipefail - echo "=== Publishing core UI ===" - just aur-publish - echo "" - echo "=== Publishing core daemon ===" - just aur-publish-pkg owlry-core - echo "" - echo "=== Publishing runtimes ===" - just aur-publish-pkg owlry-lua - just aur-publish-pkg owlry-rune - echo "" - echo "=== Publishing meta-packages ===" - for pkg in owlry-meta-essentials owlry-meta-tools owlry-meta-widgets owlry-meta-full; do - echo "--- $pkg ---" - just aur-publish-pkg "$pkg" - done - echo "" - echo "All AUR packages published!" - -# Full release workflow for core only (bump + tag + aur) -release-core new_version: (bump new_version) - #!/usr/bin/env bash - set -euo pipefail - - # Push version bump - git push - - # Create and push tag - just tag - - # Wait for tag to be available - echo "Waiting for tag to propagate..." - sleep 2 - - # Update AUR - just aur-update - - echo "" - echo "Core release v{{new_version}} prepared!" - echo "Review AUR changes, then run 'just aur-publish'"