Commit Graph

407 Commits

Author SHA1 Message Date
hjk
f7d022009b QMake: Use FilePath for sysroot
Less roundtrips.

Change-Id: I0f98629398170f5d1d4ccd60cfaa0d54f8e2b9f3
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-11-29 10:11:18 +00:00
hjk
669242b9d8 QMakeProjectManager: Progress towards reading remote .pro files
Change-Id: I26d6d47ac7cd44ec2877243d562de1d90ba45054
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-11-29 10:10:52 +00:00
hjk
67e9c2d7a0 CppEditor: Proliferate FilePath use
Remove SnapShot::{find,contains}(QString) overloads and fix fallout.

Change-Id: I50c415826939e09ac111f33def611c7478fa5d97
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-11-25 09:01:05 +00:00
hjk
c7c6ddb8b0 Utils: Replace Environment::isSameExecutable()
... by FilePath::isSameExecutable().

The only non-mechanical case is the use inside QmakeBuildSystem::testToolChain
using a build environment instead of the FilePath's device environment.

This make a difference in theory due to the use of PATHEXT in the actual
check, but I believe the case that someone creates a 'qmake.foo' and
a 'qmake.bar', adds .foo and .bar to PATHEXT and then complains that
there's a warning missing about not-matching mkspecs has zero
likelihood in reality (and will break other places in Creator anyway).

Change-Id: Id6a8d1e4dc2eb74ca81610ccb1c4ee94c6f47e12
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-23 08:07:08 +00:00
Marcus Tillmanns
129448d61d QmlJS: Fix Follow under cursor
When trying to jump to a symbol in a qml file the Qml Model may find
the location in a generated .qml file in the build folder.
QtCreator searches in all generated .qrc files to try and find
the source file so it can jump to it instead.

Previously not all auto-generated ".rcc" folders would be found
as only the folders of targets (executables) were searched.
Plugins or Static Libraries were not searched.

With this fix, all projects nodes are searched for the ".rcc" folder
and therefore also finds them for Dynamic / Static libraries and
plugins.

Fixes: QTCREATORBUG-27173
Change-Id: Ic51ac8fbc82c15785cbefd76787942a512ecf3db
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-11-08 09:54:10 +00:00
Christian Kandeler
a34125ae11 CMake/qmake: Fix target triple for iOS targets
Neither cmake nor qmake know the full iOS compiler command line, so we
have to construct the target triple for the code model ourselves.

Fixes: QTCREATORBUG-28278
Change-Id: I6cac06f340e9388de5c86509a8df4ac00eef87cd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-10-13 13:28:52 +00:00
Jarek Kobus
e54fb7ab64 Replace missing qAsConst with std::as_const()
Patch missing leftovers after recent batch patch.

Amends 8eb4d52342

Change-Id: I5469b8c10e6844cd1911f719ce3dddbb42697f95
Reviewed-by: hjk <hjk@qt.io>
2022-10-10 14:14:02 +00:00
Marc Mutz
8eb4d52342 Port from qAsConst() to std::as_const()
We've been requiring C++17 since Qt 6.0, and our qAsConst use finally
starts to bother us (QTBUG-99313), so time to port away from it
now.

Since qAsConst has exactly the same semantics as std::as_const (down
to rvalue treatment, constexpr'ness and noexcept'ness), there's really
nothing more to it than a global search-and-replace.

Task-number: QTBUG-99313
Change-Id: I88edd91395849574436299b8badda21bb93bea39
Reviewed-by: hjk <hjk@qt.io>
2022-10-07 13:47:53 +00:00
Jarek Kobus
8741ce6afc QMakeProjectManager: Replace foreach with ranged for loop
Change-Id: Ibdb526ac3e0cfbb0568e17c21a1b73f7749a84ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-07 10:11:36 +00:00
Jarek Kobus
43f3b70437 QMakeProjectManagerPlugin: Limit the usage of qMakePair
Remove unneeded Utils:: scope.

Change-Id: I9d42aa2005214004b91686168e2bcaa420354a6c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-04 08:04:05 +00:00
Alessandro Portale
76238bed6c QmakeProjectManager: Convert to using Tr::tr
Change-Id: I08393b1f27bf238c8ac0ccb99e63e56a9d21ecb5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-09-29 12:08:43 +00:00
Christian Kandeler
049c2cf6f3 QmakeProjectManager: Work around broken mkspecs
E.g. linux-oe-g++/qmake.conf has this craziness:
    QMAKE_CXX = arm-poky-linux-gnueabi-g++ -mthumb -mfpu=neon
                -mfloat-abi=hard -mcpu=cortex-a9
                -fstack-protector-strong -D_FORTIFY_SOURCE=2 -Wformat
                -Wformat-security -Werror=format-security
Since there seems to be no hope for a fix, we work around it by looking
for compiler options in the alleged executable names and forwarding them
along with the flags from the actual *FLAGS variables.

Fixes: QTCREATORBUG-28201
Change-Id: Id0651677dd7b444a5f443e63d36e8dec52106af7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-23 10:04:06 +00:00
hjk
7cfc3d26bc Utils: Replace FilePath part setters
... by a combined version. This will make it easier to store the parts
in one QString object.

Change-Id: Ie85a77e3957c78a30e49998fe2e617af35a8ad17
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-01 07:59:29 +00:00
Lucie Gérard
a7956df3ca Use SPDX license identifiers
Replace the current license disclaimer in files by
a SPDX-License-Identifier.

Task-number: QTBUG-67283
Change-Id: I708fd1f9f2b73d60f57cc3568646929117825813
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-08-26 12:27:18 +00:00
Fawzi Mohamed
fd89043de2 qmljs: (QString -> Utils::FilePath)++
convert more QString containing paths to Utils::FilePath

Change-Id: I1219d7d147993e48cfa641dc9bea72ab38c90f51
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-07-13 17:13:23 +00:00
Eike Ziller
948f0070fa macOS: Fix importing command line builds with CMake
When configuring a CMake project on the command line, CMake will
(correctly) find and use the compiler from the current developer
directory, usually somewhere in
/Applications/Xcode.app/Contents/Developer

But Qt Creator auto-detects and sets up the compiler /usr/bin/clang(++)
for desktop kits. This leads to a compiler mismatch between kits and the
imported build, and to new kits registered in Qt Creator for the import.

Since /usr/bin/clang(++) is just a thin wrapper that resolves to the
compiler in the current developer directory, resolve that in Qt Creator
with "xcrun -f <command>" too (caching the result), and include that
when comparing toolchains for importing builds.

Fixes: QTCREATORBUG-27591
Change-Id: I301e2a4e267450b488b49d0c32d4ce89001bb5ec
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Mitch Curtis <mitch.curtis@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-06-13 10:03:16 +00:00
Christian Kandeler
958531adbf Revert "QtSupport: Add support to register Qt versions via qtpaths"
The patch breaks several plugin unit tests; at the very least QtSupport,
AutoTest and ClangCodeModel.

This reverts commit 72aa77ced7.

Change-Id: Iaa7f452d0f43d0072b0bbcf8934fa0dcd6f9b240
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-06-01 14:24:20 +00:00
Alessandro Portale
72aa77ced7 QtSupport: Add support to register Qt versions via qtpaths
qmake is a "build tool", and it is also a "query tool" when called with
parameter "-query". Qt Creator, so far, assumes that building and
querying with a Qt installation are done with one and the same tool:
qmake. This change adds the ability to register a Qt version vie either
qmake or qtpaths and still build with qmake, if that is installed (which
is not anymore mandatory from Qt 6 on).

1) Distinguish between Qt query tool and qmake build tool:
Add QtVersion::queryToolFilePath() to the existing
QtVersion::qmakeFilePath(), and use queryToolFilePath in most "query"
related code, and qmakeFilePath when building with qmake (e.g. in
QmakeProjectManager).
Also, a couple of functions and variables were renamed from *qmake* to
*queryTool* in order to express that the affected code is about
querying/managing Qt versions rather than about building with qmake.

2) Support manual Qt Version adding by qtpaths via file dialog
This change adds qtpaths to the "Add" Qt Version file picker filter.
After selection, "qtpaths -query" is executed for testing purposes. If
that fails, (e.g. because it is an older Qt version), qmake is instead
chosen, silently.

Task-number: QTCREATORBUG-22175
Task-number: QTCREATORBUG-25546
Change-Id: I4d9c1e7eec7d5ae7c5a8d2e1a1ed95addff69966
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-06-01 06:09:48 +00:00
hjk
a48a96e05c QtSupport: Introduce a type alias for QList<BaseQtVersion *>
Change-Id: I96b0eccc04da2f4a1a4e5ea9bdceb91b3fa3d724
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 14:38:20 +00:00
hjk
25f5771aa4 Rename QtSupport::BaseQtVersion to QtVersion
... and the Utils::QtVersion enum to Utils::QtMajorVersion to avoid
conflicts.

Change-Id: Ib688c67388272b7204a91444155f60b8c18a56bd
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-24 12:13:19 +00:00
Alessandro Portale
f6c26233c8 QmakePM: Treat QMAKE_CC/CXX as user input when converting to FilePath
qmake may construct QMAKE_CC and QMAKE_CXX by using paths from
environment variables that have native delimiters. That is the case with
Android (see mkspecs/android-clang/qmake.conf).

That leads to QMAKE_CC and QMAKE_CXX having mixed-style path separators,
and that is the reason to treat them as user input.

Change-Id: I1baf180c16710f4cd00ac182fa241b84ae99fa38
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-01-03 08:30:11 +00:00
hjk
652b9844e6 Utils: FilePathify Environment::{ap,pre}pendOrSetPath etc
Change-Id: Idfa5ec247337570936b0236cab9d3a5669792ca0
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-11-10 07:26:31 +00:00
Jarek Kobus
7e7b6a52f9 Don't kill the QProcess instance which is running in other thread
The main thread doesn't kill processes directly, but
sets just the cancel flag.

Instead of waiting infinitely long for a process to finish
we poll periodically (every 100ms) for the canceled flag
inside the thread that started the process.

Amends: a30aa4421a

Task-number: QTCREATORBUG-26333
Change-Id: I599d5c6cd69381cadc4a01c65f6a79f9a9bbd3fb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-10-06 09:57:37 +00:00
hjk
cb4f75426d ProjectExplorer: Remove one constructor overload of DeployableFile
Change-Id: I87e444349129e9370b5fec505444723d36e21448
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-14 03:28:48 +00:00
Christian Kandeler
284817fae6 Merge CppTools into CppEditor
There was no proper separation of responsibilities between these
plugins. In particular, CppTools had lots of editor-related
functionality, so it's not clear why it was separated out in the first
place.
In fact, for a lot of code, it seemed quite arbitrary where it was put
(just one example: switchHeaderSource() was in CppTools, wheras
switchDeclarationDefinition() was in CppEditor).
Merging the plugins will enable us to get rid of various convoluted
pseudo-abstractions that were only introduced to keep up the artificial
separation.

Change-Id: Iafc3bce625b4794f6d4aa03df6cddc7f2d26716a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-01 14:53:58 +00:00
Christian Kandeler
25ff15a1fb Add convenience functions for creating ProjectExplorer::HeaderPaths
Change-Id: I7b1f63caca6b70ba4ec1b1870b83cbf20aa6564a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-30 10:46:56 +00:00
hjk
d932b8535a Qmake: Allow removing QMLJS from project languages
E.g. when the last use of the libraries was removed from .pro files.

This also makes the use more similar to the other build systems and
allows making Project::{add,remove}ProjectLanguage private.

Change-Id: Ib23d83f2fb5aab728b344c164a1331429b44e345
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-08-24 17:06:50 +00:00
hjk
1bde4ddbec ProjectExplorer: Use FilePaths in project tree nodes
Change-Id: I31b15c428d9b962333947b1e32641fd80f61d069
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-16 13:45:06 +00:00
Tim Jenssen
22121885fe baseqtversion: commands are FilePathes
also renamed the qmlscene* qmlRuntime*

Change-Id: Ifd522e21f5ce30aaa54060fdcebee2cd8b9463c4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-07-14 09:50:01 +00:00
Eike Ziller
03b048dc83 Merge remote-tracking branch 'origin/4.15' into 5.0
Change-Id: I5e57cb456e3f501d5182c8db3688c2729e9fadb2
2021-07-09 14:09:12 +02:00
Eike Ziller
4767dfcce3 qmake: Fix issues with executing system calls
Do not try to reuse the QFutureInterface that is used for the parsing
process. Reusing the QFutureInterface can lead to issues. So far no
problems were triggered, but a30aa4421a
introduced a watcher that tells the qmake parser to ignore all system
calls after the future was canceled. This was somehow, sometimes
triggered on the reused QFutureInterface even though the user didn't
cancel anyhing, leading to all system calls to bail out in the
subsequent run.

Using a new QFutureInterface instance for each parsing run solves the
issue.

Amends a30aa4421a

Fixes: QTCREATORBUG-25970
Change-Id: I6836c97038c36968e93815c6121bc284edbe19bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-08 12:38:03 +00:00
Eike Ziller
e3b639047f Don't update extra compilers individually after project load
Each call of CppModelManager::updateSourceFiles detaches the current
snapshot.
The extra compilers where set up and triggered individually, and
resulted in individual updateSourceFiles calls with the single result
file of the extra compiler. For Qt Creator this would lead to 200
calls in quick succession after project load, potentially leading to a
freeze of multiple seconds.

Instead of updating the result files of the extra compilers individually
after project load, integrate the update into the regular project source
file update. So we end up with only a single call of updateSourceFiles.
For this the project updater needs to trigger the extra compilers, and
wait for all to finish as well as the regular project part update,
before
triggering the parser.

Task-number: QTCREATORBUG-25783
Change-Id: I34f6df0fc0f96bcb42ee65019bee39cf49176c1f
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-05 08:16:25 +00:00
hjk
1db9dd058e QtSupport: Use FilePaths in BaseQtVersion::isInSourceDirectory
... and isSubProject.

Take the opportunity to rename them into isInQtSourceDirectory and
a isQtSubProject to make its limited scope clearer.

An open question is why this is only used for qmake projects.

Change-Id: If36f9457583eac17e149624ec46e5de10dd4a5a5
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-02 05:30:41 +00:00
hjk
8ac67dd1b7 QMake: Use local paths in interfacing ProFileReader
There are some internal hard asserts on that.

Change-Id: I93bbdff0c9625d42d5f9da3f12219ad90c478d5d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-23 06:52:34 +00:00
hjk
58f984d2b9 Qmake: FilePathify remaining qmakeproject.cpp
Change-Id: I79860efc69b0053701306a83c61dfc4bc2d31bb3
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-18 11:38:38 +00:00
hjk
e05bb25306 Qmake: FilePathify QmakeBuildSystem::buildDir
Change-Id: I856152c00a07d018b88526efb5576759e2b4b82f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-18 11:36:26 +00:00
hjk
3721f60934 Qmake: Make executableFor() return a FilePath instead of QString
Change-Id: Ie7e0432080577aedb9c8a4be2d20388afbdce349
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-17 11:41:38 +00:00
David Schulz
5ec611b68e Utils: add FilePath::completeBaseName
Removing some FilePath::toFileInfo() calls again.

Change-Id: I6610beebf2c30754fde525b71f4c4a34ceb5e30b
Reviewed-by: hjk <hjk@qt.io>
2021-06-04 07:07:07 +00:00
Christian Kandeler
413b83ddf9 QmakeProjectManager: Fix possible crash on project document reload
... while a parse is going on.

Fixes: QTCREATORBUG-25137
Change-Id: I02a914332ef120caee044139581e1901b4537bff
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-13 08:04:56 +00:00
Alessandro Portale
72d91dc94a Use qAsConst with non-const Qt containers in range-loops
... in various places

Change-Id: Ic6c0c1b9437a1ed402105c7a14a1f5f9454a68d4
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-02-17 14:43:29 +00:00
Eike Ziller
484d40258a IDocument: Simplify permission changes
Take care of handling file permission changes centrally.

TextDocument had its own, caching implementation of tracking the backing
file's read-only state. Move that into IDocument directly.

IDocument::reload with a permission-only change is not a very
interesting case, but every subclass needed to add handling of it.
Instead, remove TypePermission from the file-change types, and handle it
separately via the now unified checkPermissions() implementation.
IDocument::reloadBehavior already was never called with TypePermission.

Change-Id: I321d47ba6193bc878efa9bb50ba7a739fa492745
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-01-14 14:55:34 +00:00
Christian Kandeler
a30aa4421a Qmake: Prevent unresponsive processes from hanging Qt Creator
That is, processes run via qmake's system() function.
Fun fact disovered while implementing this: "Canceling" the loading of a
qmake project did nothing at all except making the progress bar red at
the end of the parsing procedure. Now at least we terminate the
currently running processes invoked by system(), so the parsing threads
can continue and eventually finish.

Task-number: QTCREATORBUG-24825
Task-number: QTCREATORBUG-25000
Task-number: QTCREATORBUG-25194
Change-Id: Ic92ef200d3a49bbdeff0429ae7038fe3f1935b38
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2021-01-05 15:40:15 +00:00
Eike Ziller
d02afbe6b4 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/projectexplorer/gcctoolchain.cpp

Change-Id: I2136ba89d3aa3c4c2a0e7a4f9d8ba9cec32924ce
2020-11-30 16:14:32 +01:00
Eike Ziller
18e3e70887 qmake: Do not bring general messages pane to front
- message(): Print to general messages and blink
- warning(), error(): create item in Issues pane
- parse error and other errors: create item in Issues pane

Task-number: QTCREATORBUG-24430
Change-Id: I6b37cef0b9e53e2207341bd179e2c60a40da9ee0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-27 15:43:33 +00:00
Eike Ziller
381c5656e7 Merge remote-tracking branch 'origin/4.14'
Conflicts:
	src/plugins/mesonprojectmanager/project/mesonprojectparser.h

Change-Id: Id38d20ce20981dcdc322fe5d1d7647f4bec89d8a
2020-11-13 16:03:26 +01:00
Jarek Kobus
2b414508b7 Remove unneeded includes
Change-Id: I67fee9303509b7080e123a2a5826e200ce498ce2
Reviewed-by: hjk <hjk@qt.io>
2020-11-12 12:14:11 +00:00
Nikolai Kosjar
888ea6bbbb CppTools: Take "-include" files into account
Fixes: QTCREATORBUG-20602
Change-Id: Ibfc518fc64ed75f93265db800558ec1d2e424bb4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-11-05 08:49:24 +00:00
Christian Kandeler
dd62254e4e QmakeProjectManager: Make "system" execution opt-in
It has too many side effects.
Amends fcd6384f4d.
T_SYSTEM and E_SYSTEM are now treated the same.

Fixes: QTCREATORBUG-24551
Change-Id: Ib6df2762d329f2ddc0dd66190454159d446a9ac9
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2020-10-16 10:40:45 +00:00
Eike Ziller
8b031c8c05 Merge remote-tracking branch 'origin/4.13' into master
Change-Id: I3f2a6c553819e992da7e9f538dc44b95b482359e
2020-10-02 10:47:07 +02:00
Christian Kandeler
4c1c11b7b6 QmakeProjectManager: Fix crash on reparsing
After a re-parse, the existing IDocuments need to be updated with the
new QmakePriFile object, as the old one may no longer be valid and thus
cause a crash on the next re-parse.
Amends f3bd07efd1.

Fixes: QTCREATORBUG-24683
Change-Id: Ib03d3005cb7831f1e05cb116aa3cdfe6cf5e72ad
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-28 11:29:41 +00:00