From 445c3624ff32978493e4aefa3e0b02755d491f72 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Wed, 14 Dec 2022 13:23:12 +0100 Subject: [PATCH 01/12] QMakePM: fix potential crash when accessing deleted members Fixes: QTCREATORBUG-28370 Change-Id: I1767678221afc0d1a99194bce2d987a226998da5 Reviewed-by: Alessandro Portale --- src/plugins/qmakeprojectmanager/qmakestep.cpp | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/plugins/qmakeprojectmanager/qmakestep.cpp b/src/plugins/qmakeprojectmanager/qmakestep.cpp index 0a075eb3234..fdb22b22b16 100644 --- a/src/plugins/qmakeprojectmanager/qmakestep.cpp +++ b/src/plugins/qmakeprojectmanager/qmakestep.cpp @@ -552,6 +552,11 @@ QWidget *QMakeStep::createConfigWidget() BuildManager::buildLists({bc->cleanSteps()}); }); + connect(widget, &QObject::destroyed, this, [this] { + abisLabel = nullptr; + abisListWidget = nullptr; + }); + VariableChooser::addSupportForChildWidgets(widget, macroExpander()); return widget; From 01dc87b10001141b1516fe24316a02254b6e6f40 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Dec 2022 12:35:45 +0100 Subject: [PATCH 02/12] CMake build: Add hint for installing libdw-dev for elfutils to the CMake output when elfutils is not found Change-Id: I7ecc83ddadb0ce4bd4f8f9695cbf58443d71ff98 Reviewed-by: hjk Reviewed-by: --- cmake/Findelfutils.cmake | 2 ++ 1 file changed, 2 insertions(+) diff --git a/cmake/Findelfutils.cmake b/cmake/Findelfutils.cmake index ce6ed8d16c9..71463403315 100644 --- a/cmake/Findelfutils.cmake +++ b/cmake/Findelfutils.cmake @@ -60,6 +60,8 @@ if(elfutils_FOUND) endif() endif() endforeach() +else() + message(STATUS " (set ELFUTILS_INSTALL_DIR, or install libdw-dev on a Debian-like system)") endif() mark_as_advanced(ELFUTILS_INCLUDE_DIR ELFUTILS_LIB_elf ELFUTILS_LIB_dw) From 698a49597214005a25db3244b28bfef5bfecf3fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Robert=20L=C3=B6hning?= Date: Thu, 15 Dec 2022 10:54:08 +0100 Subject: [PATCH 03/12] SquishTests: Use existing function saveAndExit() Change-Id: I2e10de8b454a69b3e4ade7520b4fa00415bcde42 Reviewed-by: Reviewed-by: Christian Stenger --- tests/system/shared/build_utils.py | 3 +-- tests/system/shared/editor_utils.py | 3 +-- tests/system/suite_QMLS/tst_QMLS02/test.py | 4 +--- tests/system/suite_QMLS/tst_QMLS04/test.py | 7 ++----- tests/system/suite_QMLS/tst_QMLS08/test.py | 7 ++----- tests/system/suite_editors/tst_generic_highlighter/test.py | 3 +-- tests/system/suite_editors/tst_rename_macros/test.py | 4 +--- tests/system/suite_qtquick/tst_qml_outline/test.py | 3 +-- tests/system/suite_tools/tst_designer_autocomplete/test.py | 3 +-- tests/system/suite_tools/tst_designer_goto_slot/test.py | 3 +-- 10 files changed, 12 insertions(+), 28 deletions(-) diff --git a/tests/system/shared/build_utils.py b/tests/system/shared/build_utils.py index 5d422f8ef08..05afc9c493f 100644 --- a/tests/system/shared/build_utils.py +++ b/tests/system/shared/build_utils.py @@ -209,8 +209,7 @@ def runVerify(): availableConfigs = iterateBuildConfigs() if not availableConfigs: test.fatal("Haven't found build configurations, quitting") - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() for kit, config in availableConfigs: selectBuildConfig(kit, config) test.log("Using build config '%s'" % config) diff --git a/tests/system/shared/editor_utils.py b/tests/system/shared/editor_utils.py index 60ed802745d..57a60fd6a97 100644 --- a/tests/system/shared/editor_utils.py +++ b/tests/system/shared/editor_utils.py @@ -400,8 +400,7 @@ def openDocument(treeElement): def earlyExit(details="No additional information"): test.fail("Something went wrong running this test", details) - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() def openDocumentPlaceCursor(doc, line, additionalFunction=None): cppEditorStr = ":Qt Creator_CppEditor::Internal::CPPEditorWidget" diff --git a/tests/system/suite_QMLS/tst_QMLS02/test.py b/tests/system/suite_QMLS/tst_QMLS02/test.py index cc931ae3239..c4bfdfd9efe 100644 --- a/tests/system/suite_QMLS/tst_QMLS02/test.py +++ b/tests/system/suite_QMLS/tst_QMLS02/test.py @@ -42,7 +42,5 @@ def main(): # wait for issues test.verify(waitFor("issuesModel.rowCount() == 0", 3000), "Verifying if error was properly cleared after code fix") - #save and exit - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() diff --git a/tests/system/suite_QMLS/tst_QMLS04/test.py b/tests/system/suite_QMLS/tst_QMLS04/test.py index 63db543bcba..2c42c178cc0 100644 --- a/tests/system/suite_QMLS/tst_QMLS04/test.py +++ b/tests/system/suite_QMLS/tst_QMLS04/test.py @@ -46,16 +46,13 @@ def main(): waitForObjectItem(":Qt Creator_Utils::NavigationTreeView", addBranchWildcardToRoot(myCompTE), 1000) except: test.fail("Refactoring failed - file MyComponent.qml was not generated properly in project explorer") - #save and exit - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() return test.passes("Refactoring - file MyComponent.qml was generated properly in project explorer") # open MyComponent.qml file for verification if not openDocument(myCompTE): test.fatal("Could not open MyComponent.qml.") - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() return editorArea = waitForObject(":Qt Creator_QmlJSEditor::QmlJSTextEditorWidget") codeText = str(editorArea.plainText) diff --git a/tests/system/suite_QMLS/tst_QMLS08/test.py b/tests/system/suite_QMLS/tst_QMLS08/test.py index 21def06251d..7b7cca9979b 100644 --- a/tests/system/suite_QMLS/tst_QMLS08/test.py +++ b/tests/system/suite_QMLS/tst_QMLS08/test.py @@ -19,8 +19,7 @@ def verifyNextLineIndented(editorArea, expectedIndentation): def verifyIndentation(editorArea): #verify indentation if not placeCursorToLine(editorArea, "id: wdw"): - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() return False type(editorArea, "") expectedIndentations = [1,1,1,2,2,2,2,3,3,3,4,3,3,2,1] @@ -58,6 +57,4 @@ def main(): # verify invoked indentation if not verifyIndentation(editorArea): return - # save and exit - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() diff --git a/tests/system/suite_editors/tst_generic_highlighter/test.py b/tests/system/suite_editors/tst_generic_highlighter/test.py index f1f154376ec..490c6021681 100644 --- a/tests/system/suite_editors/tst_generic_highlighter/test.py +++ b/tests/system/suite_editors/tst_generic_highlighter/test.py @@ -196,9 +196,8 @@ def main(): if current.endswith(".lhs"): type(editor, ">") type(editor, "") + saveAndExit() - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") def init(): syntaxDirectory = __highlighterDefinitionsDirectory__() diff --git a/tests/system/suite_editors/tst_rename_macros/test.py b/tests/system/suite_editors/tst_rename_macros/test.py index cfa29e49863..6d329e44667 100644 --- a/tests/system/suite_editors/tst_rename_macros/test.py +++ b/tests/system/suite_editors/tst_rename_macros/test.py @@ -24,9 +24,7 @@ def main(): expectedHeaderName=headerName) if not testRenameMacroAfterSourceMoving(): return - # save and exit - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() def testRenameMacroAfterSourceModification(): def __deleteAnyClass__(): diff --git a/tests/system/suite_qtquick/tst_qml_outline/test.py b/tests/system/suite_qtquick/tst_qml_outline/test.py index ddf4d368af5..63de1001e1b 100644 --- a/tests/system/suite_qtquick/tst_qml_outline/test.py +++ b/tests/system/suite_qtquick/tst_qml_outline/test.py @@ -21,8 +21,7 @@ def main(): qmlFiles = [treebase + "focus\\.qml", treebase + "Core.ListMenu\\.qml"] checkOutlineFor(qmlFiles) testModify() - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() def checkOutlineFor(qmlFiles): for qmlFile in qmlFiles: diff --git a/tests/system/suite_tools/tst_designer_autocomplete/test.py b/tests/system/suite_tools/tst_designer_autocomplete/test.py index 229420a8b8c..903ca01156a 100644 --- a/tests/system/suite_tools/tst_designer_autocomplete/test.py +++ b/tests/system/suite_tools/tst_designer_autocomplete/test.py @@ -46,5 +46,4 @@ def main(): 'Comparing line "%s" to expected "%s"' % (lineUnderCursor(editor), "ui->%s" % buttonName)) type(editor, "") # Delete line selectFromLocator("mainwindow.ui") - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() diff --git a/tests/system/suite_tools/tst_designer_goto_slot/test.py b/tests/system/suite_tools/tst_designer_goto_slot/test.py index cb3c9eb743f..c43846d7f8c 100644 --- a/tests/system/suite_tools/tst_designer_goto_slot/test.py +++ b/tests/system/suite_tools/tst_designer_goto_slot/test.py @@ -33,5 +33,4 @@ def main(): type(editor, "") test.verify(waitFor('str(lineUnderCursor(editor)).strip() == con[3]', 1000), 'Comparing line "%s" to expected "%s"' % (lineUnderCursor(editor), con[3])) - invokeMenuItem("File", "Save All") - invokeMenuItem("File", "Exit") + saveAndExit() From 1faae7dec412b947f8a0a03c18b50e16eab83f4f Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Dec 2022 16:00:03 +0100 Subject: [PATCH 04/12] Bump version to 9.0.2 Change-Id: Ibc35cf8f8b388438d34c3b824c9eb97d9eefb9ea Reviewed-by: Eike Ziller --- cmake/QtCreatorIDEBranding.cmake | 4 ++-- qbs/modules/qtc/qtc.qbs | 4 ++-- qtcreator_ide_branding.pri | 4 ++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/cmake/QtCreatorIDEBranding.cmake b/cmake/QtCreatorIDEBranding.cmake index e7f7b39cadc..c8b0ff78d5b 100644 --- a/cmake/QtCreatorIDEBranding.cmake +++ b/cmake/QtCreatorIDEBranding.cmake @@ -1,6 +1,6 @@ -set(IDE_VERSION "9.0.1") # The IDE version. +set(IDE_VERSION "9.0.2") # The IDE version. set(IDE_VERSION_COMPAT "9.0.0") # The IDE Compatibility version. -set(IDE_VERSION_DISPLAY "9.0.1") # The IDE display version. +set(IDE_VERSION_DISPLAY "9.0.2") # The IDE display version. set(IDE_COPYRIGHT_YEAR "2022") # The IDE current copyright year. set(IDE_SETTINGSVARIANT "QtProject") # The IDE settings variation. diff --git a/qbs/modules/qtc/qtc.qbs b/qbs/modules/qtc/qtc.qbs index 527bfe5e6dd..f7948de85b1 100644 --- a/qbs/modules/qtc/qtc.qbs +++ b/qbs/modules/qtc/qtc.qbs @@ -6,10 +6,10 @@ import qbs.Utilities Module { Depends { name: "cpp"; required: false } - property string qtcreator_display_version: '9.0.1' + property string qtcreator_display_version: '9.0.2' property string ide_version_major: '9' property string ide_version_minor: '0' - property string ide_version_release: '1' + property string ide_version_release: '2' property string qtcreator_version: ide_version_major + '.' + ide_version_minor + '.' + ide_version_release diff --git a/qtcreator_ide_branding.pri b/qtcreator_ide_branding.pri index f03edd9f28a..f0f86fcf4fe 100644 --- a/qtcreator_ide_branding.pri +++ b/qtcreator_ide_branding.pri @@ -1,6 +1,6 @@ -QTCREATOR_VERSION = 9.0.1 +QTCREATOR_VERSION = 9.0.2 QTCREATOR_COMPAT_VERSION = 9.0.0 -QTCREATOR_DISPLAY_VERSION = 9.0.1 +QTCREATOR_DISPLAY_VERSION = 9.0.2 QTCREATOR_COPYRIGHT_YEAR = 2022 IDE_DISPLAY_NAME = Qt Creator From c8e120123671bfe25fb508508f796714e2b42622 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 16 Dec 2022 06:03:09 +0100 Subject: [PATCH 05/12] LanguageClient: Do not send out invalid errors An error is expected to contain an error message so add one that misses one. Additionally assert when trying to set an error to a response that is invalid (does not contain message or code.) Fixes: QTCREATORBUG-28598 Fixes: QTCREATORBUG-27856 Change-Id: I0631433d847610531758d297a93a5c7cdfdc6c1d Reviewed-by: Christian Stenger --- src/libs/languageserverprotocol/jsonrpcmessages.h | 5 ++++- src/plugins/languageclient/client.cpp | 1 + 2 files changed, 5 insertions(+), 1 deletion(-) diff --git a/src/libs/languageserverprotocol/jsonrpcmessages.h b/src/libs/languageserverprotocol/jsonrpcmessages.h index ebf51b4c14c..c33e46422ca 100644 --- a/src/libs/languageserverprotocol/jsonrpcmessages.h +++ b/src/libs/languageserverprotocol/jsonrpcmessages.h @@ -290,7 +290,10 @@ public: return val.isUndefined() ? std::nullopt : std::make_optional(fromJsonValue(val)); } void setError(const Error &error) - { m_jsonObject.insert(errorKey, QJsonValue(error)); } + { + QTC_CHECK(error.isValid()); + m_jsonObject.insert(errorKey, QJsonValue(error)); + } void clearError() { m_jsonObject.remove(errorKey); } bool isValid(QString *errorMessage) const override diff --git a/src/plugins/languageclient/client.cpp b/src/plugins/languageclient/client.cpp index 5c99329675a..aca6ab50098 100644 --- a/src/plugins/languageclient/client.cpp +++ b/src/plugins/languageclient/client.cpp @@ -1891,6 +1891,7 @@ void ClientPrivate::handleMethod(const QString &method, const MessageId &id, con Response response(id); ResponseError error; error.setCode(ResponseError::MethodNotFound); + error.setMessage(QString("The client cannot handle the method '%1'.").arg(method)); response.setError(error); sendResponse(response); } From f87fccafc181db7844a95367f0253a0da1e230f5 Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 16 Dec 2022 10:54:21 +0100 Subject: [PATCH 06/12] TextEditor: prevent shaping text for indent depth painting QTextLines cursorToX indirectly calls shapeText which is not for free. We just want to have the x position for the line so there is no need to shape the complete text to get the position of the first cursor. Change-Id: I0ae636ed8250385b7ac77c6f37d45922bbf2e9bf Reviewed-by: Marcus Tillmanns --- src/plugins/texteditor/texteditor.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index 285a13a588a..b9fda49c2ed 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4475,7 +4475,7 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, const QTextLine textLine = blockData.layout->lineAt(0); const QRectF rect = textLine.naturalTextRect(); - qreal x = textLine.cursorToX(0) + data.offset.x() + qMax(0, q->cursorWidth() - 1) + qreal x = textLine.x() + data.offset.x() + qMax(0, q->cursorWidth() - 1) + horizontalAdvance * m_visualIndentOffset; int paintColumn = 0; From 1eb73e4eb31e6b8c8e6d1c38b588c2dba6762d0a Mon Sep 17 00:00:00 2001 From: David Schulz Date: Fri, 16 Dec 2022 12:10:29 +0100 Subject: [PATCH 07/12] Editor: prevent validating line number in unwrapped editor Checking whether a position is inside the first line is also not for free. Only check the line number of a cursor position if we expect the editor to have multiple lines per block or in other words line wrapping is enabled. Change-Id: I0e3cb1fbd11c250677f7c11d1a5c780f60085ec2 Reviewed-by: Marcus Tillmanns --- src/plugins/texteditor/texteditor.cpp | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/src/plugins/texteditor/texteditor.cpp b/src/plugins/texteditor/texteditor.cpp index b9fda49c2ed..d6bce9d5a0b 100644 --- a/src/plugins/texteditor/texteditor.cpp +++ b/src/plugins/texteditor/texteditor.cpp @@ -4483,8 +4483,10 @@ void TextEditorWidgetPrivate::paintIndentDepth(PaintEventData &data, while (paintColumn < depth) { if (x >= 0) { int paintPosition = tabSettings.positionAtColumn(text, paintColumn); - if (blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) + if (q->lineWrapMode() == QPlainTextEdit::WidgetWidth + && blockData.layout->lineForTextPosition(paintPosition).lineNumber() != 0) { break; + } const QPointF top(x, blockData.boundingRect.top()); const QPointF bottom(x, blockData.boundingRect.top() + rect.height()); const QLineF line(top, bottom); From 994626d1f6d4decffadae4c5557b457bbc2463ea Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 16 Dec 2022 10:40:42 +0100 Subject: [PATCH 08/12] README.md: Add/correct instructions for building perfparser Change-Id: I7dbdc9a34fb3297957cdb93a6f042c4fb6282eea Reviewed-by: hjk --- README.md | 22 ++++++++++++++-------- 1 file changed, 14 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index 50dd9152a0b..9930da2356d 100644 --- a/README.md +++ b/README.md @@ -157,15 +157,21 @@ like Qt and LLVM, additionally run cmake --install . --prefix /path/to/qtcreator_install --component Dependencies -### Performance Analyzer +### Perf Profiler Support -If you have not installed Qt with the Maintenance Tool, you must -either set the path to the `perfparser` executable as a value of -the `PERFPROFILER_PARSER_FILEPATH` environment variable or copy -the executable to from the Qt Creator installation directory to -the build directory. That is, copy it from -`/path/to/qtcreator_install/Tools/QtCreator/libexec/qtcreator/` to -/path/to/qtcreator_buid/libexec/qtcreator/`. +Support for the [perf](https://perf.wiki.kernel.org/index.php/Main_Page) profiler +requires the `perfparser` tool that is part of the Qt Creator source package, and also +part of the Qt Creator Git repository in form of a submodule in `src/tools/perfparser`. + +Compilation of `perfparser` requires ELF and DWARF development packages. +You can either download and extract a prebuilt package from +https://download.qt.io/development_releases/prebuilt/elfutils/ and add the +directory to the `CMAKE_PREFIX_PATH` when configuring Qt Creator, +or install the `libdw-dev` package on Debian-style Linux systems. + +You can also point Qt Creator to a separate installation of `perfparser` by +setting the `PERFPROFILER_PARSER_FILEPATH` environment variable to the full +path to the executable. ## Getting LLVM/Clang for the Clang Code Model From 3904539e0d7fad334b0360018ca3326640fc3903 Mon Sep 17 00:00:00 2001 From: Artem Sokolovskii Date: Fri, 16 Dec 2022 10:31:20 +0100 Subject: [PATCH 09/12] ClangFormat: Fix crash when m_fileName is empty Fixes: QTCREATORBUG-28600 Change-Id: I3e0d64eb892daa5c63abe7ec81b258bf96fcdb1b Reviewed-by: hjk --- src/plugins/clangformat/clangformatbaseindenter.cpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/plugins/clangformat/clangformatbaseindenter.cpp b/src/plugins/clangformat/clangformatbaseindenter.cpp index 6072082c8c7..47791c27de7 100644 --- a/src/plugins/clangformat/clangformatbaseindenter.cpp +++ b/src/plugins/clangformat/clangformatbaseindenter.cpp @@ -464,10 +464,9 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe bool secondTry) const { QTC_ASSERT(replacementsToKeep != ReplacementsToKeep::All, return Utils::Text::Replacements()); + QTC_ASSERT(!m_fileName.isEmpty(), return {}); - clang::format::FormatStyle style = styleForFile(); QByteArray originalBuffer = buffer; - int utf8Offset = Utils::Text::utf8NthLineOffset(m_doc, buffer, startBlock.blockNumber() + 1); QTC_ASSERT(utf8Offset >= 0, return Utils::Text::Replacements();); int utf8Length = selectedLines(m_doc, startBlock, endBlock).toUtf8().size(); @@ -476,6 +475,7 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe if (replacementsToKeep == ReplacementsToKeep::IndentAndBefore) rangeStart = formattingRangeStart(startBlock, buffer, lastSaveRevision()); + clang::format::FormatStyle style = styleForFile(); adjustFormatStyleForLineBreak(style, replacementsToKeep); if (replacementsToKeep == ReplacementsToKeep::OnlyIndent) { CharacterContext currentCharContext = CharacterContext::Unknown; @@ -527,6 +527,7 @@ Utils::Text::Replacements ClangFormatBaseIndenter::replacements(QByteArray buffe Utils::Text::Replacements ClangFormatBaseIndenter::format( const TextEditor::RangesInLines &rangesInLines) { + QTC_ASSERT(!m_fileName.isEmpty(), return {}); if (rangesInLines.empty()) return Utils::Text::Replacements(); From 456b8b69f9a0b6d8367a3ce1909df4cadd96cdc1 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Thu, 15 Dec 2022 12:43:13 +0100 Subject: [PATCH 10/12] build_plugins.py: Create signed package for plugins On macOS if SIGNING_IDENTITY is given. Creates an extra -signed.7z, to not interfere with existing build setups. Change-Id: I8ec7f5cbeb14fb749d5d62398916629b83bdb833 Reviewed-by: Reviewed-by: Christian Stenger --- scripts/build_plugin.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/scripts/build_plugin.py b/scripts/build_plugin.py index 4e142bcd1e0..df06908c9d3 100755 --- a/scripts/build_plugin.py +++ b/scripts/build_plugin.py @@ -39,6 +39,13 @@ def get_arguments(): action='store_true', default=False) parser.add_argument('--build-type', help='Build type to pass to CMake (defaults to RelWithDebInfo)', default='RelWithDebInfo') + # zipping + parser.add_argument('--zip-threads', help='Sets number of threads to use for 7z. Use "+" for turning threads on ' + 'without a specific number of threads. This is directly passed to the "-mmt" option of 7z.', + default='2') + # signing + parser.add_argument('--keychain-unlock-script', + help='Path to script for unlocking the keychain used for signing (macOS)') args = parser.parse_args() args.with_debug_info = args.build_type == 'RelWithDebInfo' return args @@ -144,6 +151,21 @@ def package(args, paths): common.check_print_call(['7z', 'a', '-mmt2', os.path.join(paths.result, args.name + '-debug.7z'), '*'], paths.debug_install) + if common.is_mac_platform() and common.codesign_call(): + if args.keychain_unlock_script: + common.check_print_call([args.keychain_unlock_script], paths.install) + if os.environ.get('SIGNING_IDENTITY'): + signed_install_path = paths.install + '-signed' + common.copytree(paths.install, signed_install_path, symlinks=True) + apps = [d for d in os.listdir(signed_install_path) if d.endswith('.app')] + if apps: + app = apps[0] + common.conditional_sign_recursive(os.path.join(signed_install_path, app), + lambda ff: ff.endswith('.dylib')) + common.check_print_call(['7z', 'a', '-mmt' + args.zip_threads, + os.path.join(paths.result, args.name + '-signed.7z'), + app], + signed_install_path) def get_paths(args): Paths = collections.namedtuple('Paths', From 70b33886843cde31ee4d6a46cad010e81885ae70 Mon Sep 17 00:00:00 2001 From: Cristian Adam Date: Fri, 16 Dec 2022 14:32:54 +0100 Subject: [PATCH 11/12] CMakePM: Allow relative compiler paths for presets You can have a preset with the PATH environment variable modified and with CMAKE_C|XX_COMPILER CMake variables only as "gcc.exe" and "g++.exe" Qt Creator now will search in PATH after the compiler file names and work as expected. Fixes: QTCREATORBUG-28602 Change-Id: I8520f6fcf5e542600fab08228d04d3709d3a8e8f Reviewed-by: Eike Ziller Reviewed-by: Qt CI Bot --- .../cmakeprojectimporter.cpp | 23 +++++++++++++++++++ 1 file changed, 23 insertions(+) diff --git a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp index f8f536e22db..fe9487bbaf6 100644 --- a/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp +++ b/src/plugins/cmakeprojectmanager/cmakeprojectimporter.cpp @@ -441,6 +441,28 @@ static QString extractVisualStudioPlatformFromConfig(const CMakeConfig &config) return platform; } +void updateCompilerPaths(CMakeConfig &config, const Environment &env) +{ + auto updateRelativePath = [&config, env](const QByteArray &key) { + FilePath pathValue = config.filePathValueOf(key); + + if (pathValue.isAbsolutePath() || pathValue.isEmpty()) + return; + + pathValue = env.searchInPath(pathValue.fileName()); + + auto it = std::find_if(config.begin(), config.end(), [&key](const CMakeConfigItem &item) { + return item.key == key; + }); + QTC_ASSERT(it != config.end(), return); + + it->value = pathValue.path().toUtf8(); + }; + + updateRelativePath("CMAKE_C_COMPILER"); + updateRelativePath("CMAKE_CXX_COMPILER"); +} + QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, QString *warningMessage) const { @@ -518,6 +540,7 @@ QList CMakeProjectImporter::examineDirectory(const FilePath &importPath, } } else { config = cache; + updateCompilerPaths(config, env); config << CMakeConfigItem("CMAKE_COMMAND", CMakeConfigItem::PATH, configurePreset.cmakeExecutable.value().toUtf8()); From 77dfa71f0618278ff974d0f274bb87fc36c91077 Mon Sep 17 00:00:00 2001 From: Eike Ziller Date: Fri, 16 Dec 2022 11:23:54 +0100 Subject: [PATCH 12/12] Deploying Qt: Clean up .cpp.o(bj) files when deploying Qt These files are required when building against some static libraries that Qt ships. Since we don't link against these libraries, we used to remove them when we install Qt, but starting with Qt 6.5 some of these files are required by the Qt CMake files, and configuration would fail. So, we now have to remove them when deploying Qt, instead of already when installing Qt. Change-Id: Ie38ab3735b86df0372b946d6a808007b5ec84b88 Reviewed-by: Reviewed-by: Tim Jenssen --- scripts/deployqt.py | 7 +++++-- scripts/deployqtHelper_mac.sh | 3 +++ 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/scripts/deployqt.py b/scripts/deployqt.py index 50eb3eb1253..05113e43e77 100755 --- a/scripts/deployqt.py +++ b/scripts/deployqt.py @@ -110,9 +110,12 @@ def is_ignored_windows_file(use_debug, basepath, filename): return False def ignored_qt_lib_files(path, filenames): + # Qt ships some unneeded object files in the qml plugins + # On Windows we also do not want to ship the wrong debug/release .dlls or .lib files etc if not common.is_windows_platform(): - return [] - return [fn for fn in filenames if is_ignored_windows_file(debug_build, path, fn)] + return [fn for fn in filenames if fn.endswith('.cpp.o')] + return [fn for fn in filenames + if fn.endswith('.cpp.obj') or is_ignored_windows_file(debug_build, path, fn)] def copy_qt_libs(target_qt_prefix_path, qt_bin_dir, qt_libs_dir, qt_plugin_dir, qt_qml_dir, plugins): print("copying Qt libraries...") diff --git a/scripts/deployqtHelper_mac.sh b/scripts/deployqtHelper_mac.sh index a4afd7f20a5..b33795ae4a7 100755 --- a/scripts/deployqtHelper_mac.sh +++ b/scripts/deployqtHelper_mac.sh @@ -145,6 +145,9 @@ if [ ! -d "$app_path/Contents/Frameworks/QtCore.framework" ]; then fi +# clean up unneeded object files that are part of Qt for some static libraries +find "$app_path" -ipath "*/objects-*" -delete + # clean up after macdeployqt # it deploys some plugins (and libs for these) that interfere with what we want echo "Cleaning up after macdeployqt..."