mirror of
https://github.com/AvengeMedia/DankMaterialShell.git
synced 2026-04-12 16:52:10 -04:00
tooling: make qmllint auto-resolution smarter
This commit is contained in:
@@ -86,7 +86,9 @@ touch .qmlls.ini
|
|||||||
|
|
||||||
4. Restart dms to generate the `.qmlls.ini` file
|
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
|
### I18n/Localization
|
||||||
|
|
||||||
|
|||||||
@@ -27,7 +27,8 @@ quickshell -p quickshell/
|
|||||||
**Code formatting:**
|
**Code formatting:**
|
||||||
```bash
|
```bash
|
||||||
qmlfmt -t 4 -i 4 -b 250 -w path/to/file.qml
|
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
|
## Components
|
||||||
|
|||||||
@@ -10,11 +10,28 @@ repo_root="$(
|
|||||||
cd -- "${script_dir}/../.." && pwd
|
cd -- "${script_dir}/../.." && pwd
|
||||||
)"
|
)"
|
||||||
quickshell_dir="${repo_root}/quickshell"
|
quickshell_dir="${repo_root}/quickshell"
|
||||||
qmllint_bin="${QMLLINT:-qmllint}"
|
|
||||||
qmlls_config="${quickshell_dir}/.qmlls.ini"
|
qmlls_config="${quickshell_dir}/.qmlls.ini"
|
||||||
|
|
||||||
if ! command -v -- "${qmllint_bin}" >/dev/null 2>&1; then
|
# Resolve qmllint: honour QMLLINT, then try qmllint6, then the common Qt 6
|
||||||
printf 'error: qmllint not found in PATH (override with QMLLINT=/path/to/qmllint)\n' >&2
|
# 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
|
exit 127
|
||||||
fi
|
fi
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user