Commit Graph

152 Commits

Author SHA1 Message Date
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
hjk
88fac2b9c7 CMake: Introduce a helper function
... for the repeated stanza

    setParametersAndRequestParse(BuildDirParameters(this), ...)

Change-Id: Ibb6e8346a786bb9d6905de7facb374f750e561d3
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-05 13:58:06 +00:00
hjk
ebf3144f22 CMake: Shift remaining data to buildsystem
Change-Id: I04518a21ce571399c89608d2e59e746f8e6e0d4a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-05-05 12:10:28 +00:00
hjk
33a385c4d6 CMake: Shift multiconfig storage from build config to build system
Change-Id: I6f9b6c590975caeea4ad92c61f354d81d4d90431
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-05-04 13:35:30 +00:00
hjk
ac488e0529 CMake: Pass BuildSystem instead of BuildConfig to BuildDirParams
Less indirections.

Change-Id: I33ae36aa32aa8fab7223822fd9ec80c64d6d4651
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-02 13:10:33 +00:00
hjk
9a6d8aebe7 CMake: Even less indirection
Change-Id: If9990f81e4150802dd08e0fc17a1faceb32e0cc6
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-04-27 08:54:08 +00:00
hjk
88d148f01f CMake: Move error and warning handling
... from CMakeBuildConfiguration to CMakeBuildSystem.

Less back-and-forth this way.

Also, prefer plain buildConfiguration() over cmakeBuildConfiguration()
back-pointers.

Change-Id: Ie1341302ecc10e53d71ca68b7b6eb5f46cfdad5f
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2022-04-26 16:01:00 +00:00
Eike Ziller
6a1e3f5e6e Merge remote-tracking branch 'origin/7.0'
Change-Id: I95dba3037fe5630cafc3c1e45c579ff18730262c
2022-04-04 11:50:16 +02:00
Cristian Adam
0341f83ad1 CMakePM: Fix disappearing of the CMake settings page
The ProjectExplorer::Task::Error will result in having
m_kitErrorsForProject in targetsettingspanel.cpp which in
TargetItem::updateSubItems() recreates the build settings page.

By reporting the CMake project loading as Task::Warning the above
case is avoided the project build settings page is not
disappearing anymore.

Change-Id: Ib2523e6ea86fe5ad6e4bbee4e101b47cb350a68d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-03-31 16:03:42 +00:00
Leena Miettinen
34ecdc3008 UI text: Replace "pane" with "view" for "Output panes"
Some occurrences of [Output] pane were still found in
translatable strings.

Change-Id: I70c0b6562790b7eb835b2f6a1522fa34fb9c2b51
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-09 15:31:05 +00:00
Eike Ziller
f562ebf239 Mimetypes: Make implementation switchable between new and old
- configure with QTC_USE_NEW_MIMEDATABASE to switch to the new one in
  utils/mimetypes2/
- added utils/mimeutils.h header for the Qt Creator specific static
  wrappers, that also includes the "public" headers for MimeType et al
  from the new or old implementation, depending on configuration
- change all utils/mimetypes/ includes to utils/mimeutils.h
- move the implementation for the wrappers to
  utils/mimetypes(2)/mimeutils.cpp
- also move the MimeDatabase declaration in the "old" implementation
  back to utils/mimetypes/mimedatabase.h

Change-Id: Ie8de229c035d6cd9a5e4739dc0fa78d9c17228e3
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-25 07:19:58 +00:00
Cristian Adam
a204ad3236 CMakePM: Do not reconfigure project on KitUpdated
Initial Configuration will get the updated kit values and it's
up to the user to react.

The reconfiguration doesn't help at all, since none of
the variables / options ends up in the Current Configuration.

Change-Id: I5ee75fce1a33ce30a011ce6f1b6399fd79727ca6
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-10 11:08:26 +00:00
Jarek Kobus
d6f56254d1 Get rid of QtcProcess::workingDirectory() overload
Adapt all callers' code so that it passes the FilePath
instead of QString. As a consequence introduce
TemporaryDirectory::masterDirectoryFilePath() and use
it where easily possible.

Change-Id: I14564949b3b916921e32a2957c84c03d1da43af2
Reviewed-by: hjk <hjk@qt.io>
2022-01-18 17:18:34 +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
Eike Ziller
eba4115b82 Merge remote-tracking branch 'origin/6.0'
Change-Id: I3bab4e31bc5993c59c7025ebde0846bf6c75810e
2021-11-19 10:44:15 +01:00
Jonathan Mouchou
6efcd09063 Android: Fix AndroidManifest wizard invalid package source dir
Fix the wizard from inserting the filename for the file path leading to
an invalid directory.

Example invalid path: /projectpath/projectname/projectname.pro/android
With fixed path: /projectpath/projectname/android

Fixes: QTCREATORBUG-26580
Change-Id: If82a6f795ca400beddc26b959e65ea066ad79433
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2021-11-15 18:41:58 +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
39b36bf773 Remove unneeded terminating of failed process
Since we employ QtcProcess, the reaping of possibly
running process is done internally by QtcProcess already.

Change-Id: Ie65314a4aecf5bb1808b0f2c46a50503d82fd6fb
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-10-19 12:57:35 +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
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
David Schulz
7acb8e90f3 CMake: create generated file paths without QDir::cleanPath
Change-Id: I49913032fb95aff8357da7aa077eabd5907d53ca
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-09-14 05:07:52 +00:00
David Schulz
3369948b1a CMake: use FilePaths to generate relative source entries
Change-Id: I5df67517e269d650166f72a625e5835e780fca9d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-09-14 05:07:46 +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
hjk
bdefc13eba Utils: Rename FilePath::absolutePath(FilePath) to resolvePath
There was already a similar function taking a QString.

After that, the remaining no-argument version of absolutePath()
can be deprecated.

Change-Id: I5b9ad8c8b68a5723891b0aa9f5a37e90db0fe09e
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-09 05:42:30 +00:00
Jarek Kobus
ace765c199 Move ProcessReaper into lib/utils
Reuse ProcessReaper inside process launcher.
Automatically reap all internal QProcesses of QtcProcess
(either direct child of QtcProcess in QProcessImpl
or indirectly inside process launcher).
Make ProcessReaper work again on QProcess instead of on
QtcProcess, so it may still be reused for non-QtcProcesses.

Change-Id: I950cac5cec28f17ae97fe474d6a4e48c01d6aaa2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-09-06 21:28:19 +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
hjk
7c28c4f744 Utils: Introduce a FilePath constructor from char arrays
Similar to QT_RESTRICTED_CAST_FROM_ASCII to avoid the need for
decorations in user code.

At the same time, drop some convenience constructors and functions
in CommandLine and Icon essentially serving the same purpose.

Change-Id: Ida4e5ac19c2da0a4298a97b2a8e1511d56bbb79d
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-17 05:34:10 +00:00
Eike Ziller
ab606faad2 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/android/createandroidmanifestwizard.cpp

Change-Id: Ibd06a254f52c2c96d8c6ddd6b1d27483fcc29a17
2021-08-16 10:51:50 +02:00
hjk
1afea827bb Don't try to add absolute paths with FilePath::pathAppended()
Change-Id: Ib4cc5cacb33679e4ed8d7aec24b6392c2e000b60
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-08-13 14:29:09 +00:00
Jarek Kobus
03c68e3840 Use QtcProcess inside CMakeBuildSystem::runCTest()
Change-Id: Ica83a8f43b34e21c379326e8dbd51d009dd2fd44
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 14:52:54 +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
Cristian Adam
366b4c0199 CMakePM: Consider all the missing expandable CMake variables
CMAKE_PREFIX_PATH and CMAKE_FIND_ROOT_PATH can have multiple
values, and now all the values are taken into account.

Ammends e1a68f2598 which had only
one value with all the items separated by semicolon.

Change-Id: I88d98fbbf165e7e61d70ab4a4e84eb4de4cc9f82
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2021-07-21 09:53:50 +00:00
hjk
3b779fb8dd CMakeProjectManager: Use "cooked types" in DirectoryData
Less conversions cycles at the price of a few more temporary bytes.

Change-Id: Ibda82e02d7b83944f5db38ac7cf75c4bae4f55ec
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2021-07-21 06:25:06 +00:00
Cristian Adam
e1a68f2598 CMakePM: Better path comparison for missing expandable CMake variables
Amends 2d8cd0c90c

Change-Id: I2192dfdd7624917e07a2a1cbda9fc5867add7ab5
Reviewed-by: hjk <hjk@qt.io>
2021-07-19 09:44:01 +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
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
92904480f0 Utils: Merge FileUtils::removeRecursively() into FilePath
This simplify the interface by removing a possibly wrong choice
ensures it works also on remote paths.

Change-Id: I01e198958900a91b99dcf2dbb491a593485493ba
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-02 04:57:24 +00:00
Cristian Adam
2d8cd0c90c CMakePM: Update missing expandable CMake variables at project load
The following variables:
    "CMAKE_C_COMPILER",
    "CMAKE_CXX_COMPILER",
    "QT_QMAKE_EXECUTABLE",
    "QT_HOST_PATH",
    "CMAKE_PREFIX_PATH",
    "CMAKE_FIND_ROOT_PATH",
    "CMAKE_PROJECT_INCLUDE_BEFORE",
    "CMAKE_TOOLCHAIN_FILE"

will be checked to see if the existing values have the same values
from the initial cmake parameters list.

Only the CMakeCache.txt values that do not exist on the file system
will be updated.

If not, the updated value will be presented in the dialog for upgrade,
or marked as bold in the settings dialog.

CMAKE_PROJECT_INCLUDE_BEFORE is dependent on Qt Creator version / path
and needs to be updated.

Fixes: QTCREATORBUG-24443
Change-Id: I1eeb44df3a7914051084ef405af5f5621cc5a4e2
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-30 14:36:41 +00:00
Christian Stenger
7fd4691a7a CMakePM: Try to improve file information for ctest
The ctest information regarding the test case itself cannot be as
adequate as the information coming from the code model.
Nevertheless depending on the used mechanism we might end up in
places that will not be helpful when using the test tree to open
files of ctest. Try to get closer to the real declaration source
if we can.

Change-Id: Ia9d217f0cdc6de6230d89dd342b60856cf1312b8
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-30 09:48:45 +00:00
Cristian Adam
f8a77287bf CMakePM: Add support for qtc_runnable feature
This will allow for the Qt Creator's CMake build only qtcreator
target to be selected as runnable.

Similar to qmake's qtc_runnable or Qbs's qtcRunnable features.

Fixes: QTCREATORBUG-25908
Change-Id: I6416873d0ad9cfec4960d98fc4b289ec98cc58b1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-25 14:24:41 +00:00
Christian Kandeler
b1837036b3 Fix some warnings about unused lambda captures
Change-Id: Icfb1b963b3c55656c760497e4ae3ece2bdccbbc7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-06-24 12:07:31 +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