qtbase build should't fail with -DFEATURE_process=OFF option

- Added #if QT_CONFIG(process) to the qt code that uses a QProcess

Change-Id: I79b39392bd2f75384256e5564203a8c875169916
Reviewed-by: Assam Boudjelthia <assam.boudjelthia@qt.io>
(cherry picked from commit f6dab97455f866243132ed38a070ebb3879a0c82)
Reviewed-by: Qt Cherry-pick Bot <cherrypick_bot@qt-project.org>
This commit is contained in:
Tatiana Borisova 2024-09-03 14:26:28 +02:00 committed by Qt Cherry-pick Bot
parent 2987e96a6c
commit 10680554db

View File

@ -20,7 +20,9 @@
#include <QHash> #include <QHash>
#include <QSet> #include <QSet>
#include <QMap> #include <QMap>
#if QT_CONFIG(process)
#include <QProcess> #include <QProcess>
#endif
#include <depfile_shared.h> #include <depfile_shared.h>
#include <shellquote_shared.h> #include <shellquote_shared.h>
@ -3483,6 +3485,7 @@ int generateJavaQmlComponents(const Options &options)
const QString qmlDomCmd = "%1 -d -D required -f +:propertyInfos %2 %3"_L1.arg( const QString qmlDomCmd = "%1 -d -D required -f +:propertyInfos %2 %3"_L1.arg(
shellQuote(qmlDomExecPath), importFlags, shellQuote(qmlDomExecPath), importFlags,
shellQuote("%1/%2"_L1.arg(qmldirPath, qmlFile))); shellQuote("%1/%2"_L1.arg(qmldirPath, qmlFile)));
#if QT_CONFIG(process)
const QStringList qmlDomCmdParts = QProcess::splitCommand(qmlDomCmd); const QStringList qmlDomCmdParts = QProcess::splitCommand(qmlDomCmd);
QProcess process; QProcess process;
process.start(qmlDomCmdParts.first(), qmlDomCmdParts.sliced(1)); process.start(qmlDomCmdParts.first(), qmlDomCmdParts.sliced(1));
@ -3502,6 +3505,10 @@ int generateJavaQmlComponents(const Options &options)
if (jsonError.error != QJsonParseError::NoError) if (jsonError.error != QJsonParseError::NoError)
fprintf(stderr, "Output of %s is not valid JSON document.", qPrintable(qmlDomCmd)); fprintf(stderr, "Output of %s is not valid JSON document.", qPrintable(qmlDomCmd));
return jsonDoc.object(); return jsonDoc.object();
#else
#warning Generating QtQuickView Java Contents is not possible with missing QProcess feature.
return QJsonObject();
#endif
}; };
const auto getComponent = [](const QJsonObject &dom) -> QJsonObject { const auto getComponent = [](const QJsonObject &dom) -> QJsonObject {