Skip to content

Commit

Permalink
just: migrate from make
Browse files Browse the repository at this point in the history
Signed-off-by: Patrizio Bekerle <patrizio@bekerle.com>
  • Loading branch information
pbek committed Sep 18, 2024
1 parent e22ea41 commit 0a413e1
Show file tree
Hide file tree
Showing 9 changed files with 193 additions and 110 deletions.
85 changes: 0 additions & 85 deletions Makefile

This file was deleted.

7 changes: 0 additions & 7 deletions build-systems/github/aqt/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions build-systems/github/aqt/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Use `just <recipe>` to run a recipe
# https://just.systems/man/en/

# By default, run the `--list` command
default:
@just --list

build:
docker build -t aqt-list .

run:
docker run --rm ./path/file -d aqt-list
8 changes: 0 additions & 8 deletions build-systems/github/ubuntu22-dev/Makefile

This file was deleted.

12 changes: 12 additions & 0 deletions build-systems/github/ubuntu22-dev/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
# Use `just <recipe>` to run a recipe
# https://just.systems/man/en/

# By default, run the `--list` command
default:
@just --list

build:
docker build -t qownnotes-ubuntu22-dev .

bash:
docker run -it --rm qownnotes-ubuntu22-dev bash
154 changes: 154 additions & 0 deletions justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
# Use `just <recipe>` to run a recipe
# https://just.systems/man/en/

# By default, run the `--list` command
default:
@just --list

# Variables

transferDir := `if [ -d "$HOME/NextcloudPrivate/Transfer" ]; then echo "$HOME/NextcloudPrivate/Transfer"; else echo "$HOME/Nextcloud/Transfer"; fi`

# Aliases

alias fix-linting := clang-format

# Build the translations
[group('translations')]
translations-build:
lrelease src/QOwnNotes.pro

# Download the translations from Crowdin
[group('translations')]
translations-download:
./scripts/download_translations.sh

# Upload the translations to Crowdin
[group('translations')]
translations-upload:
crowdin upload

# Update the translations files
[group('translations')]
translations-update-files:
./scripts/update-translations.sh

# Build the application for nix
[group('nix')]
nix-build:
nix-build -E '((import <nixpkgs> {}).qt6Packages.callPackage (import ./default.nix) { })'

# Build the application for nix for aaarch64 (throws errors while building Qt6)
[group('nix')]
nix-build-aarch64:
nix-build -E '((import <nixpkgs> {}).pkgsCross.aarch64-multiplatform.qt6Packages.callPackage (import ./default.nix) { })'

# Build the application with cmake and Qt5 for nix
[group('nix')]
nix-build-cmake-qt5:
nix-build -E '((import <nixpkgs> {}).libsForQt5.callPackage (import ./build-systems/nix/default-cmake-qt5.nix) { })'

# Build the application with Qt5 for nix
[group('nix')]
nix-build-qt5:
nix build '.?submodules=1#qownnotes-qt5'

# Build the application with Qt 5.15.3 for nix
[group('nix')]
nix-build-qt5153:
nix build '.?submodules=1#qownnotes-qt5153'

# Force a rebuild of the application with Qt5 for nix
[group('nix')]
nix-build-qt5-force:
nix build '.?submodules=1#qownnotes-qt5' --rebuild

# Force a rebuild of the application with Qt 5.15.3 for nix
[group('nix')]
nix-build-qt5153-force:
nix build '.?submodules=1#qownnotes-qt5153' --rebuild

# Build the application with Qt6 for nix with a trace
[group('nix')]
nix-build-trace:
nix-build -E '((import <nixpkgs> {}).qt6Packages.callPackage (import ./default.nix) { })' --show-trace

# Force a rebuild of the application with Qt6 for nix
[group('nix')]
nix-build-force:
nix-build -E '((import <nixpkgs> {}).qt6Packages.callPackage (import ./default.nix) { })' --check

# Run the built application for nix
[group('nix')]
nix-run:
./result/bin/QOwnNotes --session test &

# Build the application direclty from the source
[group('src-build')]
src-build:
mkdir -p build-QOwnNotes; cd build-QOwnNotes && qmake "CONFIG+=debug USE_SYSTEM_BOTAN=1" ../src/QOwnNotes.pro && make

# Clean the build directory
[group('src-build')]
src-clean:
rm -rf build-QOwnNotes

# Run the built application
[group('src-build')]
src-run:
./build-QOwnNotes/QOwnNotes

# Build and run the application
[group('src-build')]
src-build-run: src-build src-run

# Do a clang format on the project
[group('linter')]
clang-format:
./scripts/clang-format-project.sh

# Check links in the markdown files
[group('linter')]
link-check:
lychee './**/*.md'

# Apply a git patch to the project
[group('patches')]
git-apply-qownnotes-patch:
git apply {{ transferDir }}/qownnotes.patch

# Apply a git patch to qmarkdowntextedit
[group('patches')]
git-apply-qmarkdowntextedit-patch:
cd ./src/libraries/qmarkdowntextedit
git apply {{ transferDir }}/qmarkdowntextedit.patch

# Create a git patch for the project and some libraries
[group('patches')]
git-create-patch:
@echo "transferDir: {{ transferDir }}"
git diff --no-ext-diff --staged --binary > {{ transferDir }}/qownnotes.patch
cd src/libraries/qmarkdowntextedit && git diff --no-ext-diff --staged --binary > {{ transferDir }}/qmarkdowntextedit.patch
cd ../piwiktracker && git diff --no-ext-diff --staged --binary > {{ transferDir }}/piwiktracker.patch
cd ../qttoolbareditor && git diff --no-ext-diff --staged --binary > {{ transferDir }}/qttoolbareditor.patch
ls -l1t {{ transferDir }} | head -5

# Open the Crowdin webpage
[group('translations')]
open-crowdin-webpage:
xdg-open https://crowdin.com/project/qownnotes/activity-stream

# Fig the settings.ui file after QtCreator has destroyed it
[group('linter')]
fix-settings-ui-file:
./scripts/fix-settings-ui-file.sh

# Format all justfiles
[group('linter')]
just-format:
#!/usr/bin/env bash
# Find all files named "justfile" recursively and run just --fmt --unstable on them
find . -type f -name "justfile" -print0 | while IFS= read -r -d '' file; do
echo "Formatting $file"
just --fmt --unstable -f "$file"
done
2 changes: 1 addition & 1 deletion shell.nix
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
pkgs.mkShell {
# nativeBuildInputs is usually what you want -- tools you need to run
nativeBuildInputs = with pkgs; with qt6; [
gnumake
just
crowdin-cli
cmake
qmake
Expand Down
9 changes: 0 additions & 9 deletions webpage/Makefile

This file was deleted.

14 changes: 14 additions & 0 deletions webpage/justfile
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
# Use `just <recipe>` to run a recipe
# https://just.systems/man/en/

# By default, run the `--list` command
default:
@just --list

bash:
#docker run -it --rm --volume .:/app --user $(id -u) node:12 bash
#docker-compose run --rm dev bash -c "cd /app && bash"
docker-compose exec dev bash -c "cd /app && bash"

dev:
npm run dev

0 comments on commit 0a413e1

Please sign in to comment.