Commit Graph

295 Commits

Author SHA1 Message Date
Cristian Adam
71b3c6950f CMakePM: Parse the CMake file before adding new / existing files
This way the functionality would work even if autorun CMake is disabled.

Change-Id: I54ab47d72664cb42486b260b895f58d37a885cce
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-05-03 12:17:57 +00:00
Cristian Adam
874b1133d9 CMakePM: Allow file rename / remove via variables
Lookup any variables found in the target definition function in order to
find the source files.

This works for something like this:

  set(SOURCE_FILES myfile.cpp)
  add_executable(myexe ${SOURCE_FILES})

Change-Id: I8a47ea64b4efa467074f03ed5e1d1d05b2b1bf00
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 19:04:39 +00:00
Cristian Adam
5c2b2966e7 CMakePM: Enable "Add Existing Directory"
This works via "addFiles" and it's supported.

Change-Id: I18d193878c9549581a77d74fd8eb9761c4b08271
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-02 19:04:15 +00:00
Cristian Adam
411b2e05b8 CMakePM: Allow project files to be removed in project view
Removal of a project file is done as a rename with an empty filename.

Fixes: QTCREATORBUG-25922
Change-Id: I4443d4a31723eb1ac93f02bad633bcfaf99a9573
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-04-25 09:22:40 +00:00
Cristian Adam
54af6bd5b3 CMakePM: Allow files to be renamed in project view
This includes both with source files explicitly specified or
resulted from a file(GLOB|GLOB_RECOURSE) call.

Fixes: QTCREATORBUG-27538
Change-Id: I5ee113af168bdb8cd0a96e8ab2ae603c0607fb0b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-25 09:22:08 +00:00
Cristian Adam
039baab6e7 CMakePM: Add new / existing files for QtQuick projects
Fixes: QTCREATORBUG-28904
Fixes: QTCREATORBUG-28985
Change-Id: Id05f13cc69b8afffafba1b956ee1c90dc88c6d57
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-04-20 17:28:14 +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
Cristian Adam
9f6209a228 CMakePM: Do not check for changes for CMAKE_PROJECT_INCLUDE_BEFORE
This was the case previously when the path was tied to the Qt Creator
version.

This fixes the docker case when the expanded value gets replaced with
the unexpanded value from the initial configuration.

Change-Id: If005d410bc4408403fd79fa619c58217a499d3a5
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-04-05 07:53:29 +00:00
Marcus Tillmanns
ca0bee902f ProjectExplorer: Create BuildDirectory on device
The BuildDirectory is now assumed to be on the build device.

The default build directory template path is resolved against the
project path mapped to the build directory.

Change-Id: Ie1d147d135e9e551f2ac46cbec583374d524d2d7
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-04-04 12:17:49 +00:00
hjk
305ccfe259 Utils: Replace FilePath::onDevice() by new FilePath::withMappedPath()
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).

Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.

Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 06:56:55 +00:00
hjk
242d19c19d CMakeProjectManager: Give some hints why deployment data looks wrong
Change-Id: If42b32ca80f4144b86ff882e0db243ba9f0f5cbf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-03 14:39:36 +00:00
hjk
2704f8ff0b ProjectExplorer: Proliferate FilePath a bit
Change-Id: Ia671a1de17b9e58764375c5f64cc47b053b0725a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-03-15 09:57:02 +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
Cristian Adam
a6ccfb09e5 CMakePM: Copy auto package-manager to ${buildDir}/.qtc/ directory
By copying the ${IDE:ResourcePath}/package-manager to
${buildDir}/.qtc/ the problem with hardcoding paths
to old an Qt Creator version can no longer occur.

This also fixes the issue with remote projects by reffering
to the code residing on the host.

With the above issues fixed, enable "Package manager auto setup"
by default.

Change-Id: Ia49654a3b9059f83886e64d065019b2d55e9299c
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2023-02-08 16:17:49 +00:00
hjk
239f79fbec CMake: Use FilePath functionality to extract qml module files
Shorter and remote-capable.

Change-Id: If6b3a419eb78da2c2763bc45f4d1e33be7dbed17
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-02-08 11:22:57 +00:00
hjk
8a8b50e8b5 ProjectExplorer: Proliferate Utils::FilePath use
Move the .toString() uses into  DeploymentData::addFilesFromDeploymentFile

Change-Id: Ic9ef22da1918ca105c92f0231960dab27b0d80bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-02-08 08:21:29 +00:00
Christian Stenger
37a86061d8 CMakePM: Adapt to change in FilePath
Silences some soft asserts.

Change-Id: I4e39b66983552d85650062a3e8748e91936e8174
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-02-06 05:25:54 +00:00
Orgad Shaneh
092209fa84 CMake: Fix potential null deref
Reported by Coverity.

Looks like it cannot really happen in real life though.

Change-Id: I92e09dbe7dc81e694e5450c598c649c956eb7fcc
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2023-02-01 13:54:43 +00:00
Christian Kandeler
97976fd3cb ProjectExplorer: Refactor BuildSystem::extraCompilerForSource
Factor out backend into more generic function to easily support new
accessors.
No functional changes.

Change-Id: I715ce2842d2c63574bdf6ada0d0e32fbfd5d08fb
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-27 12:42:23 +00:00
Christian Kandeler
0d909c353c Designer: Update C++ code model on an object name change in designer
We try to locate the old symbol name in the generated ui header and
rename the symbol in the background.

Task-number: QTCREATORBUG-1179
Change-Id: Iaf68e3922cd728cbc87d0dc97125e34b8bdaa6be
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: David Schulz <david.schulz@qt.io>
2023-01-27 10:02:52 +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
Jarek Kobus
bad66c1fc2 CMakeBuildSystem: Run ctest process asynchronously in main thread
Instead of running it in other thread using blocking interface.

Amends 675a72e296

Change-Id: Ia4c7701fa4cd9efea4aeccd979dfb8cde28a889e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-18 13:33:25 +00:00
Jarek Kobus
1e10161bf2 CppProjectUpdater: Reuse TaskTree
Change-Id: I7474e5a31d169bf435d94536cffd77d218320977
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-01-11 16:32:12 +00:00
hjk
4ddd28ae22 Utils: Rename QtcProcess::readAllStandard* to readAllRawStandard*
... and re-use the old QtcProcess::readAllStandard* names for
a QString-returning 'decoded' version.

For now, only use that in 'full Utf8' cases, to stay bug-compatible,
the plan is, however, to employ the QTextCodecs we have already
in the channel buffers. That will be one-by-one, though.

Change-Id: Id209e0671920d4ea4197918e872f441254112d52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-10 12:08:53 +00:00
Christian Kandeler
ca4af940b1 CMakeProjectManager: Provide generators
Task-number: QTCREATORBUG-28149
Change-Id: Iaebc04d729ccb3ec14496ae74ca6aa3d9aca8bac
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2023-01-10 08:47:10 +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
d0e24654f6 CMakeProjectManager: Pass context object to lambda connections
Remove some unneeded lambda () brackets.
Remove some unneeded lambda return type specifiers.

Change-Id: I9695367d66a151f2611554b9fe5897c1bac7ef5c
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-08 15:28:50 +00:00
hjk
7e9d50a2c9 Remove a few now-unnecessary cleanPath in conjunction with resolvePath
Change-Id: I05ee0116183a30e907fbd8e0b4faae9e6e58723d
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-11-30 13:32:05 +00:00
hjk
7fd3a5e66e CMake: Use FilePath::suffix() instead of manual construction
Change-Id: Id2bc542047ce5f4ff1937be90b976d330b69c51a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-11-25 06:53:20 +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
hjk
4266f612e6 Utils: Rename FilePath::relativePath() to relativePathFrom()
Hopefully less confusion about the direction.

Change-Id: I61727d6c4d19e0dfe46f24ff24f5d90f9835d05c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-18 13:41:24 +00:00
hjk
ec430787e5 CMake: More FilePath in Deployment data
Change-Id: I898a621a34558a28d4688a33aeb9bb9148df6901
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-10-14 13:01:15 +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
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
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
Marcus Tillmanns
df859d891d Filepath: Add ::isSameDevice
Change-Id: I3990429b59759d5f72ed95e3a0d1723d3bb7bb82
Reviewed-by: hjk <hjk@qt.io>
2022-09-20 10:11:33 +00:00
Marcus Tillmanns
dabd9a175e CMake: Make sure source/build directories are reachable
Change-Id: Iea4547807b3a59eb9a8cb70d51d9015dbc8013e3
Reviewed-by: hjk <hjk@qt.io>
2022-09-19 12:16:54 +00:00
Marcus Tillmanns
d956ddee71 CMake: Use correct CTest binary if cmake is remote
Change-Id: Ic0ad52a754ccd39bca2e406a324f9e27ec9bc9bd
Reviewed-by: hjk <hjk@qt.io>
2022-09-08 11:48:37 +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
aed29ad8c3 Core: Remove #include <QMainWindow> from icore.h
Adapt users; also use dialogParent() instead of mainWindow() were
appropriate.

Change-Id: Ib60b118f05c986a70657446c5b2937074243bb5c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-07-22 14:11:46 +00:00
Yasser Grimes
0bb272d411 McuSupport: Use System header paths in module mappings
Previously only HeaderPathType::User was allowed for mappings when the
headers and qml files are joined (the case for Qul), but "Qul QtQuick
include" is of type HeaderPathType::System causing the import not found
error in QTCREATORBUG-26751

Task-number: QTCREATORBUG-26751
Change-Id: Ie40ad32c77bb00ad2c01fd1ae28330669db1e785
Reviewed-by: Piotr Mućko <piotr.mucko@qt.io>
Reviewed-by: Dawid Śliwa <dawid.sliwa@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-07-13 16:12:51 +00:00
Jarek Kobus
8a37019b3b CMakeBuildSystem: Get rid of call to waitForStarted()
This is unneeded when followed by waitForFinished().

Change-Id: Ia30161da73ea877ba8973903a391100f29be8410
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-07-04 12:40:25 +00:00
Cristian Adam
175a61ad1b CMakePM: Better error message for no CMake present case
Currently if no CMake has been registered and a CMake project has been
openend the user will get the error:
"CMake version  is unsupported. Update to version 3.14 (with file-api)
or later."

With this patch the user will get the error:
"The kit needs to define a CMake tool to parse this project."

Change-Id: I555884fff1eac321052998d1ef7970a49b2f44af
Reviewed-by: hjk <hjk@qt.io>
2022-06-29 09:40:44 +00:00
hjk
f974488128 ProjectExplorer: Move makeInstallCommand()
... from Project to BuildSystem.

More direct and less use of Target::activeBuildConfiguration().

Change-Id: I148381d23be0f9ab0750ed1440e1b2b3e25aded0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-06-13 10:22:40 +00:00
Eike Ziller
3cd476e582 CMakeBuildSystem: Remove some left-overs
From removing the "first build in temporary directory" mechanics.

The method that would previously switch the build directory from
temporary to real now just ensures that the build directory exists and
passes the input build directory through. Name it encordingly and remove
the confusing return value.

Remove condition that now was always true.

Amends 0e613918b6

Change-Id: I8d4cff23b3fcba895bc7338e7277d44efb46e8e7
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-23 07:13:06 +00:00
Artem Sokolovskii
c23aa1c656 CmakeProjectManager: Remove foreach / Q_FOREACH usage
Task-number: QTCREATORBUG-27464
Change-Id: Iabe3a621efa56282bf1511f540c98fdf5d8da270
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-20 12:55:20 +00:00
Eike Ziller
6a296ab68a Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/qmlprojectmanager/qmlprojectplugin.cpp

Change-Id: I14030f58303839e706af892dd12a67566e3bed68
2022-05-18 13:35:47 +02:00
Cristian Adam
6b781b4fe9 CMakePM: Fix crash when file system progress bar was cancelled
If the user cancelled the file system progress bar, the the
m_allFiles will be null and shouldn't be used.

Fixes: QTCREATORBUG-27499
Change-Id: I92c509f1e66d0968f921ec103fd81631eed9ab38
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-05-10 11:38:07 +00:00
hjk
ba97c741c8 CMake: Replace parseCMakeCacheDotTxt() function
... by direct use of  CMakeConfig::fromFile(). It was only duplicating
checks that are done on the user side already.

Change-Id: Iaf5e89c924c2b0a9080db9fe160970bbf6e33154
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-05 16:12:41 +00:00