diff options
author | Ulf Hermann <ulf.hermann@qt.io> | 2017-03-02 13:25:04 +0100 |
---|---|---|
committer | Ulf Hermann <ulf.hermann@qt.io> | 2017-09-12 14:23:15 +0000 |
commit | 4cb8667d20ff9f4af1451c54560ea864630f49b9 (patch) | |
tree | 800c187243f86e5e655c261ff895f519ffe43bb2 | |
parent | 1ace238ce0347857a5ba55d6fa30ba81fed204b9 (diff) | |
download | qttools-4cb8667d20ff9f4af1451c54560ea864630f49b9.tar.gz |
Fix problems when building with -no-feature-process
Guard the QProcess includes, modernize some ifdefs, exclude tests and
examples that don't work without processes, and use QT_CONFIG(process)
rather than QT_BOOTSTRAPPED as discriminator where we are actually
checking for QProcess support. Also, don't try to build linguist and
designer without QProcess.
Change-Id: I4e1c7485a96ff02f2f6241113add35e44dc54b1d
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
-rw-r--r-- | examples/examples.pro | 2 | ||||
-rw-r--r-- | src/linguist/linguist.pro | 2 | ||||
-rw-r--r-- | src/linguist/shared/qmakebuiltins.cpp | 6 | ||||
-rw-r--r-- | src/linguist/shared/qmakeevaluator.h | 4 | ||||
-rw-r--r-- | src/linguist/shared/qmakeglobals.cpp | 2 | ||||
-rw-r--r-- | src/linguist/shared/qmakeglobals.h | 2 | ||||
-rw-r--r-- | src/qtdiag/qtdiag.cpp | 4 | ||||
-rw-r--r-- | src/src.pro | 8 | ||||
-rw-r--r-- | tests/auto/auto.pro | 3 | ||||
-rw-r--r-- | tests/auto/qtdiag/tst_qtdiag.cpp | 8 | ||||
-rw-r--r-- | tests/auto/windeployqt/tst_windeployqt.cpp | 15 |
11 files changed, 18 insertions, 38 deletions
diff --git a/examples/examples.pro b/examples/examples.pro index 69365d18d..0300e3c04 100644 --- a/examples/examples.pro +++ b/examples/examples.pro @@ -1,4 +1,4 @@ TEMPLATE = subdirs qtHaveModule(widgets): SUBDIRS += help designer linguist uitools assistant -winrt: SUBDIRS -= assistant designer +!qtConfig(process): SUBDIRS -= assistant designer diff --git a/src/linguist/linguist.pro b/src/linguist/linguist.pro index 3a70580f6..103336daf 100644 --- a/src/linguist/linguist.pro +++ b/src/linguist/linguist.pro @@ -3,7 +3,7 @@ SUBDIRS = \ lrelease \ lupdate \ lconvert -!no-png:qtHaveModule(widgets): SUBDIRS += linguist +!no-png:qtHaveModule(widgets):qtConfig(process): SUBDIRS += linguist qtNomakeTools( \ linguist \ diff --git a/src/linguist/shared/qmakebuiltins.cpp b/src/linguist/shared/qmakebuiltins.cpp index 19fc6d639..dde02544d 100644 --- a/src/linguist/shared/qmakebuiltins.cpp +++ b/src/linguist/shared/qmakebuiltins.cpp @@ -435,7 +435,7 @@ QMakeEvaluator::writeFile(const QString &ctx, const QString &fn, QIODevice::Open return ReturnTrue; } -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) void QMakeEvaluator::runProcess(QProcess *proc, const QString &command) const { proc->setWorkingDirectory(currentDirectory()); @@ -456,7 +456,7 @@ void QMakeEvaluator::runProcess(QProcess *proc, const QString &command) const QByteArray QMakeEvaluator::getCommandOutput(const QString &args, int *exitCode) const { QByteArray out; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) QProcess proc; runProcess(&proc, args); *exitCode = (proc.exitStatus() == QProcess::NormalExit) ? proc.exitCode() : -1; @@ -1653,7 +1653,7 @@ QMakeEvaluator::VisitReturn QMakeEvaluator::evaluateBuiltinConditional( #ifdef PROEVALUATOR_FULL if (m_cumulative) // Anything else would be insanity return ReturnFalse; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) QProcess proc; proc.setProcessChannelMode(QProcess::ForwardedChannels); runProcess(&proc, args.at(0).toQString(m_tmp2)); diff --git a/src/linguist/shared/qmakeevaluator.h b/src/linguist/shared/qmakeevaluator.h index 5a430c14b..d68543482 100644 --- a/src/linguist/shared/qmakeevaluator.h +++ b/src/linguist/shared/qmakeevaluator.h @@ -44,7 +44,7 @@ #include <qstring.h> #include <qstringlist.h> #include <qshareddata.h> -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) # include <qprocess.h> #else # include <qiodevice.h> @@ -237,7 +237,7 @@ public: VisitReturn writeFile(const QString &ctx, const QString &fn, QIODevice::OpenMode mode, bool exe, const QString &contents); -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) void runProcess(QProcess *proc, const QString &command) const; #endif QByteArray getCommandOutput(const QString &args, int *exitCode) const; diff --git a/src/linguist/shared/qmakeglobals.cpp b/src/linguist/shared/qmakeglobals.cpp index 0b2a1ffce..471d42fce 100644 --- a/src/linguist/shared/qmakeglobals.cpp +++ b/src/linguist/shared/qmakeglobals.cpp @@ -312,7 +312,7 @@ QString QMakeGlobals::expandEnvVars(const QString &str) const bool QMakeGlobals::initProperties() { QByteArray data; -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) QProcess proc; proc.start(qmake_abslocation, QStringList() << QLatin1String("-query")); if (!proc.waitForFinished()) diff --git a/src/linguist/shared/qmakeglobals.h b/src/linguist/shared/qmakeglobals.h index 756f69dd9..0f7082fd1 100644 --- a/src/linguist/shared/qmakeglobals.h +++ b/src/linguist/shared/qmakeglobals.h @@ -38,7 +38,7 @@ #include <qhash.h> #include <qstringlist.h> -#ifndef QT_BOOTSTRAPPED +#if QT_CONFIG(process) # include <qprocess.h> #endif #ifdef PROEVALUATOR_THREAD_SAFE diff --git a/src/qtdiag/qtdiag.cpp b/src/qtdiag/qtdiag.cpp index 0d351b256..d07921d07 100644 --- a/src/qtdiag/qtdiag.cpp +++ b/src/qtdiag/qtdiag.cpp @@ -418,7 +418,7 @@ QString qtDiag(unsigned flags) #endif str << '\n'; -#ifndef QT_NO_PROCESS +#if QT_CONFIG(process) const QProcessEnvironment systemEnvironment = QProcessEnvironment::systemEnvironment(); str << "\nEnvironment:\n"; const QStringList keys = systemEnvironment.keys(); @@ -426,7 +426,7 @@ QString qtDiag(unsigned flags) if (key.startsWith(QLatin1Char('Q'))) str << " " << key << "=\"" << systemEnvironment.value(key) << "\"\n"; } -#endif // !QT_NO_PROCESS +#endif // QT_CONFIG(process) const QByteArrayList features = qtFeatures(); if (!features.isEmpty()) diff --git a/src/src.pro b/src/src.pro index 41064a5d5..13d9ec089 100644 --- a/src/src.pro +++ b/src/src.pro @@ -5,10 +5,12 @@ qtHaveModule(widgets) { message("Some graphics-related tools are unavailable without PNG support") } else { SUBDIRS = assistant \ - pixeltool \ - designer + pixeltool - linguist.depends = designer + qtConfig(process) { + SUBDIRS += designer + linguist.depends = designer + } } } diff --git a/tests/auto/auto.pro b/tests/auto/auto.pro index 53466702f..15a7cf569 100644 --- a/tests/auto/auto.pro +++ b/tests/auto/auto.pro @@ -25,5 +25,6 @@ cross_compile:SUBDIRS -= linguist qhelpindexmodel \ qhelpprojectdata \ -android|ios|qnx|winrt: SUBDIRS -= qtdiag +!qtConfig(process): SUBDIRS -= qtattributionsscanner linguist qtdiag windeployqt +android|qnx: SUBDIRS -= qtdiag !win32|winrt: SUBDIRS -= windeployqt diff --git a/tests/auto/qtdiag/tst_qtdiag.cpp b/tests/auto/qtdiag/tst_qtdiag.cpp index 96c33abab..207c450c2 100644 --- a/tests/auto/qtdiag/tst_qtdiag.cpp +++ b/tests/auto/qtdiag/tst_qtdiag.cpp @@ -46,9 +46,6 @@ private: void tst_QtDiag::initTestCase() { -#ifdef QT_NO_PROCESS - QSKIP("This test requires QProcess support"); -#else QString binary = QLibraryInfo::location(QLibraryInfo::BinariesPath) + QStringLiteral("/qtdiag"); # ifdef Q_OS_WIN binary += QStringLiteral(".exe"); @@ -62,14 +59,10 @@ void tst_QtDiag::initTestCase() + QByteArrayLiteral("' does not exist."); QSKIP(message.constData()); } -#endif // !QT_NO_PROCESS } void tst_QtDiag::run() { -#ifdef QT_NO_PROCESS - QSKIP("This test requires QProcess support"); -#else if (m_binary.isEmpty()) QSKIP("Binary could not be found"); QProcess process; @@ -83,7 +76,6 @@ void tst_QtDiag::run() QVERIFY(!output.isEmpty()); output.replace('\r', ""); qDebug("\n%s", output.constData()); -#endif // !QT_NO_PROCESS } QTEST_MAIN(tst_QtDiag) diff --git a/tests/auto/windeployqt/tst_windeployqt.cpp b/tests/auto/windeployqt/tst_windeployqt.cpp index 30da829e7..f20e59180 100644 --- a/tests/auto/windeployqt/tst_windeployqt.cpp +++ b/tests/auto/windeployqt/tst_windeployqt.cpp @@ -37,7 +37,6 @@ #include <QtCore/QTextStream> #include <QtTest/QtTest> -#ifndef QT_NO_PROCESS static const QString msgProcessError(const QProcess &process, const QString &what, const QByteArray &stdOut = QByteArray(), const QByteArray &stdErr = QByteArray()) @@ -98,8 +97,6 @@ static bool runProcess(const QString &binary, return true; } -#endif // !QT_NO_PROCESS - class tst_windeployqt : public QObject { Q_OBJECT @@ -116,9 +113,6 @@ private: void tst_windeployqt::initTestCase() { -#ifdef QT_NO_PROCESS - QSKIP("This test requires QProcess support"); -#else m_windeployqtBinary = QStandardPaths::findExecutable("windeployqt"); QVERIFY(!m_windeployqtBinary.isEmpty()); m_testApp = QFINDTESTDATA("testapp"); @@ -126,14 +120,10 @@ void tst_windeployqt::initTestCase() const QFileInfo testAppBinary(m_testApp + QLatin1String("/testapp.exe")); QVERIFY2(testAppBinary.isFile(), qPrintable(testAppBinary.absoluteFilePath())); m_testAppBinary = testAppBinary.absoluteFilePath(); -#endif // QT_NO_PROCESS } void tst_windeployqt::help() { -#ifdef QT_NO_PROCESS - QSKIP("This test requires QProcess support"); -#else QString errorMessage; QByteArray stdOut; QByteArray stdErr; @@ -141,7 +131,6 @@ void tst_windeployqt::help() QString(), QProcessEnvironment(), 5000, &stdOut, &stdErr), qPrintable(errorMessage)); QVERIFY2(!stdOut.isEmpty(), stdErr); -#endif // QT_NO_PROCESS } // deploy(): Deploys the test application and launches it with Qt removed from the environment @@ -149,9 +138,6 @@ void tst_windeployqt::help() void tst_windeployqt::deploy() { -#ifdef QT_NO_PROCESS - QSKIP("This test requires QProcess support"); -#else QString errorMessage; // Deploy application QStringList deployArguments; @@ -189,7 +175,6 @@ void tst_windeployqt::deploy() // Verify that application still runs QVERIFY2(runProcess(m_testAppBinary, QStringList(), &errorMessage, QString(), env, 10000), qPrintable(errorMessage)); -#endif // QT_NO_PROCESS } QTEST_MAIN(tst_windeployqt) |