Commit Graph

269 Commits

Author SHA1 Message Date
hjk
a2a6073b0c Docker: Use FilePath::from/toVariant to store clangdExecutable
Change-Id: I7e728ab15e9839893f53c068633e9763d6e13d49
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-12-13 07:32:42 +00:00
Marcus Tillmanns
bcfaf00d00 ProjectExplorer: Add clangdExecutable to IDevice
Change-Id: I131212326696887d3a5644a35788f6a522dbee45
Reviewed-by: hjk <hjk@qt.io>
2022-12-09 14:00:19 +00:00
Jarek Kobus
8e7e1dd5f2 Mark some virtual overrides final
These methods are being called from c'tor or from d'tor.
Make sure these methods will not get overridden by any possible
subclass, otherwise these calls won't be dispatched properly.

Change-Id: I3652d2f495940f13b48b494ab2cf06abb3d37e7e
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-12-08 10:21:44 +00:00
Jarek Kobus
c5a60d2dc2 Docker: Pass context object to lambda connections
Remove some unneeded lambda () brackets.

Change-Id: I2fcd83ec2e68a7aeb8f51fa39e7e69cc16e26bc8
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-12-08 09:50:53 +00:00
Marcus Tillmanns
46eccf229c Docker: Add clangd executable option
Change-Id: I93fbd9a7a6b0189ca31cc05b35df9d1636da29a3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-06 12:19:57 +00:00
Marcus Tillmanns
79c2984222 Docker: Make hostname valid for Urls
Change-Id: I026aee70503699fcada30948195a7ebd4c76aeb0
Reviewed-by: hjk <hjk@qt.io>
2022-12-06 12:02:04 +00:00
Marcus Tillmanns
0f4430ca05 Docker: Don't try to mount empty folder
Change-Id: I90479d21dd29a291e7d391464efaf40d6a50b662
Reviewed-by: hjk <hjk@qt.io>
2022-12-06 11:41:17 +00:00
Jarek Kobus
ac966d7bb9 IDevice: Provide default implementation for signalOperation()
Don't repeat implementation returning nullptr in derived classes.

Change-Id: I437f5d206464bf92706cd135d793438f46455ad6
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-11-29 13:34:31 +00:00
Marcus Tillmanns
75b43de14a Docker: Cleanup docker process interface
Instead of creating the actual command in two places
this change moves everything into one function.

Instead of sending the environment and working directory
into the shell as arguments, we send it via the correct
docker exec cli arguments.

Instead of creating QStringLists and adding them
to a CommandLine we directly add them to the
CommandLine instead.

This also fixes an issue when the working directory
contains spaces.

Fixes: QTCREATORBUG-28476
Change-Id: I4f5b39a2dd4c86d20717dbb53003f1eb60f6c089
Reviewed-by: hjk <hjk@qt.io>
2022-11-22 13:17:11 +00:00
Marcus Tillmanns
fb4e22ff7c Docker: Add option to enable flags needed for lldb
Change-Id: Ic0ae6d2b8dcfee3df21c22124c7fc2bddbdb61a2
Reviewed-by: hjk <hjk@qt.io>
2022-11-17 13:03:52 +00:00
hjk
f59ca97a84 Utils: Sanitize FilePath::onDevice()
It's one entry in the FilePath world, so it should start with a QString.

Change-Id: Ib2693f52d56103a4c37ba7361b191c2a5c2a72f8
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-11-17 10:13:05 +00:00
Tim Jenssen
aa33927651 Merge remote-tracking branch 'origin/9.0'
Conflicts:
	src/plugins/qmldesigner/components/componentcore/modelnodeoperations.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertychangesmodel.cpp
	src/plugins/qmldesigner/components/stateseditornew/propertymodel.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.cpp
	src/plugins/qmldesigner/qmldesignerprojectmanager.h

Change-Id: Ib029a830ee99190bc4ea2ad75d9300bfa86b42d9
2022-10-25 19:02:15 +02:00
Jarek Kobus
866a658b42 Get rid of unneeded includes of RunControl
Removed also some other includes that were marked
with yellow triangles. In some cases includes of
runcontrol.h were substituted with other includes,
like qtcassert.h.

Change-Id: Ica40f68198c7f8f70e6047acb2eddc8ef017e43d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-25 09:49:13 +00:00
Marcus Tillmanns
604f542b20 ProjectExplorer: Allow selection of remote build directories
Change-Id: Ieaf0b01bde6d043782d6d9d4bb745c090c6087c1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-24 07:22:05 +00:00
David Schulz
60a8e987b5 Docker: use docker device os type for file access
Change-Id: I3e3e91491c77d0146f2d52777ba1d05d2f45a9d3
Reviewed-by: hjk <hjk@qt.io>
2022-10-18 12:37:50 +00:00
Marcus Tillmanns
7b0b127e90 Docker: Fix deviceshell fallback commandline
Previously the arguments of the target CommandLine were
re-quoted/escaped which is error-prone and not necessary.

Change-Id: I055d159de7860c7cd9549b61104519b8145c4021
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-18 09:58:36 +00:00
Marcus Tillmanns
742f92d246 Docker: Use host.docker.internal
DockerDesktop on Windows and macOS provide the hostname
host.docker.internal to reach the host machine. We use that as its
more likely to work for different setups than trying to figure out
the host ip yourself.

Change-Id: I9f594d0e97e7f35ceb580ac3e3304de999bfea9c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-10-18 05:39:58 +00:00
David Schulz
c7cef250b3 Docker: fix device path mapping
Amends 1fa3255242

Change-Id: Idd2e0916769cd822b97e1fc851d8f706316cca83
Reviewed-by: hjk <hjk@qt.io>
2022-10-17 10:06:52 +00:00
Marcus Tillmanns
a1e960a27c Utils: Fix iterateWithFind
The change of runInShell to take QString + QStringList meant
that the caller was no longer able to fine tune the argument
escaping. This lead to "find -exec ... \;" being escaped incorrectly.

Changing back to CommandLine fixes this.

Change-Id: I55b09bd745c09912a2a0b4e43432824a99c0dd4e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 12:52:03 +00:00
Marcus Tillmanns
22c4e9318a Docker: Remove unused function
Change-Id: I683de49c08411087e47be84265cbab62d4d0738e
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 12:06:41 +00:00
Marcus Tillmanns
359ad56e17 Docker: combine escapeMountPath function
Change-Id: Ib04f8245d2da096a9d9fdbdf9b5243ca80d52bfa
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 09:52:22 +00:00
Marcus Tillmanns
9aa1d56f56 Docker: Fix isValidMountInfo
Improves checking if a requested mount is actually valid.

Change-Id: I37638d26ddd46776e6375481cf1d73ed0ad24210
Reviewed-by: hjk <hjk@qt.io>
2022-10-14 09:49:58 +00:00
hjk
1fa3255242 Utils: Split off file access interface from IDevice
The file accessing functions form now a class hierarchy by themselves,
the devices return a suitable point.

The previous implementation was mildly confusing by the special handling
of the DesktopDevice, fallbacks and remote cases in the same function
leading to unnecessary boilerplate when adding new functions and
codepaths that sometimes passed the FilePath API twice.

Implemented are a "DesktopDeviceFileAccess" taking care of the
previous !needsDevice() branches and a "UnixDeviceFileAccess"
covering the current docker and RL uses.

As a side-effect this unifies to a large degree the current docker
and RL code paths with were occasionally deviating from each other
while they shouldn't.

Change-Id: I4ff59d4be2a07d13e2ca5e9ace26a84160a87c9d
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-10-13 10:38:35 +00:00
hjk
b1471fe61f Utils: Combine some of the iterateWithFind overloads
Change-Id: I668447d0049f2e35cd0c76d2c5708779196167ec
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
2022-10-12 08:59:32 +00:00
Marcus Tillmanns
bcadbe666b Docker: Fix mount arguments
Previously when trying to mount paths that contained spaces or colons
docker create would fail as the -v/--volume syntax does not support
these.

Switching to "--mount" and using the "type=bind" syntax allows to
escape the necessary characters.

Change-Id: If969173505dbf1b36a67dc8b398c58b78941519a
Reviewed-by: hjk <hjk@qt.io>
2022-10-11 12:24:29 +00:00
Marcus Tillmanns
ae58d373b0 Add FSEngine FilePath Cache
To speed up file dialogs we introduce a 1 minute cache for
the FilePathInfo.

A new version of "IDevice::iterateDirectories" allows implementations to
provide the FilePathInfo directly.

DockerDevice implements fetching the filePathInfo during
iterateDirectories which greatly improves the speed again.

Change-Id: I24ac16adb2478cbf16a22012e72fcb8910dcdac5
Reviewed-by: hjk <hjk@qt.io>
2022-10-11 08:53:02 +00:00
hjk
2e38cb6848 Utils: Add an offset parameter to the content writing FilePath function
Use QFile::seek to implement locally and a dd seek based poor man's
implementation on RL and docker.

Change-Id: I241d1c34c00e991845d132ad8edefa1377ba1311
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-10 16:08:28 +00:00
hjk
5dde520a43 Utils: Return a bit more data from DeviceShell::runInShell
Pass on stderr data and exit code to the caller, it's typically
in a better condition to handle errors.

Use it to notify the user about non-available 'find' arguments
and fix the fallback to ls-based operation.

Change-Id: I535535de2ffa09cad1dd6e9b07eb69f807dbae2f
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-10-10 08:39:55 +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
714e6f5c8f Utils: Make more unix find code re-usable
Change-Id: I8fe95158ed77c8f9fb8c86a8e813b5c5de425b8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-07 11:08:52 +00:00
hjk
a234443bee Docker: Use new FileFilter::asFindArguments function
Change-Id: I7a4e02740f27cdb72d3a876985b0941ffedc1ff2
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-10-07 10:58:58 +00:00
hjk
5ff70b6f99 ProjectExplorer: Introduce an IDevice::usableAsBuildDevice
Better approach than whitelisting ids from leaf plugins.

Change-Id: Ida7e23d7ea02eb76d7de4049737f2cb0fad2b9d7
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-30 14:38:47 +00:00
Marcus Tillmanns
34dc092642 Docker: Improve File contents read speed
Change-Id: Ic94715d2c362ac3aa75dabf4f95c74737abd6264
Reviewed-by: hjk <hjk@qt.io>
2022-09-30 12:13:52 +00:00
Eike Ziller
a254a9ba54 Merge remote-tracking branch 'origin/master' into work
Change-Id: I2235a55a599aaeca5d2b5377300a044b66c17da9
2022-09-29 12:03:13 +02:00
Marcus Tillmanns
736f778e6d Dockerdevice: Make sure that container is started
When a QtcProcess is the first thing using a dockerdevice
the container was not started and the call would fail.

Adding updateContainerAccess to withDockerExecCmd
makes sure that the container is started.

Change-Id: I7e05df1aa5e05dc55606970214109b13b142181e
Reviewed-by: hjk <hjk@qt.io>
2022-09-29 07:33:42 +00:00
Marcus Tillmanns
5f62488761 Device: Add prepareForBuild()
Change-Id: I505c4e660838bc94dcdc83ba91ec225910b8f60d
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-09-27 09:19:34 +00:00
Marcus Tillmanns
e42021bb09 DockerDevice: Do not change the containers entrypoint
Some containers may use their entrypoint to setup their environment.
Simply overwriting it from our side would disable such setup and
make the containers useless.

Change-Id: I3385858c49aa8217c3191acdb85343ffd6163cf9
Reviewed-by: hjk <hjk@qt.io>
2022-09-26 09:49:58 +00:00
Marcus Tillmanns
090dfb7ca5 DockerDevice: Fix debug-dumpers not found
Since the dumper path was changed after the first "startContainer"
call, subsequent startContainer calls would set the wrong source
directory.

Change-Id: I6e8304c080b4b55fc67eda0a9544a1b8f34ab7a1
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-26 09:49:44 +00:00
Marcus Tillmanns
33abca1c0b DockerDevice: Implements ensureReachable
Change-Id: I2c479b1cf7a61021f27222e2e936903a9f39e1d8
Reviewed-by: hjk <hjk@qt.io>
2022-09-26 09:49:29 +00:00
Marcus Tillmanns
bf6914a704 Docker: Don't directly access Private data in DockerDevice
Consolidating private data access

Change-Id: I8c8353bdd62606c3b0286d2ffaf3b5e634943b59
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-09-26 09:17:00 +00:00
Eike Ziller
3011548066 Merge remote-tracking branch 'origin/8.0'
Conflicts:
	src/libs/utils/deviceshell.cpp
	src/plugins/clangcodemodel/clangdclient.cpp
	src/plugins/qmldesigner/components/materialbrowser/materialbrowserview.cpp
	src/plugins/remotelinux/linuxdevice.cpp

Change-Id: Idc2edf428c98e9cbc891f1833b271ce2def9a835
2022-09-21 11:16:29 +02:00
Marcus Tillmanns
5ebb467cc6 Deviceshell: Cleanup shellProcess destruction
Change-Id: I71507d9e74979fca461784575257e7bafd1b4838
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-21 08:51:47 +00:00
Marcus Tillmanns
e363f27288 dockerdevice: Only try to kill if pid is valid
Change-Id: I844c8e50437b331925f9baa6862c19208edb4599
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-19 13:49:04 +00:00
hjk
b3200b7730 Utils: Move 'isWindowsHost' test to startsWithDriveLetter callers
"Fixes" one Q_SKIP and makes the implementation OS-agnostic.

FilePath::osType() actually depends on the host system for not fully
qualified file paths, and that doesn't seem to be the right thing to do
in all cases. The caller may actually have more context to decide
whether this is needed (e.g. in pathchooser.cpp in the context of
"return value from a GUI element, i.e. 'host' implied).

Change-Id: Iff80c17094d2deec79d34d0527223fbcf8294935
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-09-19 13:14:58 +00:00
Eike Ziller
e7ddd8a5b7 FilePath: Return optional bytearray from device hooks
For differentiating between "error" and "empty file".

Change-Id: I1806bb7386f5e7db28489f9f7e685648bfc20110
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-09-15 11:28:18 +00:00
Marcus Tillmanns
0cb3459c71 Terminal: Improve error message for start errors
Also fixes an issue where "Open Shell In Container" would fail if
the container has not been started yet.

Previously only "An Error occurred" was displayed to the user if
starting the terminal failed.

With this fix it gives more info about what went wrong, and a
specific error message is created if the openTerminal.py script
is not executable.

Change-Id: I49ae0d9b2aa7d5a27a9b100830b4fdefa5a279b8
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-09-08 05:39:48 +00:00
Marcus Tillmanns
9eef925133 docker: Improve Docker Device Wizard
* Added Sorting of Images
* Added "Double-click to accept"
* Added "disable list until sucessful"
* Added "Show unnamed Images" option
* Added Loading indicator

Change-Id: I9bb822753ffc8af1d2e54f5279a6884cb5c4f1b0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-09-06 10:56:05 +00:00
Marcus Tillmanns
d4e385de06 Deviceshell: Base64 not found fallback
If no base64 is installed on the target, the shell script
cannot work. Previously this would lead to the shell functions
being unavailable.

This change adds a fallback path. In case no base64 is found,
the shell will create a process for each run request instead.

This is much slower than the shell script, but acceptable as
a fallback.

Change-Id: I70591d7e610c4e1c3c258a8e4bef354221d05cb9
Reviewed-by: hjk <hjk@qt.io>
2022-09-01 13:30:46 +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