Commit Graph

80 Commits

Author SHA1 Message Date
Jarek Kobus
ee48dba19e FileApiReader: Make shutdown faster
Check more often for canceled future.

Make more functions static.

Fixes: QTCREATORBUG-27729
Change-Id: I8dd787acea6343008c7515fb6a4fdfde50b37aee
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-06 15:37:12 +00:00
Jarek Kobus
e4ae894c96 FileApiReader: Make stopping faster
On the session switch we are busy waiting for the running async task,
started before by the FileApiReader::endState(). This blocks the main
thread for considerable amount of time. E.g. when switching
between sessions both containing Qt project, it may block
the main thread up to 10 seconds.

Instead, we employ the future synchronizer and move the awaiting
to the shutdown phase.

The next patch is going to limit the awaiting in shutdown phase.

Task-number: QTCREATORBUG-27729
Change-Id: I956ed26edcd699d8a4e2b9309d109963f1d4bb20
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-10-06 15:37:06 +00:00
Cristian Adam
16dfd2d374 CMakePM: Add "[cmake] " prefix to all output messages
With this one could easily filter the "[cmake] " messages from all the
messages in the "Generate Messages" pane.

Change-Id: I690650f0ccb0372c9361b95cfec41809737720d7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-10-05 15:15:32 +00:00
Cristian Adam
ed1568309b CMakePM: Add CMake Profiler action
Change-Id: I17f258834724c37f0933d18b6214851be1965913
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-09-21 18:39:53 +00:00
Eike Ziller
c9fd5465eb Merge remote-tracking branch 'origin/11.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs

Change-Id: I0b0394dd68cf89b2579d623af897f55dc01aeea5
2023-08-25 11:50:14 +02:00
Cristian Adam
6a30ebd01e CMakePM: Only set cmake reply fileWatcher after CMake has run
This avoids the case when CMake would trigger the file watcher when
generating totally different json files.

For example switching branches and doing a build on a big project, like
Qt Creator for example.

The filewatcher would be triggered and the UI would freeze for quite a
while.

Task-number: QTCREATORBUG-29416
Change-Id: I6ff47d8c2553f7718e82d92daae99036f37aca7d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-08-24 15:23:21 +00:00
Artem Sokolovskii
8fcf3a695f DAP: Fix windows support
- Added using named pipe for windows

Change-Id: I45561481d63c5dd81bda14e6ace4fb0374d1b488
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-08-08 13:20:14 +00:00
Cristian Adam
3c0899d736 Debugger: use TemporaryDirectory for CMake debugger
Hardcoding "/tmp" is not the best idea.

Change-Id: I9d5abd48bdf37d842d790db5ae5c4a7b994075e1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-07-28 11:55:31 +00:00
Artem Sokolovskii
cd6e990de8 DAP: Add CMake debug to the debug panel
This commit introduces the capability to initiate
CMake Debug sessions directly from the debug panel
in the QtCretor.

Change-Id: I00245e0e14aded378e881c4049cdc41dd1fbd00e
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-07-14 08:47:01 +00:00
hjk
3e155919eb CMake: Use current pattern to access main settings page
Change-Id: I95c556bebe1d583879b6702f727d9a859b9a4bcb
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-07-07 12:57:27 +00:00
Eike Ziller
bd660aaf27 CMake: Fix setting additional project files for file watching
Amends d8be2491a5

The change above introduced FileApiReader::takeCMakeFileInfos and uses
it to move the information about additional CMake files out of the
FileApiReader. But that now emptied variable was later used to inform
the project about these additional files. So, that broke the automatic
running of CMake when project files (except the toplevel one) changes.
Instead use the list of additional files that now lives in the
CMakeBuildSystem for that purpose.

Change-Id: I1062593029880af9d4c70e72e1bd101d40ad0c00
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-05-08 12:23:10 +00:00
Jarek Kobus
a3a5b8f806 Utils: Rename asynctask.{cpp,h} -> async.{cpp,h}
Follows AsyncTask -> Async rename.

Change-Id: I37f18368ab826c9960a24087b52f6691bb33f225
Reviewed-by: hjk <hjk@qt.io>
2023-05-03 13:24:20 +00:00
Cristian Adam
d8be2491a5 CMakePM: Add new / existing source files to project
This will add the new added source files (.cpp, .h, .qrc, .ui) to the
corresponding CMake source file as last arguments for known CMake
functions like add_executable, add_library as well for the Qt
counterprarts qt_add_executable or qt_add_library.

For custom functions the code will insert a target_sources() call.
Subsequent calls will add the files to the last target_sources.

The previous copy to clipboard mechanism and settings have been removed.

Fixes: QTCREATORBUG-26006
Fixes: QTCREATORBUG-27213
Fixes: QTCREATORBUG-28493
Fixes: QTCREATORBUG-29006
Change-Id: Ia6e075e4e5718e4106c1236673d469139611a677
Reviewed-by: hjk <hjk@qt.io>
2023-04-20 12:43:33 +00:00
Jarek Kobus
7ab0fd56ae RunExtensions: Move onResultReady and onFinished into asynctask.h
Change-Id: I96dbf5b0253251224ae678172cd5fca12b34326a
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-04-17 09:10:33 +00:00
Jarek Kobus
4ae94a9910 CMakeProjectManager: Use QtConcurrent invocation for async run
Change-Id: I03b23a6bd32bfaa435ddddab1a7ab47a5203ff44
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-03-09 13:12:47 +00:00
Eike Ziller
379bf65e96 Some fixes in translated strings
- doesn't make sense to translate "%1"
- showPreprocessedFile: "reason" contains full stop, put at the end
- add missing closing >
- remove whitespace at the end of translated string
- added missing quotes and full stops
- Remove some control text from tr

Change-Id: I5537c3d12d038e25e2209af1198129fbf959b43c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2023-02-15 12:45:48 +00:00
hjk
3ff5661327 Move some FileSystemWatcher usages to FilePath
Change-Id: I72d24ae3f819e429009b0d7e42b21957f07cb00a
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-27 08:18:49 +00:00
hjk
87c3f08e52 CMake: Move settings storage closer to class implementation
Simpler in use.

Change-Id: I8cc929001035974b9b73566b206410bfd77f73a6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-23 14:49:45 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Cristian Adam
2f39b51bdc CMakePM: Make "Autorun CMake" a global setting
The "Autorun CMake" is only visible in the Tools settings page when
the user clicks on CMake tool.

This is not very visible and it doesn't have to be per CMake version.

Change-Id: I57ded0b2e6a3ecb731bb8bc1495b6b61bc04c8b6
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-05 14:37:50 +00:00
Jarek Kobus
9e8d208cad CMakeProcess: Do some cleanup
1. Get rid of unused started() signal.
2. Remove lastExitCode() getter.
3. Add int exitCode arg to finished() signal.
4. Make some string variables const.

Change-Id: I3e9774f64a8f34fd2be4436d766285cad1c539a3
Reviewed-by: hjk <hjk@qt.io>
2022-11-17 15:07:10 +00:00
hjk
0d13cfe652 CMake: Remove the restriction that the reply file cannot be remote
It would be remote on "real remote" builds.

Task-number: QTCREATORBUG-28242
Change-Id: Ic37e5c6ec30064aec825d2322d25843a526b6ac4
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-10-07 09:49:06 +00:00
hjk
ab4c9b9679 CMake: Move to Tr::tr
Change-Id: I169da93b5184351cb915d4c198fd33318fcfe06f
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-09-30 06:56:21 +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
hjk
df358c7833 ProjectExplorer: Remove unneeded #include in projectexplorer.h
And fix side effects.

Change-Id: Ib6f0c5618092f80204b409edec0a92004f2350d2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-27 11:56:09 +00:00
Jarek Kobus
9a4164a4de CMakeProcess: Don't use QTimer for checking the canceled state
Create a QFutureWatcher instead and connect to its canceled()
signal.

Replace some includes with forward declarations.

Change-Id: Ie82bf8902ef8c8d87011809bd14b7db3d4f52179
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-16 12:37:18 +00:00
Jarek Kobus
8eb12ea614 CMakeProcess: Fix stopping the CMake process
Calling QtcProcess::terminate() doesn't guarantee that
process will be terminated, especially on Windows we may
ofter wait for it forever. Replace the call to terminate()
with close(). After calling close(), the process will sooner
or later be terminated (or finally killed) - that's the job
for ProcessReaper.

Since the current code relies on receiving the finished() signal
after calling a stopping method, we need to call the expected
handler (handleProcessDone()) after calling the QtcProcess::close(),
as afterwards we can't expect receiving any signal for the possibly
running process anymore.

Refactor the code so that we connect do QtcProcess::done() signal
instead of connecting to QtcProcess::finished() signal. This
guarantees that the handler will also be called when process
failed to start. Handle this case in done() handler, too.

Rename CMakeProcess::terminate() into CMakeProcess::stop()
in order to avoid confusion on what method we have chosen to
stop the process in fact. That's the implementation detail.

Get rid of some QFuture related handlings from public API.
Use them directly from inside CMakeProcess d'tor.

Get rid of public state() method, as it seems it's unused.

Increase the responsiveness of small [x] icon of the running
cmake task (reduce the timeout of 500 ms into 50 ms).

Fixes: QTCREATORBUG-27518
Change-Id: I15cac3990079ad1cae0bbe22ac2a6e64cfb659a0
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-16 10:30:48 +00:00
Cristian Adam
8d12fd07e2 CMakePM: Rename "Additional CMake parameters" to "... options"
CMake documentation calls them Options, and we should use the same
terminology.

See https://cmake.org/cmake/help/v3.22/manual/cmake.1.html?#options

Change-Id: Ibb8ed9dd5a830290770a7fa89e7e5e1ce2d8c74a
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-02-03 17:46:20 +00:00
Cristian Adam
a0836a29c7 CMakePM: Refactor "Initial Parameters" as a tab bar item
Now we have "Initial Configuration" and "Current Configuration"
as tab bar buttons.

This way the UI can be shared between the two configuration states.

Task-number: QTCREATORBUG-26869
Change-Id: I8206032a2a5ac076629865057816edb99706f2ff
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-01-17 15:23:19 +00:00
Cristian Adam
dfacdbefa8 CMakePM: Add ability to stop CMake run in Settings
Previously the only way to stop the CMake run was to click on "x"
button of the "Configure" progress bar.

Now you can click in Settings on "Stop CMake".

Change-Id: I167b86ba62679f197c194148b122ff0c87e87162
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-07 11:13:54 +00:00
Cristian Adam
0665a9151c CMakePM: Scan files only on CMake configuration failure
The file tree scanner will only be started on CMake configuration
failure to generate the <File System> fall back project node.

Change-Id: I873ef1189fd43dc9bffa03aeafabb00bb3b8b6af
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-01 10:26:37 +00:00
Cristian Adam
d341ab6371 CMakePM: Remove <Headers> virtual project node
CMake projects need to add the headers as source files in order to get
exported from the CMake file-api json export.

Having header files that are not part of the project displayed in the
<Headers> node is error prone and confusing.

This also means that you won't get bogus files when doing git commit
for example.

Fixes: QTCREATORBUG-18206
Fixes: QTCREATORBUG-24609
Fixes: QTCREATORBUG-25407
Change-Id: I89ac4f8a80f452119f8a991b9e4ef14efb7a86b9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-27 12:25:53 +00:00
Cristian Adam
3922b1a917 CMakePM: Add issue icon and tooltip description on project failure
If a project fails to load it will be displayed with a warning icon.

If the CMake configuration fails and the backup configuration is
restored, the project is also marked with a warning icon.

Change-Id: I95ccc5d171f5b789fe317fbb1da9e13dcd81a5dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-23 08:50:24 +00:00
Cristian Adam
36a0151c6d CMakePM: Display <File System> tree node only on failure
Fixes: QTCREATORBUG-25994
Fixes: QTCREATORBUG-25974
Change-Id: I383fe5c28d1f71c8f7939bc9fe4f1f0bf1d6a01b
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-22 09:25:47 +00:00
Eike Ziller
877bfa4056 Add FileSystemWatcher::clear()
Change-Id: I9f28e763c943a6d8c5cf3082755e64d7e4df7155
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-09-15 06:40:38 +00:00
Cristian Adam
27f0dd134f CMakePM: Do not treat generated files as project files
This would trigger an infinite loop.

Fixes: QTCREATORBUG-26207
Fixes: QTCREATORBUG-26204
Fixes: QTCREATORBUG-25346
Fixes: QTCREATORBUG-25995
Fixes: QTCREATORBUG-25183
Fixes: QTCREATORBUG-25512
Change-Id: Iaf081a00dcf318a0ec2708e839e0ab6535e0ef4d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-09-02 08:04:17 +00:00
hjk
3aa324ef1f CMake: Make CMakeConfig a proper class
Looks a bit more "object oriented" in my book.

Change-Id: I6a3b1b4691ec1c7465f652608678e8f31e7e52a7
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 13:25:30 +00:00
hjk
5ead2afeeb Utils: Implement FilePath::removeRecursively
Sprinkle a few QTC_ASSERT to make sure we are in a known
context.

Cmake's FileApiReader uses this before moving directories
as QFile::rename does not do anything if the target exists.

Change-Id: I555f99e81a9fe7d93ae66145eeebfa9d5880bc51
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-29 09:34:28 +00:00
hjk
54b4022987 Utils: Implement FilePath::rename()
And uses it in CMake's fileapi reader.

Change-Id: I9e719aa4b253eaca17c6b304eab5e7268fcfab29
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-28 13:03:32 +00:00
Eike Ziller
9109a6895e CMake: Do not create file system node in main thread
The file system scanning was already in a thread, but creating a tree
from the flat list of file nodes was still done in the main thread.
Creating the tree looks for and creates folder nodes as needed for each
file node, which is not that big of a deal but still takes 1/3 of a
second for the Qt Creator source tree.

Task-number: QTCREATORBUG-25783
Change-Id: I28948ed3ff5233f6fc4b86e93da94d882b81e231
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-23 14:25:08 +00:00
hjk
cf8a05fbec CMake: Use FilePath in FileApi{Reader,Parser}
Helps docker.

Change-Id: I2e1eba61be983340260211bbee6c1bab8a59f883
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-16 07:21:08 +00:00
Eike Ziller
2f7f645983 Merge remote-tracking branch 'origin/4.15'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri

Change-Id: Ibd07b5b5ff7c3282134b062ed28b1c4951061c97
2021-06-11 14:20:21 +02:00
Cristian Adam
7a074608b6 CMakePM: Do not emit error signal in destructor while project is parsed
Do not emit error occurred in the fileapireader destructor
if it's parsing. This will cause the fallback file system view
tree to be generated just before the parsing will be stopped.

This can lead to crashes.

Task-number: QTCREATORBUG-25837
Change-Id: Ic7a2dfc394ed8e259da3366727a3c5fa65d98776
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-06-10 14:29:09 +00:00
Cristian Adam
0e613918b6 CMakePM: Always create build directories
Having two configurations for a project, one in /tmp and one in the
right build directory is confusing and for big projects can take some
time.

Fixes: QTCREATORBUG-25532
Change-Id: Ib0dad267117b3c025d668646ef076b0f77bff166
Reviewed-by: hjk <hjk@qt.io>
2021-06-10 13:42:14 +00:00
hjk
d254cf5845 CMake: Use Utils::FilePath in fileapi parser and reader
It still relies on local host execution in some places.

Change-Id: I36adfeb93ea26b285bbf6da2aee7e0fac64a7d94
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-09 12:15:02 +00:00
Jarek Kobus
150cc88db1 Don't leave m_rootProjectNode in moved-out state
After calling FileApiReader::generateProjectTree(), the
m_rootProjectNode was left in a moved-out state, meaning
that it was in a corrupted state. However, it was still
possible, that later FileApiReader::resetData() was called
for the same instance of FileApiReader, so a call to
m_rootProjectNode.reset() was executed on an invalid object.
This might lead to a crash.

The fix is to use std::exchange instead and we are leaving
the m_rootProjectNode in a valid, default-constructed state.

We do the same for other members, for consistency.

Task-number: QTCREATORBUG-25837
Change-Id: I5812e410d11c8a3fd5a7c9db002d2ef244ae89cd
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-09 11:38:08 +00:00
Eike Ziller
8650e42be8 Merge remote-tracking branch 'origin/4.15'
Change-Id: I07ac7113947cae2e7c3e51b8fa95563fe02b3dc8
2021-06-09 09:03:41 +02:00
hjk
bc2af18a41 CMake: Simplify CMakeProcess::finished signature
The parameters were never used, and start to look alien in the
presence of QtcProcess::result().

Change-Id: Ie2d6a051b439b5e9161d565b84efb78dbe17487f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-06-08 12:38:42 +00:00
Cristian Adam
80d18c1e57 CMakePM: Do backup/restore configuration for all cases
When "Auto create build directories" is not checked, then the first
configuration is done in /tmp, which is covered by workDirectory.

Change-Id: Iad65b4776433ce296bd2561195fcf1bb6f8ace1d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-08 09:35:22 +00:00
Cristian Adam
1b3a4e1fc6 CMakePM: Clear and setup file watcher before and after backup configuration
Qt Creator 4.15 will do a backup of the CMake file-api, but the file watcher
that triggers a reparsing was not cleared up before the backup.

This could lead to unnecesary file-api rescans.

Task-number: QTCREATORBUG-25783
Change-Id: Id91379ea85c8a91e03d952c5c66b0371ebff943f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-08 09:34:00 +00:00