1
0
mirror of https://github.com/AvengeMedia/DankMaterialShell.git synced 2026-04-03 20:32:07 -04:00

tooling: make qmllint auto-resolution smarter

This commit is contained in:
bbedward
2026-03-10 15:41:22 -04:00
parent 4ecdba94c2
commit 6185cc79d7
3 changed files with 25 additions and 5 deletions

View File

@@ -86,7 +86,9 @@ touch .qmlls.ini
4. Restart dms to generate the `.qmlls.ini` file
5. Make your changes, test, and open a pull request.
5. Run `make lint-qml` from the repo root to lint QML entrypoints (requires the `.qmlls.ini` generated above). The script needs the **Qt 6** `qmllint`; it checks `qmllint6`, `/usr/lib/qt6/bin/qmllint`, then `qmllint` in `PATH`. If your Qt 6 binary lives elsewhere, set `QMLLINT=/path/to/qmllint`.
6. Make your changes, test, and open a pull request.
### I18n/Localization

View File

@@ -27,7 +27,8 @@ quickshell -p quickshell/
**Code formatting:**
```bash
qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml
make lint-qml # Run from repo root; requires a generated quickshell/.qmlls.ini VFS from `qs -p quickshell/`
make lint-qml # Run from repo root; requires quickshell/.qmlls.ini (generated by `qs -p quickshell/`)
# Uses Qt 6 qmllint. Override path with QMLLINT=/path/to/qmllint if needed.
```
## Components

View File

@@ -10,11 +10,28 @@ repo_root="$(
cd -- "${script_dir}/../.." && pwd
)"
quickshell_dir="${repo_root}/quickshell"
qmllint_bin="${QMLLINT:-qmllint}"
qmlls_config="${quickshell_dir}/.qmlls.ini"
if ! command -v -- "${qmllint_bin}" >/dev/null 2>&1; then
printf 'error: qmllint not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2
# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6
# install path, and finally bare qmllint. We need the Qt 6 build (>= 6.x)
# because older Qt 5 qmllint doesn't understand --ignore-settings / -W.
resolve_qmllint() {
if [[ -n "${QMLLINT:-}" ]]; then
printf '%s\n' "${QMLLINT}"
return
fi
local candidate
for candidate in qmllint6 /usr/lib/qt6/bin/qmllint qmllint; do
if command -v -- "${candidate}" >/dev/null 2>&1; then
printf '%s\n' "${candidate}"
return
fi
done
return 1
}
if ! qmllint_bin="$(resolve_qmllint)"; then
printf 'error: qmllint (Qt 6) not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2
exit 127
fi