From 8260b79458927cff98b4c09f7e0083753effc40d Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 27 Apr 2015 16:11:28 +0200 Subject: Fix getting test configuration information This was especially wrong if the information is not available before building the project. Now the information will be fetched after a possible automatic build had been done. Change-Id: If92bc714039733700885820648471e355199079d Reviewed-by: David Schulz --- plugins/autotest/testconfiguration.cpp | 117 ++++++++++++++++++++++++++++- plugins/autotest/testconfiguration.h | 8 +- plugins/autotest/testrunner.cpp | 32 ++++---- plugins/autotest/testtreemodel.cpp | 131 ++++++--------------------------- 4 files changed, 155 insertions(+), 133 deletions(-) diff --git a/plugins/autotest/testconfiguration.cpp b/plugins/autotest/testconfiguration.cpp index 7c161289ef..4b294f4782 100644 --- a/plugins/autotest/testconfiguration.cpp +++ b/plugins/autotest/testconfiguration.cpp @@ -19,7 +19,17 @@ #include "testconfiguration.h" +#include + +#include +#include +#include #include +#include +#include +#include + +using namespace ProjectExplorer; namespace Autotest { namespace Internal { @@ -34,9 +44,8 @@ TestConfiguration::TestConfiguration(const QString &testClass, const QStringList m_project(0), m_guessedConfiguration(false) { - if (testCases.size() != 0) { + if (testCases.size() != 0) m_testCaseCount = testCases.size(); - } } TestConfiguration::~TestConfiguration() @@ -44,6 +53,103 @@ TestConfiguration::~TestConfiguration() m_testCases.clear(); } +void basicProjectInformation(Project *project, const QString &mainFilePath, QString *proFile, + QString *displayName, Project **targetProject) +{ + CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); + QList projParts = cppMM->projectInfo(project).projectParts(); + + foreach (const CppTools::ProjectPart::Ptr &part, projParts) { + foreach (const CppTools::ProjectFile currentFile, part->files) { + if (currentFile.path == mainFilePath) { + *proFile = part->projectFile; + *displayName = part->displayName; + *targetProject = part->project; + return; + } + } + } +} + +void extractEnvironmentInformation(LocalApplicationRunConfiguration *localRunConfiguration, + QString *workDir, Utils::Environment *env) +{ + *workDir = Utils::FileUtils::normalizePathName(localRunConfiguration->workingDirectory()); + if (auto environmentAspect = localRunConfiguration->extraAspect()) + *env = environmentAspect->environment(); +} + +void TestConfiguration::completeTestInformation() +{ + QTC_ASSERT(!m_mainFilePath.isEmpty(), return); + + typedef LocalApplicationRunConfiguration LocalRunConfig; + + Project *project = SessionManager::startupProject(); + if (!project) + return; + + QString targetFile; + QString targetName; + QString workDir; + QString proFile; + QString displayName; + Project *targetProject = 0; + Utils::Environment env; + bool hasDesktopTarget = false; + bool guessedRunConfiguration = false; + setProject(0); + + basicProjectInformation(project, m_mainFilePath, &proFile, &displayName, &targetProject); + + Target *target = project->activeTarget(); + if (!target) + return; + + BuildTargetInfoList appTargets = target->applicationTargets(); + foreach (const BuildTargetInfo &bti, appTargets.list) { + // some project manager store line/column information as well inside ProjectPart + if (bti.isValid() && proFile.startsWith(bti.projectFilePath.toString())) { + targetFile = Utils::HostOsInfo::withExecutableSuffix(bti.targetFilePath.toString()); + targetName = bti.targetName; + break; + } + } + + QList rcs = target->runConfigurations(); + foreach (RunConfiguration *rc, rcs) { + auto config = qobject_cast(rc); + if (config && config->executable() == targetFile) { + extractEnvironmentInformation(config, &workDir, &env); + hasDesktopTarget = true; + break; + } + } + + // if we could not figure out the run configuration + // try to use the run configuration of the parent project + if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { + if (auto config = qobject_cast(target->activeRunConfiguration())) { + extractEnvironmentInformation(config, &workDir, &env); + hasDesktopTarget = true; + guessedRunConfiguration = true; + } + } + + setProFile(proFile); + setDisplayName(displayName); + + if (hasDesktopTarget) { + setTargetFile(targetFile); + setTargetName(targetName); + setWorkingDirectory(workDir); + setEnvironment(env); + setProject(project); + setGuessedConfiguration(guessedRunConfiguration); + } +} + + /** * @brief sets the test cases for this test configuration. * @@ -64,6 +170,11 @@ void TestConfiguration::setTestCaseCount(int count) m_testCaseCount = count; } +void TestConfiguration::setMainFilePath(const QString &mainFile) +{ + m_mainFilePath = mainFile; +} + void TestConfiguration::setTargetFile(const QString &targetFile) { m_targetFile = targetFile; @@ -94,7 +205,7 @@ void TestConfiguration::setEnvironment(const Utils::Environment &env) m_environment = env; } -void TestConfiguration::setProject(ProjectExplorer::Project *project) +void TestConfiguration::setProject(Project *project) { m_project = project; } diff --git a/plugins/autotest/testconfiguration.h b/plugins/autotest/testconfiguration.h index aff75d6405..e1d3bc000e 100644 --- a/plugins/autotest/testconfiguration.h +++ b/plugins/autotest/testconfiguration.h @@ -41,8 +41,11 @@ public: int testCaseCount = 0, QObject *parent = 0); ~TestConfiguration(); + void completeTestInformation(); + void setTestCases(const QStringList &testCases); void setTestCaseCount(int count); + void setMainFilePath(const QString &mainFile); void setTargetFile(const QString &targetFile); void setTargetName(const QString &targetName); void setProFile(const QString &proFile); @@ -66,14 +69,11 @@ public: bool unnamedOnly() const { return m_unnamedOnly; } bool guessedConfiguration() const { return m_guessedConfiguration; } -signals: - -public slots: - private: QString m_testClass; QStringList m_testCases; int m_testCaseCount; + QString m_mainFilePath; bool m_unnamedOnly; QString m_proFile; QString m_targetFile; diff --git a/plugins/autotest/testrunner.cpp b/plugins/autotest/testrunner.cpp index 07f90a56ad..bc246ed6aa 100644 --- a/plugins/autotest/testrunner.cpp +++ b/plugins/autotest/testrunner.cpp @@ -110,8 +110,16 @@ void performTestRun(QFutureInterface &futureInterface, const QString metricsOption, TestRunner* testRunner) { int testCaseCount = 0; - foreach (const TestConfiguration *config, selectedTests) - testCaseCount += config->testCaseCount(); + foreach (TestConfiguration *config, selectedTests) { + config->completeTestInformation(); + if (config->project()) { + testCaseCount += config->testCaseCount(); + } else { + emitTestResultCreated(FaultyTestResult(Result::MESSAGE_WARN, + QObject::tr("Project is null for \"%1\". Removing from test run.\n" + "Check the test environment.").arg(config->displayName()))); + } + } QProcess testProcess; testProcess.setReadChannelMode(QProcess::MergedChannels); @@ -135,11 +143,16 @@ void performTestRun(QFutureInterface &futureInterface, if (futureInterface.isCanceled()) break; + if (!testConfiguration->project()) + continue; + QProcessEnvironment environment = testConfiguration->environment().toProcessEnvironment(); QString commandFilePath = executableFilePath(testConfiguration->targetFile(), environment); if (commandFilePath.isEmpty()) { emitTestResultCreated(FaultyTestResult(Result::MESSAGE_FATAL, - QObject::tr("Could not find command \"%1\".").arg(testConfiguration->targetFile()))); + QObject::tr("Could not find command \"%1\". (%2)") + .arg(testConfiguration->targetFile()) + .arg(testConfiguration->displayName()))); continue; } @@ -197,26 +210,13 @@ void TestRunner::runTests() // clear old log and output pane TestResultsPane::instance()->clearContents(); - // handle faulty test configurations - QList toBeRemoved; foreach (TestConfiguration *config, m_selectedTests) { - if (!config->project()) { - toBeRemoved.append(config); - TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, - tr("Project is null for \"%1\". Removing from test run.\n" - "Check the test environment." - ).arg(config->displayName()))); - } if (displayRunConfigWarnings && config->guessedConfiguration()) { TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, tr("Project's run configuration was guessed for \"%1\".\n" "This might cause trouble during execution.").arg(config->displayName()))); } } - foreach (TestConfiguration *config, toBeRemoved) { - m_selectedTests.removeOne(config); - delete config; - } if (m_selectedTests.empty()) { TestResultsPane::instance()->addTestResult(FaultyTestResult(Result::MESSAGE_WARN, diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 134a9dc214..602cea007a 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -24,21 +24,14 @@ #include -#include -#include -#include #include -#include -#include #include -#include #include #include -#include -#include +#include #include @@ -347,113 +340,22 @@ bool TestTreeModel::hasTests() const return m_autoTestRootItem->childCount() > 0 || m_quickTestRootItem->childCount() > 0; } -static void addProjectInformation(TestConfiguration *config, const QString &filePath) -{ - const ProjectExplorer::SessionManager *session = ProjectExplorer::SessionManager::instance(); - if (!session || !session->hasProjects()) - return; - - ProjectExplorer::Project *project = session->startupProject(); - if (!project) - return; - - QString targetFile; - QString targetName; - QString workDir; - QString proFile; - QString displayName; - ProjectExplorer::Project *targetProject = 0; - Utils::Environment env; - bool hasDesktopTarget = false; - bool guessedRunConfiguration = false; - CppTools::CppModelManager *cppMM = CppTools::CppModelManager::instance(); - QList projParts = cppMM->projectInfo(project).projectParts(); - - if (!projParts.empty()) { - foreach (const CppTools::ProjectPart::Ptr &part, projParts) { - foreach (const CppTools::ProjectFile currentFile, part->files) { - if (currentFile.path == filePath) { - proFile = part->projectFile; - displayName = part->displayName; - targetProject = part->project; - break; - } - } - if (!proFile.isEmpty()) // maybe better use a goto instead of the break above?? - break; - } - } - - if (project) { - if (auto target = project->activeTarget()) { - ProjectExplorer::BuildTargetInfoList appTargets = target->applicationTargets(); - foreach (const ProjectExplorer::BuildTargetInfo &bti, appTargets.list) { - if (bti.isValid() && bti.projectFilePath.toString() == proFile) { - targetFile = Utils::HostOsInfo::withExecutableSuffix(bti.targetFilePath.toString()); - targetName = bti.targetName; - break; - } - } - - QList rcs = target->runConfigurations(); - foreach (ProjectExplorer::RunConfiguration *rc, rcs) { - ProjectExplorer::LocalApplicationRunConfiguration *localRunConfiguration - = qobject_cast(rc); - if (localRunConfiguration && localRunConfiguration->executable() == targetFile) { - hasDesktopTarget = true; - workDir = Utils::FileUtils::normalizePathName( - localRunConfiguration->workingDirectory()); - ProjectExplorer::EnvironmentAspect *envAsp - = localRunConfiguration->extraAspect(); - env = envAsp->environment(); - break; - } - } - - // if we could not figure out the run configuration - // try to use the run configuration of the parent project - if (!hasDesktopTarget && targetProject && !targetFile.isEmpty()) { - auto localRunConfiguration - = qobject_cast(target->activeRunConfiguration()); - if (localRunConfiguration) { - hasDesktopTarget = true; - workDir = Utils::FileUtils::normalizePathName( - localRunConfiguration->workingDirectory()); - ProjectExplorer::EnvironmentAspect *environmentAspect - = localRunConfiguration->extraAspect(); - env = environmentAspect->environment(); - guessedRunConfiguration = true; - } - } - } - } - - if (hasDesktopTarget) { - config->setTargetFile(targetFile); - config->setTargetName(targetName); - config->setWorkingDirectory(workDir); - config->setProFile(proFile); - config->setEnvironment(env); - config->setProject(project); - config->setDisplayName(displayName); - config->setGuessedConfiguration(guessedRunConfiguration); - } else { - config->setProFile(proFile); - config->setDisplayName(displayName); - } -} - QList TestTreeModel::getAllTestCases() const { QList result; + ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); + if (!project) + return result; + // get all Auto Tests for (int row = 0, count = m_autoTestRootItem->childCount(); row < count; ++row) { const TestTreeItem *child = m_autoTestRootItem->child(row); TestConfiguration *tc = new TestConfiguration(child->name(), QStringList(), child->childCount()); - addProjectInformation(tc, child->filePath()); + tc->setMainFilePath(child->filePath()); + tc->setProject(project); result << tc; } @@ -481,7 +383,8 @@ QList TestTreeModel::getAllTestCases() const foreach (const QString &mainFile, foundMains.keys()) { TestConfiguration *tc = new TestConfiguration(QString(), QStringList(), foundMains.value(mainFile)); - addProjectInformation(tc, mainFile); + tc->setMainFilePath(mainFile); + tc->setProject(project); result << tc; } @@ -491,6 +394,10 @@ QList TestTreeModel::getAllTestCases() const QList TestTreeModel::getSelectedTests() const { QList result; + ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); + if (!project) + return result; + TestConfiguration *testConfiguration = 0; for (int row = 0, count = m_autoTestRootItem->childCount(); row < count; ++row) { @@ -501,7 +408,8 @@ QList TestTreeModel::getSelectedTests() const continue; case Qt::Checked: testConfiguration = new TestConfiguration(child->name(), QStringList(), child->childCount()); - addProjectInformation(testConfiguration, child->filePath()); + testConfiguration->setMainFilePath(child->filePath()); + testConfiguration->setProject(project); result << testConfiguration; continue; case Qt::PartiallyChecked: @@ -516,7 +424,8 @@ QList TestTreeModel::getSelectedTests() const } testConfiguration = new TestConfiguration(childName, testCases); - addProjectInformation(testConfiguration, child->filePath()); + testConfiguration->setMainFilePath(child->filePath()); + testConfiguration->setProject(project); result << testConfiguration; } } @@ -540,7 +449,8 @@ QList TestTreeModel::getSelectedTests() const testConfiguration = new TestConfiguration(QString(), QStringList()); testConfiguration->setTestCaseCount(1); testConfiguration->setUnnamedOnly(true); - addProjectInformation(testConfiguration, mainFile); + testConfiguration->setMainFilePath(mainFile); + testConfiguration->setProject(project); foundMains.insert(mainFile, testConfiguration); } } @@ -581,7 +491,8 @@ QList TestTreeModel::getSelectedTests() const } } else { tc = new TestConfiguration(QString(), testFunctions); - addProjectInformation(tc, child->mainFile()); + tc->setMainFilePath(child->mainFile()); + tc->setProject(project); foundMains.insert(child->mainFile(), tc); } break; -- cgit v1.2.1 From e9b28403273fb2522ecf34164f8f768bbc7c644e Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Thu, 16 Apr 2015 14:04:36 +0200 Subject: Provide 'Run This Test' context menu entry This menu entry will be added only if current selected test (function) is not an unnamed Quick Test. Otherwise it's now possible to execute a particular test case or just a single test function by using the context menu. This avoids the need of (de)selecting inside the model. Change-Id: I857a3ffe72c72a9dbb06e948045cfe2c7843935d Reviewed-by: David Schulz Reviewed-by: Christian Stenger --- plugins/autotest/testnavigationwidget.cpp | 44 ++++++++++++++++++++++++++ plugins/autotest/testnavigationwidget.h | 1 + plugins/autotest/testtreemodel.cpp | 51 +++++++++++++++++++++++++++++++ plugins/autotest/testtreemodel.h | 4 ++- 4 files changed, 99 insertions(+), 1 deletion(-) diff --git a/plugins/autotest/testnavigationwidget.cpp b/plugins/autotest/testnavigationwidget.cpp index f9847a5782..da0de8a761 100644 --- a/plugins/autotest/testnavigationwidget.cpp +++ b/plugins/autotest/testnavigationwidget.cpp @@ -89,7 +89,27 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) const bool enabled = !TestRunner::instance()->isTestRunning() && m_model->parser()->state() == TestCodeParser::Idle; const bool hasTests = m_model->hasTests(); + QMenu menu; + QAction *runThisTest = 0; + const QModelIndexList list = m_view->selectionModel()->selectedIndexes(); + if (list.size() == 1) { + const QModelIndex index = list.first(); + QRect rect(m_view->visualRect(index)); + if (rect.contains(event->pos())) { + // do not provide this menu entry for unnamed Quick Tests as it makes no sense + int type = index.data(TypeRole).toInt(); + const QString &unnamed = tr(Constants::UNNAMED_QUICKTESTS); + if ((type == TestTreeItem::TEST_FUNCTION && index.parent().data().toString() != unnamed) + || (type == TestTreeItem::TEST_CLASS && index.data().toString() != unnamed)) { + runThisTest = new QAction(tr("Run This Test"), &menu); + runThisTest->setEnabled(enabled); + connect(runThisTest, &QAction::triggered, + this, &TestNavigationWidget::onRunThisTestTriggered); + } + } + } + QAction *runAll = Core::ActionManager::command(Constants::ACTION_RUN_ALL_ID)->action(); QAction *runSelected = Core::ActionManager::command(Constants::ACTION_RUN_SELECTED_ID)->action(); QAction *selectAll = new QAction(tr("Select All"), &menu); @@ -106,6 +126,10 @@ void TestNavigationWidget::contextMenuEvent(QContextMenuEvent *event) deselectAll->setEnabled(enabled && hasTests); rescan->setEnabled(enabled); + if (runThisTest) { + menu.addAction(runThisTest); + menu.addSeparator(); + } menu.addAction(runAll); menu.addAction(runSelected); menu.addSeparator(); @@ -210,6 +234,26 @@ void TestNavigationWidget::initializeFilterMenu() m_filterMenu->addAction(action); } +void TestNavigationWidget::onRunThisTestTriggered() +{ + const QModelIndexList selected = m_view->selectionModel()->selectedIndexes(); + // paranoia + if (selected.isEmpty()) + return; + const QModelIndex sourceIndex = m_sortFilterModel->mapToSource(selected.first()); + if (!sourceIndex.isValid()) + return; + + TestTreeItem *item = static_cast(sourceIndex.internalPointer()); + if (item->type() == TestTreeItem::TEST_CLASS || item->type() == TestTreeItem::TEST_FUNCTION) { + if (TestConfiguration *configuration = m_model->getTestConfiguration(item)) { + TestRunner *runner = TestRunner::instance(); + runner->setSelectedTests( {configuration} ); + runner->runTests(); + } + } +} + TestNavigationWidgetFactory::TestNavigationWidgetFactory() { setDisplayName(tr("Tests")); diff --git a/plugins/autotest/testnavigationwidget.h b/plugins/autotest/testnavigationwidget.h index a4b4c6f061..ef28130817 100644 --- a/plugins/autotest/testnavigationwidget.h +++ b/plugins/autotest/testnavigationwidget.h @@ -69,6 +69,7 @@ private slots: private: void initializeFilterMenu(); + void onRunThisTestTriggered(); TestTreeModel *m_model; TestTreeSortFilterModel *m_sortFilterModel; diff --git a/plugins/autotest/testtreemodel.cpp b/plugins/autotest/testtreemodel.cpp index 602cea007a..4639cbd1e9 100644 --- a/plugins/autotest/testtreemodel.cpp +++ b/plugins/autotest/testtreemodel.cpp @@ -255,6 +255,8 @@ QVariant TestTreeModel::data(const QModelIndex &index, int role) const default: return false; } + case TypeRole: + return item->type(); } // TODO ? @@ -506,6 +508,55 @@ QList TestTreeModel::getSelectedTests() const return result; } +TestConfiguration *TestTreeModel::getTestConfiguration(const TestTreeItem *item) const +{ + QTC_ASSERT(item != 0, return 0); + ProjectExplorer::Project *project = ProjectExplorer::SessionManager::startupProject(); + QTC_ASSERT(project, return 0); + + TestConfiguration *config = 0; + switch (item->type()) { + case TestTreeItem::TEST_CLASS: { + if (item->parent() == m_quickTestRootItem) { + // Quick Test TestCase + QStringList testFunctions; + for (int row = 0, count = item->childCount(); row < count; ++row) { + testFunctions << item->name() + QLatin1String("::") + item->child(row)->name(); + } + config = new TestConfiguration(QString(), testFunctions); + config->setMainFilePath(item->mainFile()); + config->setProject(project); + } else { + // normal auto test + config = new TestConfiguration(item->name(), QStringList(), item->childCount()); + config->setMainFilePath(item->filePath()); + config->setProject(project); + } + break; + } + case TestTreeItem::TEST_FUNCTION: { + const TestTreeItem *parent = item->parent(); + if (parent->parent() == m_quickTestRootItem) { + // it's a Quick Test function of a named TestCase + QStringList testFunction(parent->name() + QLatin1String("::") + item->name()); + config = new TestConfiguration(QString(), testFunction); + config->setMainFilePath(parent->mainFile()); + config->setProject(project); + } else { + // normal auto test + config = new TestConfiguration(parent->name(), QStringList() << item->name()); + config->setMainFilePath(parent->filePath()); + config->setProject(project); + } + break; + } + // not supported items + default: + return 0; + } + return config; +} + QString TestTreeModel::getMainFileForUnnamedQuickTest(const QString &qmlFile) const { const TestTreeItem *unnamed = unnamedQuickTests(); diff --git a/plugins/autotest/testtreemodel.h b/plugins/autotest/testtreemodel.h index 15a00ecb38..785606c36a 100644 --- a/plugins/autotest/testtreemodel.h +++ b/plugins/autotest/testtreemodel.h @@ -31,7 +31,8 @@ namespace { enum ItemRole { // AnnotationRole = Qt::UserRole + 1, LinkRole = Qt::UserRole + 2, // can be removed if AnnotationRole comes back - ItalicRole // used only inside the delegate + ItalicRole, // used only inside the delegate + TypeRole }; } @@ -71,6 +72,7 @@ public: bool hasTests() const; QList getAllTestCases() const; QList getSelectedTests() const; + TestConfiguration *getTestConfiguration(const TestTreeItem *item) const; QString getMainFileForUnnamedQuickTest(const QString &qmlFile) const; void qmlFilesForMainFile(const QString &mainFile, QSet *filePaths) const; QList getUnnamedQuickTestFunctions() const; -- cgit v1.2.1 From a133256e3704a7ca685d2f8082c69e5bc8bdaee9 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Tue, 23 Jun 2015 12:51:15 +0200 Subject: Fix display of benchmark results The '-' could have been misinterpreted as sign of the value following it. Change-Id: Ia308cca93f81e7fa026485e9cda3fcc433696a35 Reviewed-by: David Schulz --- plugins/autotest/testresultdelegate.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/plugins/autotest/testresultdelegate.cpp b/plugins/autotest/testresultdelegate.cpp index c20ce11200..5e37c64955 100644 --- a/plugins/autotest/testresultdelegate.cpp +++ b/plugins/autotest/testresultdelegate.cpp @@ -114,7 +114,7 @@ void TestResultDelegate::paint(QPainter *painter, const QStyleOptionViewItem &op output.append(QString::fromLatin1(" (%1)").arg(testResult.dataTag())); if (!desc.isEmpty()) { int breakPos = desc.indexOf(QLatin1Char('(')); - output.append(QLatin1String(" - ")).append(desc.left(breakPos)); + output.append(QLatin1String(": ")).append(desc.left(breakPos)); if (selected) output.append(QLatin1Char('\n')).append(desc.mid(breakPos)); } -- cgit v1.2.1 From eee4f2c6ac87fc42a34be04a755167bb9fdc50d2 Mon Sep 17 00:00:00 2001 From: Kai Koehne Date: Thu, 11 Jun 2015 17:21:54 +0200 Subject: Make licensechecker dependency optional Change-Id: Ia353ef7065dbd7dd3ff1f3a9293613cf7f14ce37 Reviewed-by: Eike Ziller --- plugins/autotest/autotest.pro | 1 + plugins/autotest/autotest_dependencies.pri | 5 +++-- plugins/autotest/autotestplugin.cpp | 6 +++++- 3 files changed, 9 insertions(+), 3 deletions(-) diff --git a/plugins/autotest/autotest.pro b/plugins/autotest/autotest.pro index 4d3c6643f2..4022cb4399 100644 --- a/plugins/autotest/autotest.pro +++ b/plugins/autotest/autotest.pro @@ -7,6 +7,7 @@ include(../../qtcreatorplugin.pri) include(autotest_dependencies.pri) DEFINES += AUTOTEST_LIBRARY +CONFIG(licensechecker): DEFINES += LICENSECHECKER SOURCES += \ testtreeview.cpp \ diff --git a/plugins/autotest/autotest_dependencies.pri b/plugins/autotest/autotest_dependencies.pri index a21b5fce96..74dc51e15b 100644 --- a/plugins/autotest/autotest_dependencies.pri +++ b/plugins/autotest/autotest_dependencies.pri @@ -5,8 +5,9 @@ QTC_PLUGIN_DEPENDS += \ projectexplorer \ cpptools \ qmljstools \ - qmakeprojectmanager \ - licensechecker + qmakeprojectmanager + +CONFIG(licensechecker): QTC_PLUGIN_DEPENDS += licensechecker QTC_LIB_DEPENDS += \ cplusplus \ diff --git a/plugins/autotest/autotestplugin.cpp b/plugins/autotest/autotestplugin.cpp index a2ab783418..525f21ae3e 100644 --- a/plugins/autotest/autotestplugin.cpp +++ b/plugins/autotest/autotestplugin.cpp @@ -38,7 +38,9 @@ #include -#include +#ifdef LICENSECHECKER +# include +#endif #include #include @@ -89,6 +91,7 @@ QSharedPointer AutotestPlugin::settings() const bool AutotestPlugin::checkLicense() { +#ifdef LICENSECHECKER LicenseChecker::LicenseCheckerPlugin *licenseChecker = ExtensionSystem::PluginManager::getObject(); @@ -97,6 +100,7 @@ bool AutotestPlugin::checkLicense() return false; } else if (!licenseChecker->enterpriseFeatures()) return false; +#endif // LICENSECHECKER return true; } -- cgit v1.2.1 From c7a8a941618a5eb1bfc99c416c5adaa181b472f6 Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Wed, 24 Jun 2015 15:56:24 +0200 Subject: qbs build: Soft dependency on LicenseChecker. Change-Id: Ibb1f4ee5996306fe24df72b0cf16d5652a76bc57 Reviewed-by: Christian Stenger --- plugins/autotest/autotest.qbs | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/plugins/autotest/autotest.qbs b/plugins/autotest/autotest.qbs index 93505bce3b..4a9ec9e4c8 100644 --- a/plugins/autotest/autotest.qbs +++ b/plugins/autotest/autotest.qbs @@ -1,12 +1,11 @@ import qbs -QtcPlugin { +QtcCommercialPlugin { name: "AutoTest" Depends { name: "Core" } Depends { name: "CppTools" } Depends { name: "CPlusPlus" } - Depends { name: "LicenseChecker" } Depends { name: "ProjectExplorer" } Depends { name: "QmakeProjectManager" } Depends { name: "QmlJS" } -- cgit v1.2.1