-
-
Notifications
You must be signed in to change notification settings - Fork 415
/
justfile
186 lines (150 loc) · 5.81 KB
/
justfile
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
# 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`
sourceBuildDir := "build-QOwnNotes"
sourceBuildTestDir := "build-tests-QOwnNotes"
# Aliases
alias fix-linting := clang-format
alias linter-fix := clang-format
alias trace-process := process-trace
alias test := src-test
alias download-translations := translations-download
# 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 {{ sourceBuildDir }}; cd {{ sourceBuildDir }} && qmake "CONFIG+=debug USE_SYSTEM_BOTAN=1" ../src/QOwnNotes.pro && make -j$(nproc)
# Build the application direclty from the source
[group('src-build')]
src-test:
mkdir -p {{ sourceBuildTestDir }}; cd {{ sourceBuildTestDir }} && qmake CONFIG+=debug CONFIG+=DEV_MODE DEFINES+=INTEGRATION_TESTS ../tests/QOwnNotesTests.pro && make -j$(nproc)
./bin/tests/tests -platform minimal
rm -rf {{ sourceBuildTestDir }}
# Clean the build directory
[group('src-build')]
src-clean:
rm -rf {{ sourceBuildDir }}
# Run the built application
[group('src-build')]
src-run:
./{{ sourceBuildDir }}/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
# Apply a git patch to piwiktracker
[group('patches')]
git-apply-piwiktracker-patch:
cd ./src/libraries/piwiktracker && git apply {{ transferDir }}/piwiktracker.patch
# Apply a git patch to qttoolbareditor
[group('patches')]
git-apply-qttoolbareditor-patch:
cd ./src/libraries/qttoolbareditor && git apply {{ transferDir }}/qttoolbareditor.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 src/libraries/piwiktracker && git diff --no-ext-diff --staged --binary > {{ transferDir }}/piwiktracker.patch
cd src/libraries/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
# Attach to the QOwnNotes process with lurk
[group('debug')]
process-trace:
sudo lurk --attach `procs QOwnNotes | fzf --height 40% --layout reverse | awk '{print $1}'`
# Generate the icons for the whole project based on icons/icon.svg and icons/icon-dark.svg
[group('icons')]
generate-icons:
cd icons &&./generate-icons.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