diff options
author | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-01-18 16:16:20 +0100 |
---|---|---|
committer | Fabian Kosmale <fabian.kosmale@qt.io> | 2022-01-24 13:25:13 +0100 |
commit | fdc2608c31d2de91616356644915f1165606a9e8 (patch) | |
tree | e8542f0e5334e29b3e8bfe59c98241f07234e805 /tools/qmllint/main.cpp | |
parent | f9834fa3c7aaf64450dca4bd3d1e0208eb021cf3 (diff) |
tools: Unconditionally depend on QCommandLineParser
qmllint's utility is rather limited when we can pass it neither the
qmldir nor qmltypes files. Instead of trying to somehow handle the case
with ifdefs, move the feature check into the build system and
completely disable the tool if we lack the parser.
The same holds for qmltc, which is already completely unusable without
the parser (and just prints an error message if build without the
feature enabled).
Change-Id: I31828bb7d551caeaffd1974d1dff14a25446ce95
Reviewed-by: Andrei Golubev <andrei.golubev@qt.io>
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Diffstat (limited to 'tools/qmllint/main.cpp')
-rw-r--r-- | tools/qmllint/main.cpp | 18 |
1 files changed, 1 insertions, 17 deletions
diff --git a/tools/qmllint/main.cpp b/tools/qmllint/main.cpp index c68e1b21b1..eb744b3c19 100644 --- a/tools/qmllint/main.cpp +++ b/tools/qmllint/main.cpp @@ -61,7 +61,6 @@ int main(int argv, char *argc[]) QCoreApplication app(argv, argc); QCoreApplication::setApplicationName("qmllint"); QCoreApplication::setApplicationVersion(QT_VERSION_STR); -#if QT_CONFIG(commandlineparser) QCommandLineParser parser; QQmlToolingSettings settings(QLatin1String("qmllint")); parser.setApplicationDescription(QLatin1String(R"(QML syntax verifier and analyzer @@ -224,23 +223,11 @@ All warnings can be set to three levels: parser.isSet(resourceOption) ? parser.values(resourceOption) : QStringList {}; QStringList resourceFiles = defaultResourceFiles; -#else - bool silent = false; - bool useAbsolutePaths = false; - bool useJson = false; - bool warnUnqualified = true; - bool warnWithStatement = true; - bool warnInheritanceCycle = true; - QStringList qmlImportPaths {}; - QStringList qmltypesFiles {}; - QStringList resourceFiles {}; -#endif bool success = true; QQmlLinter linter(qmlImportPaths, useAbsolutePath); QJsonArray jsonFiles; -#if QT_CONFIG(commandlineparser) for (const QString &filename : positionalArguments) { if (!parser.isSet(ignoreSettings)) { settings.search(filename); @@ -277,10 +264,7 @@ All warnings can be set to three levels: addAbsolutePaths(qmlImportPaths, settings.value(qmlImportPathsSetting).toStringList()); } -#else - const auto arguments = app.arguments(); - for (const QString &filename : arguments) { -#endif + success &= linter.lintFile(filename, nullptr, silent, useJson ? &jsonFiles : nullptr, qmlImportPaths, qmldirFiles, resourceFiles, options); } |