forked from qt-creator/qt-creator
Clang: Fix release build
* The QtTest include is not available in release builds. * Make the batch file mode only available in debug/test builds as that one uses test utilities that are only available in debug builds. Change-Id: I441c51ec00b14b81a396ad0199882cf46fff10b0 Reviewed-by: David Schulz <david.schulz@qt.io>
This commit is contained in:
@@ -54,7 +54,7 @@
|
||||
#include <QLoggingCategory>
|
||||
#include <QSharedPointer>
|
||||
#include <QString>
|
||||
#include <QtTest>
|
||||
#include <QThread>
|
||||
|
||||
using namespace ClangBackEnd;
|
||||
using namespace ClangCodeModel;
|
||||
|
@@ -9,9 +9,7 @@ SOURCES += \
|
||||
clangassistproposal.cpp \
|
||||
clangassistproposalitem.cpp \
|
||||
clangassistproposalmodel.cpp \
|
||||
clangautomationutils.cpp \
|
||||
clangbackendipcintegration.cpp \
|
||||
clangbatchfileprocessor.cpp \
|
||||
clangcodemodelplugin.cpp \
|
||||
clangcompletionassistinterface.cpp \
|
||||
clangcompletionassistprocessor.cpp \
|
||||
@@ -41,9 +39,7 @@ HEADERS += \
|
||||
clangassistproposal.h \
|
||||
clangassistproposalitem.h \
|
||||
clangassistproposalmodel.h \
|
||||
clangautomationutils.h \
|
||||
clangbackendipcintegration.h \
|
||||
clangbatchfileprocessor.h \
|
||||
clangcodemodelplugin.h \
|
||||
clangcompletionassistinterface.h \
|
||||
clangcompletionassistprocessor.h \
|
||||
@@ -80,10 +76,14 @@ DISTFILES += \
|
||||
|
||||
equals(TEST, 1) {
|
||||
HEADERS += \
|
||||
test/clangcodecompletion_test.h
|
||||
test/clangautomationutils.h \
|
||||
test/clangbatchfileprocessor.h \
|
||||
test/clangcodecompletion_test.h \
|
||||
|
||||
SOURCES += \
|
||||
test/clangcodecompletion_test.cpp
|
||||
test/clangautomationutils.cpp \
|
||||
test/clangbatchfileprocessor.cpp \
|
||||
test/clangcodecompletion_test.cpp \
|
||||
|
||||
RESOURCES += test/data/clangtestdata.qrc
|
||||
OTHER_FILES += $$files(test/data/*)
|
||||
|
@@ -41,12 +41,8 @@ QtcPlugin {
|
||||
"clangassistproposalitem.h",
|
||||
"clangassistproposalmodel.cpp",
|
||||
"clangassistproposalmodel.h",
|
||||
"clangautomationutils.cpp",
|
||||
"clangautomationutils.h",
|
||||
"clangbackendipcintegration.cpp",
|
||||
"clangbackendipcintegration.h",
|
||||
"clangbatchfileprocessor.cpp",
|
||||
"clangbatchfileprocessor.h",
|
||||
"clangcodemodel.qrc",
|
||||
"clangcodemodelplugin.cpp",
|
||||
"clangcodemodelplugin.h",
|
||||
@@ -102,6 +98,10 @@ QtcPlugin {
|
||||
condition: qtc.testsEnabled
|
||||
prefix: "test/"
|
||||
files: [
|
||||
"clangautomationutils.cpp",
|
||||
"clangautomationutils.h",
|
||||
"clangbatchfileprocessor.cpp",
|
||||
"clangbatchfileprocessor.h",
|
||||
"clangcodecompletion_test.cpp",
|
||||
"clangcodecompletion_test.h",
|
||||
"data/clangtestdata.qrc",
|
||||
|
@@ -98,11 +98,13 @@ void ClangCodeModelPlugin::extensionsInitialized()
|
||||
// For e.g. creation of profile-guided optimization builds.
|
||||
void ClangCodeModelPlugin::maybeHandleBatchFileAndExit() const
|
||||
{
|
||||
#ifdef WITH_TESTS
|
||||
const QString batchFilePath = QString::fromLocal8Bit(qgetenv("QTC_CLANG_BATCH"));
|
||||
if (!batchFilePath.isEmpty() && QTC_GUARD(QFileInfo::exists(batchFilePath))) {
|
||||
const bool runSucceeded = runClangBatchFile(batchFilePath);
|
||||
QCoreApplication::exit(!runSucceeded);
|
||||
}
|
||||
#endif
|
||||
}
|
||||
|
||||
#ifdef WITH_TESTS
|
||||
|
Reference in New Issue
Block a user