From 3ffec118d0f255ba162ad042d03d5054a4c33fcf Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 17 Oct 2016 15:57:46 +0200 Subject: [PATCH 01/33] Squish: Fix switchToBuildOrRunSettingsFor() Properties of the model indices did change recently and so checking for enabled does no more work - use its toolTip content instead to check for the enabled state. Change-Id: Idc2b5ed1a0a14cfabdbdb4231eab243d28c0aee7 Reviewed-by: Robert Loehning --- tests/system/shared/project_explorer.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 29327857822..8ab8f012313 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -83,6 +83,7 @@ def prepareBuildSettings(targetCount, currentTarget, setReleaseBuild=True, disab # param targetCount specifies the number of targets currently defined (must be correct!) # param projectSettings specifies where to switch to (must be one of ProjectSettings.BUILD or ProjectSettings.RUN) def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings): + clickToActivate = "

Click to activate:

" try: treeView = waitForObject(":Projects.ProjectNavigationTreeView") except LookupError: @@ -90,13 +91,14 @@ def switchToBuildOrRunSettingsFor(targetCount, currentTarget, projectSettings): bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView") targetIndices = dumpIndices(treeView.model(), waitForObject(bAndRIndex)) - targets = map(lambda t: str(t.data(0)), filter(lambda x: x.enabled, targetIndices)) + targets = map(lambda t: str(t.data(0)), + filter(lambda x: not str(x.toolTip).startswith(clickToActivate), targetIndices)) if not test.compare(targetCount, len(targets), "Check whether all chosen targets are listed."): return False # we assume the targets are still ordered the same way currentTargetIndex = getQModelIndexStr("text='%s'" % targets[currentTarget], bAndRIndex) - if not test.verify(findObject(currentTargetIndex).enabled, "Verifying target '%s' is enabled." - % targets[currentTarget]): + if not test.verify(not str(findObject(currentTargetIndex).toolTip).startswith(clickToActivate), + "Verifying target '%s' is enabled." % targets[currentTarget]): return False mouseClick(waitForObject(currentTargetIndex)) From 81b255e9601e107cc3134ea06c22b6f2c01308a8 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 21 Dec 2016 10:48:18 +0100 Subject: [PATCH 02/33] MSVC: Increase timeout for environment detection Surprisingly many users apparently do run into the timeout. Task-number: QTCREATORBUG-17474 Change-Id: I756a5164d52feee1e45bfebacbd45cc232628b79 Reviewed-by: Tim Jenssen --- src/plugins/projectexplorer/abstractmsvctoolchain.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp index 94d80a51717..088c095d8af 100644 --- a/src/plugins/projectexplorer/abstractmsvctoolchain.cpp +++ b/src/plugins/projectexplorer/abstractmsvctoolchain.cpp @@ -287,7 +287,7 @@ bool AbstractMsvcToolChain::generateEnvironmentSettings(Utils::Environment &env, // if Creator is launched within a session set up by setenv.cmd. env.unset(QLatin1String("ORIGINALPATH")); run.setEnvironment(env.toStringList()); - run.setTimeoutS(10); + run.setTimeoutS(30); Utils::FileName cmdPath = Utils::FileName::fromUserInput(QString::fromLocal8Bit(qgetenv("COMSPEC"))); if (cmdPath.isEmpty()) cmdPath = env.searchInPath(QLatin1String("cmd.exe")); From 569873628477bef7d64345260e5698912ec683db Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 21 Dec 2016 11:50:43 +0100 Subject: [PATCH 03/33] CMake: CMakeConfigurationKitInformation::setup fix CMakeConfigurationKitInformation::setup did override the existing value when it was called. That is not intended, the setup method should only set a value if none exists. Change-Id: I86d386982311020dc3dbb3a705e1ff87ad02e09c Reviewed-by: Tim Jenssen --- src/plugins/cmakeprojectmanager/cmakekitinformation.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 418974c3d7c..94047a9c7b6 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -624,7 +624,7 @@ QList CMakeConfigurationKitInformation::validate(const Kit *k) const void CMakeConfigurationKitInformation::setup(Kit *k) { - if (k) + if (k && !k->hasValue(CONFIGURATION_ID)) k->setValue(CONFIGURATION_ID, defaultValue(k)); } From 1b46022330e6cb10e67d0878f694f7905f0776a3 Mon Sep 17 00:00:00 2001 From: Ulf Hermann Date: Wed, 21 Dec 2016 15:18:02 +0100 Subject: [PATCH 04/33] ScxmlEditor: Fix typo Change-Id: Icd8ff982a3b8808af4798fb9adb5d8ebefd5a9af Reviewed-by: Alessandro Portale --- src/plugins/scxmleditor/plugin_interface/scxmltypes.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/scxmleditor/plugin_interface/scxmltypes.h b/src/plugins/scxmleditor/plugin_interface/scxmltypes.h index e4179198aae..5b7e4738a09 100644 --- a/src/plugins/scxmleditor/plugin_interface/scxmltypes.h +++ b/src/plugins/scxmleditor/plugin_interface/scxmltypes.h @@ -180,7 +180,7 @@ const scxmltag_attribute_t scxml_send_attributes[] = { { "type", nullptr, false, true, QVariant::String }, { "typeexpr", nullptr, false, true, QVariant::String }, { "id", nullptr, false, true, QVariant::String }, - { "idiocation", nullptr, false, true, QVariant::String }, + { "idlocation", nullptr, false, true, QVariant::String }, { "delay", nullptr, false, true, QVariant::String }, { "delayexpr", nullptr, false, true, QVariant::String }, { "namelist", nullptr, false, true, QVariant::String } @@ -197,7 +197,7 @@ const scxmltag_attribute_t scxml_invoke_attributes[] = { { "src", nullptr, false, true, QVariant::String }, { "srcexpr", nullptr, false, true, QVariant::String }, { "id", nullptr, false, true, QVariant::String }, - { "idiocation", nullptr, false, true, QVariant::String }, + { "idlocation", nullptr, false, true, QVariant::String }, { "namelist", nullptr, false, true, QVariant::String }, { "autoforward", ";true;false", false, true, QVariant::StringList } }; From 92b49c2eb200f480e6c041307d54bd64692eb592 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 27 Dec 2016 08:18:56 +0200 Subject: [PATCH 05/33] Utils: Fix "Unused result" warning in process stub Change-Id: If0fbe55106936526ec4993963f2cb0dc4041f937 Reviewed-by: Oswald Buddenhagen --- src/libs/utils/process_stub_unix.c | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/libs/utils/process_stub_unix.c b/src/libs/utils/process_stub_unix.c index 145d31d50d7..8d9cd8d7495 100644 --- a/src/libs/utils/process_stub_unix.c +++ b/src/libs/utils/process_stub_unix.c @@ -308,7 +308,9 @@ int main(int argc, char *argv[]) execvp(argv[ArgExe], argv + ArgExe); /* Only expected error: no such file or direcotry, i.e. executable not found */ errNo = errno; - write(chldPipe[1], &errNo, sizeof(errNo)); /* Only realistic error case is SIGPIPE */ + /* Only realistic error case is SIGPIPE */ + if (write(chldPipe[1], &errNo, sizeof(errNo)) != sizeof(errNo)) + perror("Error passing errno to child"); _exit(0); default: for (;;) { From 3c9c76c6f33a82e7e41a7171a3d1083d7f145344 Mon Sep 17 00:00:00 2001 From: Przemyslaw Gorszkowski Date: Thu, 29 Dec 2016 13:46:03 +0100 Subject: [PATCH 06/33] GenericProject: show project files in "Project" tree MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This missing project files(*.files, *.includes, *.config) in "Project" tree is a regression. Change-Id: Ib7380b1627a0f31045a25bc152352f5d2c82342a Reviewed-by: André Hartmann Reviewed-by: Eike Ziller Reviewed-by: Orgad Shaneh --- .../genericprojectmanager/genericproject.cpp | 28 +++++++++---------- 1 file changed, 13 insertions(+), 15 deletions(-) diff --git a/src/plugins/genericprojectmanager/genericproject.cpp b/src/plugins/genericprojectmanager/genericproject.cpp index e33d20dd943..b2f26bb5c7d 100644 --- a/src/plugins/genericprojectmanager/genericproject.cpp +++ b/src/plugins/genericprojectmanager/genericproject.cpp @@ -91,21 +91,6 @@ GenericProject::GenericProject(Manager *manager, const QString &fileName) DocumentManager::addDocument(m_includesIDocument); DocumentManager::addDocument(m_configIDocument); - FileNode *projectFilesNode = new FileNode(Utils::FileName::fromString(m_filesFileName), - ProjectFileType, - /* generated = */ false); - - FileNode *projectIncludesNode = new FileNode(Utils::FileName::fromString(m_includesFileName), - ProjectFileType, - /* generated = */ false); - - FileNode *projectConfigNode = new FileNode(Utils::FileName::fromString(m_configFileName), - ProjectFileType, - /* generated = */ false); - - rootProjectNode()->addFileNodes(QList() << projectFilesNode - << projectIncludesNode << projectConfigNode); - projectManager()->registerProject(this); } @@ -282,6 +267,19 @@ void GenericProject::refresh(RefreshOptions options) fileType = ResourceType; return new FileNode(Utils::FileName::fromString(f), fileType, false); }); + + FileNode *projectFilesNode = new FileNode(Utils::FileName::fromString(m_filesFileName), + ProjectFileType, + /* generated = */ false); + + FileNode *projectIncludesNode = new FileNode(Utils::FileName::fromString(m_includesFileName), + ProjectFileType, + /* generated = */ false); + + FileNode *projectConfigNode = new FileNode(Utils::FileName::fromString(m_configFileName), + ProjectFileType, + /* generated = */ false); + fileNodes << projectFilesNode << projectIncludesNode << projectConfigNode; rootProjectNode()->buildTree(fileNodes); } From e7ffd1eefc86aa666348ae4f9c107923314a65fe Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 21 Dec 2016 08:44:10 +0100 Subject: [PATCH 07/33] Editor: Avoid setting text cursor when clearing block selection Task-number: QTCREATORBUG-17475 Change-Id: I0266530c8c2ba10bd14dcb26b946cc51a825600f Reviewed-by: Eike Ziller --- src/plugins/texteditor/texteditor.cpp | 47 ++++++++++++++++----------- 1 file changed, 28 insertions(+), 19 deletions(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 5b1f0f6d7ac..cc6dc39073a 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -423,7 +423,13 @@ public: void enableBlockSelection(const QTextCursor &cursor); void enableBlockSelection(int positionBlock, int positionColumn, int anchorBlock, int anchorColumn); - void disableBlockSelection(bool keepSelection = true); + + enum BlockSelectionUpdateKind { + NoCursorUpdate, + CursorUpdateKeepSelection, + CursorUpdateClearSelection, + }; + void disableBlockSelection(BlockSelectionUpdateKind kind); void resetCursorFlashTimer(); QBasicTimer m_cursorFlashTimer; bool m_cursorVisible; @@ -1469,7 +1475,7 @@ void TextEditorWidget::insertLineAbove() void TextEditorWidget::insertLineBelow() { if (d->m_inBlockSelectionMode) - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); QTextCursor cursor = textCursor(); cursor.beginEditBlock(); cursor.movePosition(QTextCursor::EndOfBlock, QTextCursor::MoveAnchor); @@ -1526,14 +1532,14 @@ void TextEditorWidget::unindent() void TextEditorWidget::undo() { if (d->m_inBlockSelectionMode) - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateClearSelection); QPlainTextEdit::undo(); } void TextEditorWidget::redo() { if (d->m_inBlockSelectionMode) - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateClearSelection); QPlainTextEdit::redo(); } @@ -1572,7 +1578,7 @@ void TextEditorWidgetPrivate::moveLineUpDown(bool up) if (hasSelection) { if (m_inBlockSelectionMode) - disableBlockSelection(true); + disableBlockSelection(NoCursorUpdate); move.setPosition(cursor.selectionStart()); move.movePosition(QTextCursor::StartOfBlock); move.setPosition(cursor.selectionEnd(), QTextCursor::KeepAnchor); @@ -2114,7 +2120,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) && (e == QKeySequence::InsertParagraphSeparator || (!d->m_lineSeparatorsAllowed && e == QKeySequence::InsertLineSeparator))) { if (d->m_inBlockSelectionMode) { - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateClearSelection); e->accept(); return; } @@ -2241,7 +2247,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) return; } else if (!ro && (e == QKeySequence::MoveToNextPage || e == QKeySequence::MoveToPreviousPage) && d->m_inBlockSelectionMode) { - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateClearSelection); QPlainTextEdit::keyPressEvent(e); return; } else if (!ro && (e == QKeySequence::SelectNextPage || e == QKeySequence::SelectPreviousPage) @@ -2341,7 +2347,7 @@ void TextEditorWidget::keyPressEvent(QKeyEvent *e) e->accept(); return; } else if (d->m_inBlockSelectionMode) { // leave block selection mode - d->disableBlockSelection(); + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); } break; case Qt::Key_Insert: @@ -2528,7 +2534,7 @@ void TextEditorWidget::doSetTextCursor(const QTextCursor &cursor, bool keepBlock // workaround for QTextControl bug bool selectionChange = cursor.hasSelection() || textCursor().hasSelection(); if (!keepBlockSelection && d->m_inBlockSelectionMode) - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); QTextCursor c = cursor; c.setVisualNavigation(true); QPlainTextEdit::doSetTextCursor(c); @@ -3502,15 +3508,17 @@ void TextEditorWidgetPrivate::enableBlockSelection(int positionBlock, int positi q->viewport()->update(); } -void TextEditorWidgetPrivate::disableBlockSelection(bool keepSelection) +void TextEditorWidgetPrivate::disableBlockSelection(BlockSelectionUpdateKind kind) { m_inBlockSelectionMode = false; m_cursorFlashTimer.stop(); - QTextCursor cursor = m_blockSelection.selection(m_document.data()); + if (kind != NoCursorUpdate) { + QTextCursor cursor = m_blockSelection.selection(m_document.data()); + if (kind == CursorUpdateClearSelection) + cursor.clearSelection(); + q->setTextCursor(cursor); + } m_blockSelection.clear(); - if (!keepSelection) - cursor.clearSelection(); - q->setTextCursor(cursor); q->viewport()->update(); } @@ -4879,7 +4887,7 @@ void TextEditorWidget::mouseMoveEvent(QMouseEvent *e) viewport()->update(); } } else if (d->m_inBlockSelectionMode) { - d->disableBlockSelection(); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateKeepSelection); } } if (viewport()->cursor().shape() == Qt::BlankCursor) @@ -4923,7 +4931,7 @@ void TextEditorWidget::mousePressEvent(QMouseEvent *e) } } else { if (d->m_inBlockSelectionMode) - d->disableBlockSelection(false); // just in case, otherwise we might get strange drag and drop + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); QTextBlock foldedBlock = d->foldedBlockAt(e->pos()); if (foldedBlock.isValid()) { @@ -6680,7 +6688,7 @@ void TextEditorWidget::cut() void TextEditorWidget::selectAll() { if (d->m_inBlockSelectionMode) - d->disableBlockSelection(); + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); QPlainTextEdit::selectAll(); } @@ -7139,7 +7147,8 @@ void BaseTextEditor::setCursorPosition(int pos) void TextEditorWidget::setCursorPosition(int pos) { - setBlockSelection(false); + if (d->m_inBlockSelectionMode) + d->disableBlockSelection(TextEditorWidgetPrivate::NoCursorUpdate); QTextCursor tc = textCursor(); tc.setPosition(pos); setTextCursor(tc); @@ -7316,7 +7325,7 @@ void TextEditorWidget::setBlockSelection(bool on) if (on) d->enableBlockSelection(textCursor()); else - d->disableBlockSelection(false); + d->disableBlockSelection(TextEditorWidgetPrivate::CursorUpdateClearSelection); } void TextEditorWidget::setBlockSelection(int positionBlock, int positionColumn, From 1dab84e96e56fe9f08bad0e7a6fa9dcc780a99f0 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Tue, 3 Jan 2017 13:58:54 +0100 Subject: [PATCH 08/33] Add change log for 4.2.1 Change-Id: I9161030e01bc89670da1f7122c04d1e0e230c6f3 Reviewed-by: Leena Miettinen --- dist/changes-4.2.1.md | 45 +++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 45 insertions(+) create mode 100644 dist/changes-4.2.1.md diff --git a/dist/changes-4.2.1.md b/dist/changes-4.2.1.md new file mode 100644 index 00000000000..a23795d3f85 --- /dev/null +++ b/dist/changes-4.2.1.md @@ -0,0 +1,45 @@ +Qt Creator version 4.2.1 contains bug fixes. + +The most important changes are listed in this document. For a complete +list of changes, see the Git log for the Qt Creator sources that +you can check out from the public Git repository. For example: + + git clone git://code.qt.io/qt-creator/qt-creator.git + git log --cherry-pick --pretty=oneline v4.2.0..v4.2.1 + +Editing + +* Fixed that viewport could change unexpectedly when block selection was + active but not visible in viewport (QTCREATORBUG-17475) + +All Projects + +* Fixed issue with upgrading tool chain settings in auto-detected kits + +Qbs Projects + +* Fixed that target OS defaulted to host OS if tool chain does not specify + target OS (QTCREATORBUG-17452) + +Generic Projects + +* Fixed that project files were no longer shown in project tree + +Debugging + +* Fixed issue with infinite message boxes being displayed + (QTCREATORBUG-16971) +* Fixed `QObject` property extraction with namespaced Qt builds + +Platform Specific + +Windows + +* Fixed detection of MSVC 2017 RC as MSVC 2017 +* Fixed that environment detection could time out with MSVC + (QTCREATORBUG-17474) + +iOS + +* Fixed that starting applications in simulator could fail, especially with + iOS 10 devices (QTCREATORBUG-17336) From a8f1f758a511e89e82ecdc615037dd33d7767c7e Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Tue, 3 Jan 2017 17:24:03 +0100 Subject: [PATCH 09/33] Clang: Fix tagging of slots with CONFIG+=no_keywords For the CONFIG+=no_keywords case, Q_SLOTS expanded to the undefined "slots". Task-number: QTCREATORBUG-17371 Change-Id: I7891e4b0595647aa02c97c9f80d61f3f5459a61a Reviewed-by: Christian Kandeler --- share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h b/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h index 57c938b55f2..74085598589 100644 --- a/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h +++ b/share/qtcreator/cplusplus/wrappedQtHeaders/QtCore/qobjectdefs.h @@ -43,7 +43,7 @@ #endif #ifdef Q_SLOTS -# define Q_SLOTS slots __attribute__((annotate("qt_slot"))) +# define Q_SLOTS __attribute__((annotate("qt_slot"))) #endif #ifdef Q_SIGNAL From ffabc5dff1c32c5fd17e974722853db61acdb389 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Fri, 23 Dec 2016 00:13:28 +0200 Subject: [PATCH 10/33] QmakePM: Fix false positive warning for incompatible compiler Some users set 'QMAKE_CXX = @echo $< && $$QMAKE_CXX' to prettify the compiler output. Another useful case for "incompatible" compiler is ccache, or other compiler wrappers. To eliminate warnings for these cases, pick the last value of QMAKE_CC/ QMAKE_CXX, excluding flags, and compare it against the configured toolchain. Change-Id: Idc3b9377e6f7c39c09c50f36ec89460756510b97 Reviewed-by: Oswald Buddenhagen Reviewed-by: Tobias Hunger --- src/plugins/qmakeprojectmanager/qmakeproject.cpp | 15 ++++++++++++--- 1 file changed, 12 insertions(+), 3 deletions(-) diff --git a/src/plugins/qmakeprojectmanager/qmakeproject.cpp b/src/plugins/qmakeprojectmanager/qmakeproject.cpp index 8be3ff5c5a9..7f281b81dde 100644 --- a/src/plugins/qmakeprojectmanager/qmakeproject.cpp +++ b/src/plugins/qmakeprojectmanager/qmakeproject.cpp @@ -1532,8 +1532,17 @@ bool QmakeProject::matchesKit(const Kit *kit) return false; } -static Utils::FileName getFullPathOf(const QString &exe, const BuildConfiguration *bc) +static Utils::FileName getFullPathOf(const QmakeProFileNode *pro, QmakeVariable variable, + const BuildConfiguration *bc) { + // Take last non-flag value, to cover e.g. '@echo $< && $$QMAKE_CC' or 'ccache gcc' + const QStringList values = Utils::filtered(pro->variableValue(variable), + [](const QString &value) { + return !value.startsWith('-'); + }); + if (values.isEmpty()) + return Utils::FileName(); + const QString exe = values.last(); QTC_ASSERT(bc, return Utils::FileName::fromString(exe)); QFileInfo fi(exe); if (fi.isAbsolute()) @@ -1572,9 +1581,9 @@ void QmakeProject::warnOnToolChainMismatch(const QmakeProFileNode *pro) const return; testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::C), - getFullPathOf(pro->singleVariableValue(QmakeCc), bc)); + getFullPathOf(pro, QmakeCc, bc)); testToolChain(ToolChainKitInformation::toolChain(t->kit(), ToolChain::Language::Cxx), - getFullPathOf(pro->singleVariableValue(QmakeCxx), bc)); + getFullPathOf(pro, QmakeCxx, bc)); } QString QmakeProject::executableFor(const QmakeProFileNode *node) From 1e8c0c3632e06657ef523836560b81e82bc5c01f Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Wed, 21 Dec 2016 10:13:38 +0100 Subject: [PATCH 11/33] iOS: Find Xcode version To enable/disable the version specific features Change-Id: Ia4cbe83f0aae366f517d8b46f322d8202dbbe3c8 Reviewed-by: Eike Ziller Reviewed-by: Jake Petroules --- src/plugins/ios/iosconfigurations.cpp | 38 +++++++++++++++++++++++++++ src/plugins/ios/iosconfigurations.h | 3 +++ 2 files changed, 41 insertions(+) diff --git a/src/plugins/ios/iosconfigurations.cpp b/src/plugins/ios/iosconfigurations.cpp index 0a8f45f2db5..864a46a212c 100644 --- a/src/plugins/ios/iosconfigurations.cpp +++ b/src/plugins/ios/iosconfigurations.cpp @@ -33,6 +33,7 @@ #include #include #include +#include #include #include #include @@ -48,6 +49,7 @@ #include #include +#include #include #include #include @@ -62,6 +64,7 @@ using namespace Debugger; namespace { Q_LOGGING_CATEGORY(kitSetupLog, "qtc.ios.kitSetup") +Q_LOGGING_CATEGORY(iosCommonLog, "qtc.ios.common") } using ToolChainPair = std::pair; @@ -207,6 +210,33 @@ static void setupKit(Kit *kit, Core::Id pDeviceType, const ToolChainPair& toolCh SysRootKitInformation::setSysRoot(kit, sdkPath); } +static QVersionNumber findXcodeVersion() +{ + Utils::SynchronousProcess pkgUtilProcess; + Utils::SynchronousProcessResponse resp = + pkgUtilProcess.runBlocking("pkgutil", QStringList("--pkg-info-plist=com.apple.pkg.Xcode")); + if (resp.result == Utils::SynchronousProcessResponse::Finished) { + QDomDocument xcodeVersionDoc; + if (xcodeVersionDoc.setContent(resp.allRawOutput())) { + QDomNodeList nodes = xcodeVersionDoc.elementsByTagName(QStringLiteral("key")); + for (int i = 0; i < nodes.count(); ++i) { + QDomElement elem = nodes.at(i).toElement(); + if (elem.text().compare(QStringLiteral("pkg-version")) == 0) { + QString versionStr = elem.nextSiblingElement().text(); + return QVersionNumber::fromString(versionStr); + } + } + } else { + qCDebug(iosCommonLog) << "Error finding Xcode version. Cannot parse xml output from pkgutil."; + } + } else { + qCDebug(iosCommonLog) << "Error finding Xcode version. pkgutil command failed."; + } + + qCDebug(iosCommonLog) << "Error finding Xcode version. Unknow error."; + return QVersionNumber(); +} + void IosConfigurations::updateAutomaticKitList() { const QList platforms = handledPlatforms(); @@ -312,6 +342,11 @@ FileName IosConfigurations::developerPath() return m_instance->m_developerPath; } +QVersionNumber IosConfigurations::xcodeVersion() +{ + return m_instance->m_xcodeVersion; +} + void IosConfigurations::save() { QSettings *settings = Core::ICore::settings(); @@ -358,6 +393,9 @@ void IosConfigurations::setDeveloperPath(const FileName &devPath) QTimer::singleShot(1000, IosDeviceManager::instance(), &IosDeviceManager::monitorAvailableDevices); m_instance->updateSimulators(); + + // Find xcode version. + m_instance->m_xcodeVersion = findXcodeVersion(); } } } diff --git a/src/plugins/ios/iosconfigurations.h b/src/plugins/ios/iosconfigurations.h index 9bcc5f1bc35..58bab02654e 100644 --- a/src/plugins/ios/iosconfigurations.h +++ b/src/plugins/ios/iosconfigurations.h @@ -32,6 +32,7 @@ #include #include #include +#include QT_BEGIN_NAMESPACE class QSettings; @@ -60,6 +61,7 @@ public: static bool ignoreAllDevices(); static void setIgnoreAllDevices(bool ignoreDevices); static Utils::FileName developerPath(); + static QVersionNumber xcodeVersion(); static Utils::FileName lldbPath(); static void updateAutomaticKitList(); @@ -71,6 +73,7 @@ private: static void setDeveloperPath(const Utils::FileName &devPath); Utils::FileName m_developerPath; + QVersionNumber m_xcodeVersion; bool m_ignoreAllDevices; }; From ec6587ceb606f28a2101cd3154aa86f2397a43a2 Mon Sep 17 00:00:00 2001 From: Konstantin Podsvirov Date: Fri, 23 Dec 2016 13:25:24 +0300 Subject: [PATCH 12/33] CMake: Allow CodeBlocks for NMake Makefiles JOM Change-Id: I280deb2131959cc538c4af4b7e9b9e07b4f41b80 Reviewed-by: Tobias Hunger Reviewed-by: Eike Ziller Reviewed-by: Konstantin Podsvirov --- src/plugins/cmakeprojectmanager/cmakekitinformation.cpp | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp index 94047a9c7b6..e290df726dd 100644 --- a/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp +++ b/src/plugins/cmakeprojectmanager/cmakekitinformation.cpp @@ -320,7 +320,8 @@ QVariant CMakeGeneratorKitInformation::defaultValue(const Kit *k) const } else { it = std::find_if(known.constBegin(), known.constEnd(), [extraGenerator](const CMakeTool::Generator &g) { - return g.matches("NMake Makefiles", extraGenerator); + return g.matches("NMake Makefiles", extraGenerator) + || g.matches("NMake Makefiles JOM", extraGenerator); }); } } else { From ae0ea76f077882d5b8f972edb8d89a0efadc64a6 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Mon, 2 Jan 2017 18:24:42 +0100 Subject: [PATCH 13/33] Squish: Fix timing issue in tst_HELP06 Change-Id: Ic88207d86cf3f926fc4df681be4cfaa1a62ba763 Reviewed-by: Christian Stenger --- tests/system/suite_HELP/tst_HELP06/test.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system/suite_HELP/tst_HELP06/test.py b/tests/system/suite_HELP/tst_HELP06/test.py index 5131dbbc0af..d91f3f10d9e 100755 --- a/tests/system/suite_HELP/tst_HELP06/test.py +++ b/tests/system/suite_HELP/tst_HELP06/test.py @@ -56,6 +56,8 @@ def main(): doubleClick(manualQModelIndex, 5, 5, 0, Qt.LeftButton) mouseClick(waitForObject(getQModelIndexStr("text='Building and Running an Example'", manualQModelIndex)), 5, 5, 0, Qt.LeftButton) + helpSelector = waitForObject(":Qt Creator_HelpSelector_QComboBox") + waitFor("str(helpSelector.currentText).startswith('Building and Running an Example')", 10000) # open bookmarks window clickButton(waitForObject(":Qt Creator.Add Bookmark_QToolButton")) clickButton(waitForObject(":Add Bookmark.ExpandBookmarksList_QToolButton")) From 2a6c315fbb6f0efd1a8a83a4dd44b3da952d8a1a Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 21 Dec 2016 17:38:35 +0100 Subject: [PATCH 14/33] Squish: Workaround unexpected error message Task-number: QTCREATORBUG-17492 Change-Id: Icda68a756b3420baa494e90c41dbefc656ae6327 Reviewed-by: Christian Stenger --- tests/system/shared/debugger.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/tests/system/shared/debugger.py b/tests/system/shared/debugger.py index 49a83b1ca27..13f22f4a22b 100644 --- a/tests/system/shared/debugger.py +++ b/tests/system/shared/debugger.py @@ -128,6 +128,8 @@ def doSimpleDebugging(kitCount, currentKit, currentConfigName, pressContinueCoun expectedLabelTexts = ['Stopped\.', 'Stopped at breakpoint \d+ \(\d+\) in thread \d+\.'] if len(expectedBPOrder) == 0: expectedLabelTexts.append("Running\.") + if JIRA.isBugStillOpen(17492): + expectedLabelTexts.append("QML Debugger: Error: Unknown socket error 0") switchViewTo(ViewConstants.PROJECTS) switchToBuildOrRunSettingsFor(kitCount, currentKit, ProjectSettings.RUN) ensureChecked(waitForObject("{container=':Qt Creator.scrollArea_QScrollArea' text='Enable QML' " From 7746c31774ba58c3a99f84669ec7bc8aedfdbb61 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Wed, 21 Dec 2016 15:49:01 +0100 Subject: [PATCH 15/33] Squish: Use different function name in tst_CSUP01 realloc is not being listed by Clang Code Model Task-number: QTCREATORBUG-17490 Change-Id: I006fee04579706fbf5edf8b890bd7be8e090d01f Reviewed-by: Christian Stenger --- tests/system/suite_CSUP/tst_CSUP01/test.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/tests/system/suite_CSUP/tst_CSUP01/test.py b/tests/system/suite_CSUP/tst_CSUP01/test.py index 624a68fd124..de19428f721 100644 --- a/tests/system/suite_CSUP/tst_CSUP01/test.py +++ b/tests/system/suite_CSUP/tst_CSUP01/test.py @@ -66,9 +66,9 @@ def main(): type(editorWidget, "") type(editorWidget, "re") triggerCompletion(editorWidget) - waitForObjectItem(":popupFrame_Proposal_QListView", "realloc") - doubleClickItem(":popupFrame_Proposal_QListView", "realloc", 5, 5, 0, Qt.LeftButton) - test.compare(str(lineUnderCursor(editorWidget)).strip(), "realloc()", + waitForObjectItem(":popupFrame_Proposal_QListView", "realpath") + doubleClickItem(":popupFrame_Proposal_QListView", "realpath", 5, 5, 0, Qt.LeftButton) + test.compare(str(lineUnderCursor(editorWidget)).strip(), "realpath()", "Step 3: Verifying if: The list of suggestions is opened. It is " "possible to select one of the suggestions.") # Step 4: Insert text "voi" to new line and press Tab. From 86af16725d62719168ede5ef79aa964c107d6539 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Tue, 27 Dec 2016 10:54:15 +0200 Subject: [PATCH 16/33] Revert "SDKtool: Warn if file is not found" It is not an error. SDKTool can be used to create new files. This reverts commit 274d3a8c79f369af201e475fdaa4bb157c04c512. Change-Id: I4af46b4deb5fe356a9c1050cc9557d43f3a91a6e Reviewed-by: Tobias Hunger --- src/tools/sdktool/operation.cpp | 2 -- 1 file changed, 2 deletions(-) diff --git a/src/tools/sdktool/operation.cpp b/src/tools/sdktool/operation.cpp index 9a62a5945ce..8a21983db02 100644 --- a/src/tools/sdktool/operation.cpp +++ b/src/tools/sdktool/operation.cpp @@ -102,8 +102,6 @@ QVariantMap Operation::load(const QString &file) if (!reader.load(path)) return QVariantMap(); map = reader.restoreValues(); - } else { - std::cerr << "File " << qPrintable(path.toUserOutput()) << " not found." << std::endl; } return map; From be4d1093b468b71638dd3aeaf2149c4bfe8b9842 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 4 Jan 2017 17:14:48 +0100 Subject: [PATCH 17/33] ProjectExplorer: Do not crash when setting custom executable Do not crash when setting custom executable without ever visiting the runconfiguration before. At that point the chooser is still a nullptr. Task-number: QTCREATORBUG-17505 Change-Id: I27fb19845adf9c7ec0ad5a9435c8d86a573a2532 Reviewed-by: Eike Ziller --- src/plugins/projectexplorer/runconfigurationaspects.cpp | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/plugins/projectexplorer/runconfigurationaspects.cpp b/src/plugins/projectexplorer/runconfigurationaspects.cpp index 4ba7eb35bd7..270e600c1d8 100644 --- a/src/plugins/projectexplorer/runconfigurationaspects.cpp +++ b/src/plugins/projectexplorer/runconfigurationaspects.cpp @@ -258,7 +258,7 @@ PathChooser *WorkingDirectoryAspect::pathChooser() const */ ArgumentsAspect::ArgumentsAspect(RunConfiguration *runConfig, const QString &key, const QString &arguments) - : IRunConfigurationAspect(runConfig), m_arguments(arguments), m_chooser(0), m_key(key) + : IRunConfigurationAspect(runConfig), m_arguments(arguments), m_key(key) { setDisplayName(tr("Arguments")); setId("ArgumentsAspect"); @@ -280,7 +280,7 @@ void ArgumentsAspect::setArguments(const QString &arguments) m_arguments = arguments; emit argumentsChanged(arguments); } - if (m_chooser->text() != arguments) + if (m_chooser && m_chooser->text() != arguments) m_chooser->setText(arguments); } From 9ceb1b504a20bff102000f1b0dac23767dd76272 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Wed, 4 Jan 2017 13:01:37 +0100 Subject: [PATCH 18/33] MSVC toolchain: Add common mkspec added in Qt 5.8.1 Prepend "win32-msvc" to the result list. Projects based on Qt 5.8.1 will then no longer be misconfigured with ARM toolchains. Change-Id: I734ee530e4fe2c5253f946568c2ab973e51d3cae Reviewed-by: Tobias Hunger --- src/plugins/projectexplorer/msvctoolchain.cpp | 30 +++++++++++-------- 1 file changed, 18 insertions(+), 12 deletions(-) diff --git a/src/plugins/projectexplorer/msvctoolchain.cpp b/src/plugins/projectexplorer/msvctoolchain.cpp index a2a9c64d5c6..6798f25e4f4 100644 --- a/src/plugins/projectexplorer/msvctoolchain.cpp +++ b/src/plugins/projectexplorer/msvctoolchain.cpp @@ -442,20 +442,24 @@ QString MsvcToolChain::typeDisplayName() const Utils::FileNameList MsvcToolChain::suggestedMkspecList() const { + Utils::FileNameList result; + result << Utils::FileName::fromLatin1("win32-msvc"); // Common MSVC mkspec introduced in 5.8.1 switch (m_abi.osFlavor()) { case Abi::WindowsMsvc2005Flavor: - return Utils::FileNameList() << Utils::FileName::fromLatin1("win32-msvc2005"); + result << Utils::FileName::fromLatin1("win32-msvc2005"); + break; case Abi::WindowsMsvc2008Flavor: - return Utils::FileNameList() << Utils::FileName::fromLatin1("win32-msvc2008"); + result << Utils::FileName::fromLatin1("win32-msvc2008"); + break; case Abi::WindowsMsvc2010Flavor: - return Utils::FileNameList() << Utils::FileName::fromLatin1("win32-msvc2010"); + result << Utils::FileName::fromLatin1("win32-msvc2010"); + break; case Abi::WindowsMsvc2012Flavor: - return Utils::FileNameList() - << Utils::FileName::fromLatin1("win32-msvc2012") + result << Utils::FileName::fromLatin1("win32-msvc2012") << Utils::FileName::fromLatin1("win32-msvc2010"); + break; case Abi::WindowsMsvc2013Flavor: - return Utils::FileNameList() - << Utils::FileName::fromLatin1("win32-msvc2013") + result << Utils::FileName::fromLatin1("win32-msvc2013") << Utils::FileName::fromLatin1("winphone-arm-msvc2013") << Utils::FileName::fromLatin1("winphone-x86-msvc2013") << Utils::FileName::fromLatin1("winrt-arm-msvc2013") @@ -463,21 +467,23 @@ Utils::FileNameList MsvcToolChain::suggestedMkspecList() const << Utils::FileName::fromLatin1("winrt-x64-msvc2013") << Utils::FileName::fromLatin1("win32-msvc2012") << Utils::FileName::fromLatin1("win32-msvc2010"); + break; case Abi::WindowsMsvc2015Flavor: - return Utils::FileNameList() - << Utils::FileName::fromLatin1("win32-msvc2015") + result << Utils::FileName::fromLatin1("win32-msvc2015") << Utils::FileName::fromLatin1("winphone-arm-msvc2015") << Utils::FileName::fromLatin1("winphone-x86-msvc2015") << Utils::FileName::fromLatin1("winrt-arm-msvc2015") << Utils::FileName::fromLatin1("winrt-x86-msvc2015") << Utils::FileName::fromLatin1("winrt-x64-msvc2015"); + break; case Abi::WindowsMsvc2017Flavor: - return Utils::FileNameList() - << Utils::FileName::fromLatin1("win32-msvc2017"); + result << Utils::FileName::fromLatin1("win32-msvc2017"); + break; default: + result.clear(); break; } - return Utils::FileNameList(); + return result; } QVariantMap MsvcToolChain::toMap() const From c4afe5d79b3d3ac6c583c5c8efa6e4823a3285ec Mon Sep 17 00:00:00 2001 From: BogDan Vatra Date: Wed, 4 Jan 2017 11:37:14 +0200 Subject: [PATCH 19/33] Android: Fix keytool result handling keytool return code != 0 if the password is incorrect. Task-number: QTCREATORBUG-17317 Change-Id: I248b4a687ef48a849d42a70940009738d29a609c Reviewed-by: Eike Ziller Reviewed-by: Vikas Pachdha Reviewed-by: Tobias Hunger --- src/plugins/android/androidbuildapkstep.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/android/androidbuildapkstep.cpp b/src/plugins/android/androidbuildapkstep.cpp index f72f707bf3a..3ec8dca238e 100644 --- a/src/plugins/android/androidbuildapkstep.cpp +++ b/src/plugins/android/androidbuildapkstep.cpp @@ -305,7 +305,7 @@ QAbstractItemModel *AndroidBuildApkStep::keystoreCertificates() keytoolProc.setTimeoutS(30); const Utils::SynchronousProcessResponse response = keytoolProc.run(AndroidConfigurations::currentConfig().keytoolPath().toString(), params); - if (response.result != Utils::SynchronousProcessResponse::Finished) { + if (response.result > Utils::SynchronousProcessResponse::FinishedError) { QMessageBox::critical(0, tr("Error"), tr("Failed to run keytool.")); return nullptr; From 9d328ef1a9743845421c8f47e523221f506c8f89 Mon Sep 17 00:00:00 2001 From: Christian Stenger Date: Mon, 17 Oct 2016 15:16:05 +0200 Subject: [PATCH 20/33] Squish: Fix adding new kit Projects view has changed and so has functionality of adding a new kit. Change-Id: I44377822b8b850fd17be24e12f7e5d0104be568d Reviewed-by: Robert Loehning --- tests/system/objects.map | 1 - tests/system/shared/project_explorer.py | 31 +++++++++++++++++++ .../suite_general/tst_opencreator_qbs/test.py | 11 +++---- .../tst_qtquick_creation3/test.py | 29 +++++++++-------- 4 files changed, 51 insertions(+), 21 deletions(-) diff --git a/tests/system/objects.map b/tests/system/objects.map index 7288a0e400e..3282b16d2da 100644 --- a/tests/system/objects.map +++ b/tests/system/objects.map @@ -1,4 +1,3 @@ -:*Qt Creator.Add Kit_QPushButton {text='Add Kit' type='QPushButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Build Project_Core::Internal::FancyToolButton {text?='Build Project*' type='Core::Internal::FancyToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Cancel Build_QToolButton {text='Cancel Build' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} :*Qt Creator.Clear_QToolButton {text='Clear' type='QToolButton' unnamed='1' visible='1' window=':Qt Creator_Core::Internal::MainWindow'} diff --git a/tests/system/shared/project_explorer.py b/tests/system/shared/project_explorer.py index 8ab8f012313..2396bbc80f1 100644 --- a/tests/system/shared/project_explorer.py +++ b/tests/system/shared/project_explorer.py @@ -293,3 +293,34 @@ def invokeContextMenuOnProject(projectName, menuItem): else: activateItem(waitForObjectItem("{name='Project.Menu.Project' type='QMenu' visible='1'}", menuItem)) return projItem + +def addAndActivateKit(kit): + clickToActivate = "

Click to activate:

" + bAndRIndex = getQModelIndexStr("text='Build & Run'", ":Projects.ProjectNavigationTreeView") + kitString = Targets.getStringForTarget(kit) + switchViewTo(ViewConstants.PROJECTS) + try: + treeView = waitForObject(":Projects.ProjectNavigationTreeView") + wanted = getQModelIndexStr("text='%s'" % kitString, bAndRIndex) + index = findObject(wanted) + if str(index.toolTip).startswith(clickToActivate): + mouseClick(index) + test.verify(waitFor("not str(index.toolTip).startswith(clickToActivate)", 1500), + "Kit added for this project") + try: + findObject(":Projects.ProjectNavigationTreeView") + except: + test.warning("Squish issue - QC switches automatically to Edit view after enabling " + "a new kit when running tst_opencreator_qbs - works as expected when " + "running without Squish") + switchViewTo(ViewConstants.PROJECTS) + else: + test.warning("Kit is already added for this project.") + mouseClick(index) + test.verify(waitFor("index.font.bold == True", 1500), + "Verifying whether kit is current active") + except: + return False + finally: + switchViewTo(ViewConstants.EDIT) + return True diff --git a/tests/system/suite_general/tst_opencreator_qbs/test.py b/tests/system/suite_general/tst_opencreator_qbs/test.py index eeec6ff45ad..51b6b36185e 100644 --- a/tests/system/suite_general/tst_opencreator_qbs/test.py +++ b/tests/system/suite_general/tst_opencreator_qbs/test.py @@ -37,13 +37,10 @@ def main(): if not startedWithoutPluginError(): return openQbsProject(pathCreator) - switchViewTo(ViewConstants.PROJECTS) - clickButton(waitForObject(":*Qt Creator.Add Kit_QPushButton")) - menuItem = Targets.getStringForTarget(Targets.DESKTOP_541_GCC) - activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", menuItem)) - switchToBuildOrRunSettingsFor(2, 1, ProjectSettings.BUILD) - switchViewTo(ViewConstants.EDIT) + if not addAndActivateKit(Targets.DESKTOP_541_GCC): + test.fatal("Failed to activate '%s'" % Targets.getStringForTarget(Targets.DESKTOP_541_GCC)) + invokeMenuItem("File", "Exit") + return test.log("Start parsing project") rootNodeTemplate = "{column='0' container=':Qt Creator_Utils::NavigationTreeView' text~='%s( \[\S+\])?' type='QModelIndex'}" ntwObject = waitForObject(rootNodeTemplate % "qtcreator.qbs") diff --git a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py index 44846f4fdf2..a19be52c588 100644 --- a/tests/system/suite_qtquick/tst_qtquick_creation3/test.py +++ b/tests/system/suite_qtquick/tst_qtquick_creation3/test.py @@ -37,23 +37,26 @@ def main(): # using a temporary directory won't mess up a potentially existing workingDir = tempDir() projectName = createNewQtQuickUI(workingDir, qtVersion, controls) - switchViewTo(ViewConstants.PROJECTS) - clickButton(waitForObject(":*Qt Creator.Add Kit_QPushButton")) if qtVersion == "5.6": - menuItem = Targets.getStringForTarget(Targets.DESKTOP_561_DEFAULT) - quick = "2.6" - else: - menuItem = Targets.getStringForTarget(Targets.DESKTOP_541_GCC) - quick = "2.4" - if platform.system() == 'Darwin': - waitFor("macHackActivateContextMenuItem(menuItem)", 5000) - else: - activateItem(waitForObjectItem("{type='QMenu' unnamed='1' visible='1' " - "window=':Qt Creator_Core::Internal::MainWindow'}", menuItem)) + kit = Targets.getStringForTarget(Targets.DESKTOP_561_DEFAULT) + if addAndActivateKit(Targets.DESKTOP_561_DEFAULT): + quick = "2.6" + else: + test.fatal("Failed to activate kit %s" % kit) + continue + else: # qtVersion == '5.4' + if platform.system() == 'Darwin': + continue + kit = Targets.getStringForTarget(Targets.DESKTOP_541_GCC) + if addAndActivateKit(Targets.DESKTOP_541_GCC): + quick = "2.4" + else: + test.fatal("Failed to activate kit %s" % kit) + continue additionalText = '' if controls: additionalText = ' Controls ' - test.log("Running project Qt Quick%sUI (%s)" % (additionalText, menuItem)) + test.log("Running project Qt Quick%sUI (%s)" % (additionalText, kit)) qmlViewer = modifyRunSettingsForHookIntoQtQuickUI(2, 1, workingDir, projectName, 11223, quick) if qmlViewer!=None: qmlViewerPath = os.path.dirname(qmlViewer) From ca0a8a6cf76ba292cfcaf8e70e6534f27e2e92c4 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Thu, 5 Jan 2017 12:44:14 +0100 Subject: [PATCH 21/33] Qmake: Initialize ExtraRunConfigurationAspects after initial parsing Task-number: QTCREATORBUG-17462 Task-number: QTCREATORBUG-17477 Change-Id: Ie74455362d7e7ddc0cbd9296a3e2438e7195b00b Reviewed-by: Eike Ziller Reviewed-by: hjk --- .../qmakeprojectmanager/desktopqmakerunconfiguration.cpp | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp index 3c6e6bd828b..faf7bba9618 100644 --- a/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp +++ b/src/plugins/qmakeprojectmanager/desktopqmakerunconfiguration.cpp @@ -136,6 +136,12 @@ void DesktopQmakeRunConfiguration::proFileUpdated(QmakeProFileNode *pro, bool su emit effectiveTargetInformationChanged(); setDefaultDisplayName(defaultDisplayName()); extraAspect()->buildEnvironmentHasChanged(); + + extraAspect() + ->setDefaultWorkingDirectory(FileName::fromString(baseWorkingDirectory())); + auto terminalAspect = extraAspect(); + if (!terminalAspect->isUserSet()) + terminalAspect->setUseTerminal(isConsoleApplication()); } } From 611a970819793cda07c6deeb213167110a956f04 Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Thu, 5 Jan 2017 18:01:57 +0100 Subject: [PATCH 22/33] Squish: Configure C-toolchains for Windows Task-number: QTCREATORBUG-17406 Change-Id: Iafa1b38f75fa56691e646aaf2fad61504f0706e8 Reviewed-by: Christian Stenger --- .../windows/QtProject/qtcreator/profiles.xml | 26 ++++++++++++- .../QtProject/qtcreator/toolchains.xml | 38 ++++++++++++++++++- 2 files changed, 61 insertions(+), 3 deletions(-) diff --git a/tests/system/settings/windows/QtProject/qtcreator/profiles.xml b/tests/system/settings/windows/QtProject/qtcreator/profiles.xml index ace7dc61990..ee44082aa55 100644 --- a/tests/system/settings/windows/QtProject/qtcreator/profiles.xml +++ b/tests/system/settings/windows/QtProject/qtcreator/profiles.xml @@ -1,6 +1,6 @@ - + Profile.0 @@ -15,6 +15,10 @@ ProjectExplorer.ToolChain.Mingw:{2729dd3e-84f5-42e1-aed1-6a27163346ce} + + {41d0a157-7cf1-4c83-bab8-d77b3f136b85} + ProjectExplorer.ToolChain.Mingw:{2729dd3e-84f5-42e1-aed1-6a27163346ce} + 8 @@ -39,6 +43,10 @@ ProjectExplorer.ToolChain.Mingw:{2729dd3e-84f5-42e1-aed1-6a27163346ce} + + {41d0a157-7cf1-4c83-bab8-d77b3f136b85} + ProjectExplorer.ToolChain.Mingw:{2729dd3e-84f5-42e1-aed1-6a27163346ce} + 9 @@ -105,6 +113,10 @@ ProjectExplorer.ToolChain.Msvc:{1186dad9-c485-4f69-b7e1-aff54c89ecb2} + + {88921fca-56c4-4ea8-9681-ee0fa5085814} + ProjectExplorer.ToolChain.Msvc:{1186dad9-c485-4f69-b7e1-aff54c89ecb2} + 2 @@ -129,6 +141,10 @@ ProjectExplorer.ToolChain.Msvc:{1186dad9-c485-4f69-b7e1-aff54c89ecb2} + + {88921fca-56c4-4ea8-9681-ee0fa5085814} + ProjectExplorer.ToolChain.Msvc:{1186dad9-c485-4f69-b7e1-aff54c89ecb2} + 20 @@ -153,6 +169,10 @@ ProjectExplorer.ToolChain.Mingw:{44d54392-22ee-4eac-a9f1-2d882ba8a7bb} + + {777132b1-5d59-4adf-ab0d-3a6df2a0a0fb} + ProjectExplorer.ToolChain.Mingw:{44d54392-22ee-4eac-a9f1-2d882ba8a7bb} + 22 @@ -177,6 +197,10 @@ {7ca0887f-a9a5-4251-aba6-560a15595d20} + + {3cdb6753-cdee-4bb7-8fb3-2e7a60e279e3} + {7ca0887f-a9a5-4251-aba6-560a15595d20} + 24 diff --git a/tests/system/settings/windows/QtProject/qtcreator/toolchains.xml b/tests/system/settings/windows/QtProject/qtcreator/toolchains.xml index 027bed7ed15..70616db5c79 100644 --- a/tests/system/settings/windows/QtProject/qtcreator/toolchains.xml +++ b/tests/system/settings/windows/QtProject/qtcreator/toolchains.xml @@ -1,6 +1,6 @@ - + ToolChain.0 @@ -71,6 +71,40 @@ ToolChain.5 + + mingw32 + C:/QtSDK/mingw/bin/gcc.exe + + + + x86-windows-msys-pe-32bit + + x86-windows-msys-pe-32bit + false + MinGW 4.4 + ProjectExplorer.ToolChain.Mingw:{41d0a157-7cf1-4c83-bab8-d77b3f136b85} + 1 + + + + ToolChain.6 + + i686-w64-mingw32 + C:/Qt/Qt5.4.1/Tools/mingw491_32/bin/gcc.exe + + + + x86-windows-msys-pe-32bit + + x86-windows-msys-pe-32bit + false + MinGW 4.9 + ProjectExplorer.ToolChain.Mingw:{777132b1-5d59-4adf-ab0d-3a6df2a0a0fb} + 1 + + + + ToolChain.7 x86-windows-msvc2013-pe-32bit C:/Program Files (x86)/Microsoft Visual Studio 12.0/VC/vcvarsall.bat @@ -82,7 +116,7 @@ ToolChain.Count - 6 + 8 Version From 353d6b25137da40dfff77d2e3e12c65c8b4cd6fe Mon Sep 17 00:00:00 2001 From: Christian Kandeler Date: Fri, 6 Jan 2017 10:59:44 +0100 Subject: [PATCH 23/33] Update qbs submodule To HEAD of 1.7 branch. Change-Id: I8233e58ce52f62b2dcdd89fa5eea3792318ac0f4 Reviewed-by: Joerg Bornemann --- src/shared/qbs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/shared/qbs b/src/shared/qbs index 415b873ea3d..a64a0ef5fc4 160000 --- a/src/shared/qbs +++ b/src/shared/qbs @@ -1 +1 @@ -Subproject commit 415b873ea3d930f7853f9cf25f6c403e85e07101 +Subproject commit a64a0ef5fc454b18a9474b39517a100d8f1fdf3c From 4d79ffb8f348c988f8df80174406f366d8b288ad Mon Sep 17 00:00:00 2001 From: Robert Loehning Date: Fri, 6 Jan 2017 15:57:42 +0100 Subject: [PATCH 24/33] Squish: Replace progressBarWait() in tst_debug_empty_main The progress bar already disappears while we're still in Projects mode. Change-Id: I7dcf24d1d423eba3057868c4323b2054c99d19f1 Reviewed-by: Christian Stenger --- tests/system/suite_debugger/tst_debug_empty_main/test.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/system/suite_debugger/tst_debug_empty_main/test.py b/tests/system/suite_debugger/tst_debug_empty_main/test.py index f371b5ec22d..39b9ed30188 100644 --- a/tests/system/suite_debugger/tst_debug_empty_main/test.py +++ b/tests/system/suite_debugger/tst_debug_empty_main/test.py @@ -93,7 +93,7 @@ def performDebugging(projectName, checkedTargets): for kit, config in iterateBuildConfigs(len(checkedTargets), "Debug"): test.log("Selecting '%s' as build config" % config) verifyBuildConfig(len(checkedTargets), kit, config, True, True) - progressBarWait(10000) + waitForObject(":*Qt Creator.Build Project_Core::Internal::FancyToolButton") invokeMenuItem("Build", "Rebuild All") waitForCompile() isMsvc = isMsvcConfig(len(checkedTargets), kit) From 07352531395a16b18f564cbe07084d9c26d9e321 Mon Sep 17 00:00:00 2001 From: Anthony Heading Date: Sat, 31 Dec 2016 20:34:38 -0500 Subject: [PATCH 25/33] Fix off-by-one error which stops qtchooser finding qmake At startup, qtcreator prints an error: % qtcreator "The command \"/qmake\" could not be started." This appears to be because of an off-by-one error in BuildableHelperLibrary::qtChooserToQmakePath(const QString &path) which parses the output of a call to "qtchooser -print-env" to extract the value of the QTTOOLDIR variable. The code attempts to move past the prefix string to find the end quote, but by moving one too few characters it finds the starting quote instead, resulting in a zero length string result. Change-Id: I74368f10a81eda2286ae735bdc595c0f92e4e665 Reviewed-by: Tobias Hunger Reviewed-by: Eike Ziller --- src/libs/utils/buildablehelperlibrary.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/libs/utils/buildablehelperlibrary.cpp b/src/libs/utils/buildablehelperlibrary.cpp index 6e56ef97887..c46b4b85020 100644 --- a/src/libs/utils/buildablehelperlibrary.cpp +++ b/src/libs/utils/buildablehelperlibrary.cpp @@ -50,7 +50,7 @@ QString BuildableHelperLibrary::qtChooserToQmakePath(const QString &path) int pos = output.indexOf(toolDir); if (pos == -1) return QString(); - pos += toolDir.count() - 1; + pos += toolDir.count(); int end = output.indexOf('\"', pos); if (end == -1) return QString(); From d3f725f39dc89ffb13cb3a51249c6637b178251b Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Mon, 9 Jan 2017 15:21:10 +0100 Subject: [PATCH 26/33] QtQuick Wizards: Update available Qt versions Change-Id: I0546cfd965a450a9844b42a2c5e869dbb3447063 Reviewed-by: Thomas Hartmann --- .../qmake/qtquickapplication/wizard.json | 10 ++++++++++ .../qmlproject/qtquickapplication/wizard.json | 16 ++++++++++++++++ 2 files changed, 26 insertions(+) diff --git a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json index 059c7b98ad6..9cd9010edf4 100644 --- a/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qmake/qtquickapplication/wizard.json @@ -46,6 +46,16 @@ "index": 2, "items": [ + { + "trKey": "Qt 5.8", + "value": + "{ + 'qtQuickVersion': '2.8', + 'qtQuickWindowVersion': '2.2', + 'qtQuickVirtualKeyboardImport': 'QtQuick.VirtualKeyboard 2.1', + 'qtQuickVirtualKeyboardWhenVisible': 'inputPanel.active' + }" + }, { "trKey": "Qt 5.7", "value": diff --git a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json index 559729e66f3..4eb92d54f97 100644 --- a/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json +++ b/share/qtcreator/templates/wizards/projects/qmlproject/qtquickapplication/wizard.json @@ -42,6 +42,22 @@ { "items": [ + { + "trKey": "Qt 5.8", + "value": + "{ + 'qtQuickVersion': '2.8', + 'qtQuickWindowVersion': '2.2' + }" + }, + { + "trKey": "Qt 5.7", + "value": + "{ + 'qtQuickVersion': '2.7', + 'qtQuickWindowVersion': '2.2' + }" + }, { "trKey": "Qt 5.6", "value": From fe0a091802ee8840fc8026befe19b27f91eef1e8 Mon Sep 17 00:00:00 2001 From: Nikolai Kosjar Date: Fri, 6 Jan 2017 16:50:37 +0100 Subject: [PATCH 27/33] C++: Fix use-after-free crash when handling auto expressions The Control of the Document "exprDoc" in ResolveExpression::visit( SimpleNameAST*ast) owns names that are passed on further as part of the LookupItems. However, the life time of that Document and thus the Control ends in that function. Fix by using the appropriate Control object. Task-number: QTCREATORBUG-16731 Change-Id: I5a7af0a67613fff79f7e07865801585c13bb9b45 Reviewed-by: Orgad Shaneh --- src/libs/cplusplus/CppDocument.cpp | 28 ++++++++++++++++++--- src/libs/cplusplus/CppDocument.h | 1 + src/libs/cplusplus/ResolveExpression.cpp | 31 +++++++++++++++++++++--- 3 files changed, 54 insertions(+), 6 deletions(-) diff --git a/src/libs/cplusplus/CppDocument.cpp b/src/libs/cplusplus/CppDocument.cpp index 80476dd8b1e..93f3654e4fb 100644 --- a/src/libs/cplusplus/CppDocument.cpp +++ b/src/libs/cplusplus/CppDocument.cpp @@ -286,8 +286,10 @@ Document::~Document() { delete _translationUnit; _translationUnit = 0; - delete _control->diagnosticClient(); - delete _control; + if (_control) { + delete _control->diagnosticClient(); + delete _control; + } _control = 0; } @@ -296,6 +298,25 @@ Control *Document::control() const return _control; } +Control *Document::swapControl(Control *newControl) +{ + if (newControl) { + const StringLiteral *fileId = newControl->stringLiteral(_translationUnit->fileId()->chars(), + _translationUnit->fileId()->size()); + const auto newTranslationUnit = new TranslationUnit(newControl, fileId); + newTranslationUnit->setLanguageFeatures(_translationUnit->languageFeatures()); + delete _translationUnit; + _translationUnit = newTranslationUnit; + } else { + delete _translationUnit; + _translationUnit = 0; + } + + Control *oldControl = _control; + _control = newControl; + return oldControl; +} + unsigned Document::revision() const { return _revision; @@ -696,7 +717,8 @@ void Document::releaseSourceAndAST() if (!_keepSourceAndASTCount.deref()) { _source.clear(); _translationUnit->release(); - _control->squeeze(); + if (_control) + _control->squeeze(); } } diff --git a/src/libs/cplusplus/CppDocument.h b/src/libs/cplusplus/CppDocument.h index bac2fb2a472..006f17aba68 100644 --- a/src/libs/cplusplus/CppDocument.h +++ b/src/libs/cplusplus/CppDocument.h @@ -78,6 +78,7 @@ public: unsigned bytesOffset, unsigned utf16charsOffset); Control *control() const; + Control *swapControl(Control *newControl); TranslationUnit *translationUnit() const; bool skipFunctionBody() const; diff --git a/src/libs/cplusplus/ResolveExpression.cpp b/src/libs/cplusplus/ResolveExpression.cpp index 2f55c1564f2..69ce4f4cb4e 100644 --- a/src/libs/cplusplus/ResolveExpression.cpp +++ b/src/libs/cplusplus/ResolveExpression.cpp @@ -688,6 +688,31 @@ public: bool _block; }; +class ExpressionDocumentHelper +{ +public: + // Set up an expression document with an external Control + ExpressionDocumentHelper(const QByteArray &utf8code, Control *control) + : document(Document::create(QLatin1String(""))) + { + Control *oldControl = document->swapControl(control); + delete oldControl->diagnosticClient(); + delete oldControl; + document->setUtf8Source(utf8code); + document->parse(Document::ParseExpression); + document->check(); + } + + // Ensure that the external Control is not deleted + ~ExpressionDocumentHelper() + { + document->swapControl(nullptr); + } + +public: + Document::Ptr document; +}; + } // namespace anonymous bool ResolveExpression::visit(SimpleNameAST *ast) @@ -730,9 +755,9 @@ bool ResolveExpression::visit(SimpleNameAST *ast) exprTyper.init(doc, _context.snapshot(), _context.bindings(), QSet(_autoDeclarationsBeingResolved) << decl); - Document::Ptr exprDoc = - documentForExpression(exprTyper.preprocessedExpression(initializer)); - exprDoc->check(); + const ExpressionDocumentHelper exprHelper(exprTyper.preprocessedExpression(initializer), + _context.bindings()->control().data()); + const Document::Ptr exprDoc = exprHelper.document; DeduceAutoCheck deduceAuto(ast->name->identifier(), exprDoc->translationUnit()); if (deduceAuto._block) From 54677f498565d22df5ba0485cd1f05af3fb14b42 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Wed, 21 Dec 2016 18:28:42 +0100 Subject: [PATCH 28/33] iOS: Capture console output of launched app on iOS simulator Task-number: QTCREATORBUG-17483 Change-Id: Id18c51e20cf8b396fc610918610f04d39ead28b0 Reviewed-by: Eike Ziller --- src/plugins/ios/iostoolhandler.cpp | 146 ++++++++++++++++++++------- src/plugins/ios/simulatorcontrol.cpp | 18 +++- src/plugins/ios/simulatorcontrol.h | 4 +- 3 files changed, 125 insertions(+), 43 deletions(-) diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index b12df9be16c..b1c1773cfc1 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -37,16 +37,20 @@ #include "utils/synchronousprocess.h" #include +#include #include +#include #include #include #include #include #include +#include #include #include #include #include +#include #include #include @@ -61,6 +65,68 @@ namespace Internal { using namespace std::placeholders; +// As per the currrent behavior, any absolute path given to simctl --stdout --stderr where the +// directory after the root also exists on the simulator's file system will map to +// simulator's file system i.e. simctl translates $TMPDIR/somwhere/out.txt to +// your_home_dir/Library/Developer/CoreSimulator/Devices/data/$TMP_DIR/somwhere/out.txt. +// Because /var also exists on simulator's file system. +// Though the log files located at CONSOLE_PATH_TEMPLATE are deleted on +// app exit any leftovers shall be removed on simulator restart. +static QString CONSOLE_PATH_TEMPLATE = QDir::homePath() + + "/Library/Developer/CoreSimulator/Devices/%1/data/tmp/%2"; + +class LogTailFiles : public QObject +{ + Q_OBJECT +public: + + void exec(QFutureInterface &fi, std::shared_ptr stdoutFile, + std::shared_ptr stderrFile) + { + if (fi.isCanceled()) + return; + + // The future is canceled when app on simulator is stoped. + QEventLoop loop; + QFutureWatcher watcher; + connect(&watcher, &QFutureWatcher::canceled, [&](){ + loop.quit(); + }); + watcher.setFuture(fi.future()); + + // Process to print the console output while app is running. + auto logProcess = [this, fi](QProcess *tailProcess, std::shared_ptr file) { + QObject::connect(tailProcess, &QProcess::readyReadStandardOutput, [=]() { + if (!fi.isCanceled()) + emit logMessage(QString::fromLocal8Bit(tailProcess->readAll())); + }); + tailProcess->start(QStringLiteral("tail"), QStringList() << "-f" << file->fileName()); + }; + + auto processDeleter = [](QProcess *process) { + if (process->state() != QProcess::NotRunning) { + process->terminate(); + process->waitForFinished(); + } + delete process; + }; + + std::unique_ptr tailStdout(new QProcess, processDeleter); + if (stdoutFile) + logProcess(tailStdout.get(), stdoutFile); + + std::unique_ptr tailStderr(new QProcess, processDeleter); + if (stderrFile) + logProcess(tailStderr.get(), stderrFile); + + // Blocks untill tool is deleted or toolexited is called. + loop.exec(); + } + +signals: + void logMessage(QString message); +}; + struct ParserState { enum Kind { Msg, @@ -256,14 +322,9 @@ private: void launchAppOnSimulator(const QStringList &extraArgs); bool isResponseValid(const SimulatorControl::ResponseData &responseData); - void simAppProcessError(QProcess::ProcessError error); - void simAppProcessFinished(int exitCode, QProcess::ExitStatus exitStatus); - void simAppProcessHasData(); - void simAppProcessHasErrorOutput(); - private: - qint64 appPId = -1; SimulatorControl *simCtl; + LogTailFiles outputLogger; QList> futureList; }; @@ -727,6 +788,8 @@ IosSimulatorToolHandlerPrivate::IosSimulatorToolHandlerPrivate(const IosDeviceTy : IosToolHandlerPrivate(devType, q), simCtl(new SimulatorControl) { + QObject::connect(&outputLogger, &LogTailFiles::logMessage, + std::bind(&IosToolHandlerPrivate::appOutput, this, _1)); } IosSimulatorToolHandlerPrivate::~IosSimulatorToolHandlerPrivate() @@ -809,7 +872,6 @@ void IosSimulatorToolHandlerPrivate::requestDeviceInfo(const QString &deviceId, void IosSimulatorToolHandlerPrivate::stop(int errorCode) { - appPId = -1; foreach (auto f, futureList) { if (!f.isFinished()) f.cancel(); @@ -843,6 +905,31 @@ void IosSimulatorToolHandlerPrivate::installAppOnSimulator() void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &extraArgs) { + const Utils::FileName appBundle = Utils::FileName::fromString(bundlePath); + const QString bundleId = SimulatorControl::bundleIdentifier(appBundle); + const bool debugRun = runKind == IosToolHandler::DebugRun; + bool captureConsole = IosConfigurations::xcodeVersion() >= QVersionNumber(8); + std::shared_ptr stdoutFile; + std::shared_ptr stderrFile; + + if (captureConsole) { + const QString fileTemplate = CONSOLE_PATH_TEMPLATE.arg(deviceId).arg(bundleId); + stdoutFile.reset(new QTemporaryFile); + stdoutFile->setFileTemplate(fileTemplate + QStringLiteral(".stdout")); + + stderrFile.reset(new QTemporaryFile); + stderrFile->setFileTemplate(fileTemplate + QStringLiteral(".stderr")); + + captureConsole = stdoutFile->open() && stderrFile->open(); + if (!captureConsole) + errorMsg(IosToolHandler::tr("Cannot capture console output from %1. " + "Error redirecting output to %2.*") + .arg(bundleId).arg(fileTemplate)); + } else { + errorMsg(IosToolHandler::tr("Cannot capture console output from %1. " + "Install Xcode 8 or later.").arg(bundleId)); + } + auto monitorPid = [this](QFutureInterface &fi, qint64 pid) { int exitCode = 0; const QStringList args({QStringLiteral("-0"), QString::number(pid)}); @@ -858,15 +945,17 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext stop(0); }; - auto onResponseAppLaunch = [this, monitorPid](const SimulatorControl::ResponseData &response) { + auto onResponseAppLaunch = [=](const SimulatorControl::ResponseData &response) { if (!isResponseValid(response)) return; if (response.success) { - appPId = response.pID; - gotInferiorPid(bundlePath, deviceId, appPId); + gotInferiorPid(bundlePath, deviceId, response.pID); didStartApp(bundlePath, deviceId, Ios::IosToolHandler::Success); // Start monitoring app's life signs. - futureList << Utils::runAsync(monitorPid, appPId); + futureList << Utils::runAsync(monitorPid, response.pID); + if (captureConsole) + futureList << Utils::runAsync(&LogTailFiles::exec, &outputLogger, stdoutFile, + stderrFile); } else { errorMsg(IosToolHandler::tr("Application launch on Simulator failed. %1") .arg(QString::fromLocal8Bit(response.commandOutput))); @@ -875,11 +964,12 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext q->finished(q); } }; - Utils::FileName appBundle = Utils::FileName::fromString(bundlePath); - futureList << Utils::onResultReady(simCtl->launchApp(deviceId, - SimulatorControl::bundleIdentifier(appBundle), - runKind == IosToolHandler::DebugRun, - extraArgs), onResponseAppLaunch); + + futureList << Utils::onResultReady( + simCtl->launchApp(deviceId, bundleId, debugRun, extraArgs, + captureConsole ? stdoutFile->fileName() : QString(), + captureConsole ? stderrFile->fileName() : QString()), + onResponseAppLaunch); } bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::ResponseData &responseData) @@ -895,28 +985,6 @@ bool IosSimulatorToolHandlerPrivate::isResponseValid(const SimulatorControl::Res return true; } -void IosSimulatorToolHandlerPrivate::simAppProcessError(QProcess::ProcessError error) -{ - errorMsg(IosToolHandler::tr("Simulator application process error %1").arg(error)); -} - -void IosSimulatorToolHandlerPrivate::simAppProcessFinished(int exitCode, QProcess::ExitStatus exitStatus) -{ - stop((exitStatus == QProcess::NormalExit) ? exitCode : -1 ); - qCDebug(toolHandlerLog) << "IosToolHandler::finished(" << this << ")"; - q->finished(q); -} - -void IosSimulatorToolHandlerPrivate::simAppProcessHasData() -{ - appOutput(QString::fromLocal8Bit(process->readAllStandardOutput())); -} - -void IosSimulatorToolHandlerPrivate::simAppProcessHasErrorOutput() -{ - errorMsg(QString::fromLocal8Bit(process->readAllStandardError())); -} - void IosToolHandlerPrivate::killProcess() { if (isRunning()) @@ -973,3 +1041,5 @@ bool IosToolHandler::isRunning() } } // namespace Ios + +#include "iostoolhandler.moc" diff --git a/src/plugins/ios/simulatorcontrol.cpp b/src/plugins/ios/simulatorcontrol.cpp index 005ef882b59..232e3d01ceb 100644 --- a/src/plugins/ios/simulatorcontrol.cpp +++ b/src/plugins/ios/simulatorcontrol.cpp @@ -108,7 +108,8 @@ private: const Utils::FileName &bundlePath); void launchApp(QFutureInterface &fi, const QString &simUdid, const QString &bundleIdentifier, bool waitForDebugger, - const QStringList &extraArgs); + const QStringList &extraArgs, const QString &stdoutPath, + const QString &stderrPath); static QList availableDevices; friend class SimulatorControl; @@ -196,10 +197,11 @@ SimulatorControl::installApp(const QString &simUdid, const Utils::FileName &bund QFuture SimulatorControl::launchApp(const QString &simUdid, const QString &bundleIdentifier, - bool waitForDebugger, const QStringList &extraArgs) const + bool waitForDebugger, const QStringList &extraArgs, + const QString &stdoutPath, const QString &stderrPath) const { return Utils::runAsync(&SimulatorControlPrivate::launchApp, d, simUdid, bundleIdentifier, - waitForDebugger, extraArgs); + waitForDebugger, extraArgs, stdoutPath, stderrPath); } QList SimulatorControlPrivate::availableDevices; @@ -342,12 +344,20 @@ void SimulatorControlPrivate::installApp(QFutureInterface &fi, const QString &simUdid, const QString &bundleIdentifier, - bool waitForDebugger, const QStringList &extraArgs) + bool waitForDebugger, const QStringList &extraArgs, + const QString &stdoutPath, const QString &stderrPath) { SimulatorControl::ResponseData response(simUdid); if (!bundleIdentifier.isEmpty() && !fi.isCanceled()) { QStringList args({QStringLiteral("launch"), simUdid, bundleIdentifier}); + // simctl usage documentation : Note: Log output is often directed to stderr, not stdout. + if (!stdoutPath.isEmpty()) + args.insert(1, QStringLiteral("--stderr=%1").arg(stdoutPath)); + + if (!stderrPath.isEmpty()) + args.insert(1, QStringLiteral("--stdout=%1").arg(stderrPath)); + if (waitForDebugger) args.insert(1, QStringLiteral("-w")); diff --git a/src/plugins/ios/simulatorcontrol.h b/src/plugins/ios/simulatorcontrol.h index 5082a437dad..e82cc5afad1 100644 --- a/src/plugins/ios/simulatorcontrol.h +++ b/src/plugins/ios/simulatorcontrol.h @@ -69,7 +69,9 @@ public: QFuture startSimulator(const QString &simUdid) const; QFuture installApp(const QString &simUdid, const Utils::FileName &bundlePath) const; QFuture launchApp(const QString &simUdid, const QString &bundleIdentifier, - bool waitForDebugger, const QStringList &extraArgs) const; + bool waitForDebugger, const QStringList &extraArgs, + const QString& stdoutPath = QString(), + const QString& stderrPath = QString()) const; private: SimulatorControlPrivate *d; From c14a24dca131f21737b2c27a479fe3373de9aee6 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Mon, 9 Jan 2017 21:47:54 +0100 Subject: [PATCH 29/33] README.md: Fix slash in LLVM command Change-Id: I0d69148e1b246ec90365d489b11e1954d0485576 Reviewed-by: Nikolai Kosjar --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 3fc07539e33..a5a0323ef6d 100644 --- a/README.md +++ b/README.md @@ -244,7 +244,7 @@ http://llvm.org/docs/GettingStarted.html#git-mirror: For Linux/macOS: - cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= -DLLVM_ENABLE_RTTI=ON ..\llvm + cmake -DCMAKE_BUILD_TYPE=Release -DCMAKE_INSTALL_PREFIX= -DLLVM_ENABLE_RTTI=ON ../llvm make install For Windows: From 6c83981ee69f2b7fba4f3c7d3e260f257eae90f7 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Wed, 21 Dec 2016 18:37:39 +0100 Subject: [PATCH 30/33] iOS: Use kill system call instead of shell command Change-Id: Ic1d327ca2ed83ee91f78434cc1974ec247751483 Reviewed-by: Eike Ziller --- src/plugins/ios/iostoolhandler.cpp | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/src/plugins/ios/iostoolhandler.cpp b/src/plugins/ios/iostoolhandler.cpp index b1c1773cfc1..64c362de47f 100644 --- a/src/plugins/ios/iostoolhandler.cpp +++ b/src/plugins/ios/iostoolhandler.cpp @@ -54,6 +54,7 @@ #include #include +#include #include #include @@ -930,16 +931,13 @@ void IosSimulatorToolHandlerPrivate::launchAppOnSimulator(const QStringList &ext "Install Xcode 8 or later.").arg(bundleId)); } - auto monitorPid = [this](QFutureInterface &fi, qint64 pid) { - int exitCode = 0; - const QStringList args({QStringLiteral("-0"), QString::number(pid)}); - Utils::SynchronousProcess pKill; - while (!fi.isCanceled() && exitCode == 0) { + auto monitorPid = [this](QFutureInterface &fi, qint64 pid) { +#ifdef Q_OS_UNIX + do { // Poll every 1 sec to check whether the app is running. QThread::msleep(1000); - Utils::SynchronousProcessResponse resp = pKill.runBlocking(QStringLiteral("kill"), args); - exitCode = resp.exitCode; - } + } while (!fi.isCanceled() && kill(pid, 0) == 0); +#endif // Future is cancelled if the app is stopped from the qt creator. if (!fi.isCanceled()) stop(0); From 1e73c52dd59320032798e50f3734cedd662c20e6 Mon Sep 17 00:00:00 2001 From: Vikas Pachdha Date: Mon, 9 Jan 2017 12:43:00 +0100 Subject: [PATCH 31/33] Fix compile warning COMMAND_TIMEOUT is not needed and will not be emitted Change-Id: Id89aaa8c0b774a962e7a4e813a5b3d3e6a37524d Reviewed-by: Eike Ziller --- src/plugins/ios/simulatorcontrol.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/plugins/ios/simulatorcontrol.cpp b/src/plugins/ios/simulatorcontrol.cpp index 232e3d01ceb..45dce5bacc1 100644 --- a/src/plugins/ios/simulatorcontrol.cpp +++ b/src/plugins/ios/simulatorcontrol.cpp @@ -53,11 +53,10 @@ Q_LOGGING_CATEGORY(simulatorLog, "qtc.ios.simulator") namespace Ios { namespace Internal { -static int COMMAND_TIMEOUT = 10000; static int SIMULATOR_START_TIMEOUT = 60000; static QString SIM_UDID_TAG = QStringLiteral("SimUdid"); -static bool checkForTimeout(const chrono::high_resolution_clock::time_point &start, int msecs = COMMAND_TIMEOUT) +static bool checkForTimeout(const chrono::high_resolution_clock::time_point &start, int msecs = 10000) { bool timedOut = false; auto end = chrono::high_resolution_clock::now(); From 624339ea70b5e2373cad77ad34ba11c6f8ffcf96 Mon Sep 17 00:00:00 2001 From: Tobias Hunger Date: Wed, 4 Jan 2017 15:12:18 +0100 Subject: [PATCH 32/33] qmake: fix missing OTHER_FILES in project tree ... in subdirs projects which actually have any subdirs. that would happen via this mechanism in QmakeProFileNode::evaluate(): first, IncludedPriFile nodes with proFile = null are created for the subdirs. subsequently, this tree is enriched by transforming the reader's included files. that loop iterates over all already created nodes and tries to match them against included files. at nesting level one, this would now run into the nodes created for the subdirs. the code failed to skip over these nodes, and would thus create a bogus node for the .pro file (as it has the parent null in the mapping of included files). this node would not be included into the tree due to the loop prevention in QmakeProFileNode::applyEvaluate() (it obviously had the same file path as its parent), but at the same time it would catch the files meant for the root node due to defeating the fallback in QmakePriFileNode::extractSources(). Task-number: QTCREATORBUG-17473 Change-Id: Ice9f667345148be42297cc21ff0a73058f27cc38 Reviewed-by: Tobias Hunger --- src/plugins/qmakeprojectmanager/qmakenodes.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/plugins/qmakeprojectmanager/qmakenodes.cpp b/src/plugins/qmakeprojectmanager/qmakenodes.cpp index 1ac2f9f5656..8518c8ed011 100644 --- a/src/plugins/qmakeprojectmanager/qmakenodes.cpp +++ b/src/plugins/qmakeprojectmanager/qmakenodes.cpp @@ -1848,6 +1848,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) QList toBuild = { &result->includedFiles }; while (!toBuild.isEmpty()) { IncludedPriFile *current = toBuild.takeFirst(); + if (!current->proFile) + continue; // Don't attempt to map subdirs here QVector children = includeFiles.value(current->proFile); foreach (ProFile *child, children) { const Utils::FileName childName = Utils::FileName::fromString(child->fileName()); @@ -1882,6 +1884,8 @@ EvalResult *QmakeProFileNode::evaluate(const EvalInput &input) QList toBuild = { &result->includedFiles }; while (!toBuild.isEmpty()) { IncludedPriFile *current = toBuild.takeFirst(); + if (!current->proFile) + continue; // Don't attempt to map subdirs here QVector children = includeFiles.value(current->proFile); foreach (ProFile *child, children) { const Utils::FileName childName = Utils::FileName::fromString(child->fileName()); From a8230eb6c1a45489f33ffa86498e5ea3452496e1 Mon Sep 17 00:00:00 2001 From: Oswald Buddenhagen Date: Tue, 10 Jan 2017 15:44:59 +0100 Subject: [PATCH 33/33] do not report the .pro file itself in ProFileReader::includeFiles() it's pointless, as no consumer has a legitimate need for it - the project file is the root of all traversals, and is known by other means. amends 4148b05e0. Change-Id: I4df69727e37151b0ecbcd88b2f5ef6e55712172f Reviewed-by: Tobias Hunger --- src/plugins/qtsupport/profilereader.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/qtsupport/profilereader.cpp b/src/plugins/qtsupport/profilereader.cpp index 4c48f2a2046..0985a64b750 100644 --- a/src/plugins/qtsupport/profilereader.cpp +++ b/src/plugins/qtsupport/profilereader.cpp @@ -97,7 +97,7 @@ void ProFileReader::aboutToEval(ProFile *parent, ProFile *pro, EvalFileType type { if (m_ignoreLevel || (type != EvalProjectFile && type != EvalIncludeFile)) { m_ignoreLevel++; - } else { + } else if (parent) { // Skip the actual .pro file, as nobody needs that. QVector &children = m_includeFiles[parent]; if (!children.contains(pro)) { children.append(pro);