Commit Graph

203 Commits

Author SHA1 Message Date
Marcus Tillmanns
c8024046f9 Docker: implement process interface
Change-Id: I57dd9e060ee35280b663611ebb5ddef20b7d0eb7
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-05-03 08:26:13 +00:00
Jarek Kobus
1a3cb067b8 SshProcessInterface: Give a parent to subobject
This is needed when moving ProcessInterface beweeen threads.

Change-Id: I26158c68bdc8e77ecb3e3d4535ba767ef3d0b63c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-05-03 06:59:36 +00:00
Jarek Kobus
709492ef11 LinuxDevice: Use LinuxProcessImpl for opening terminal
Don't use SshDeviceProcess anymore for opening linux terminal.
Fix running the empty command so that it opens ssh shell.
Don't leak terminal processes on shutdown.

One issue is that terminals are closed when closing settings,
as settings dialog operate on a copy of device, and in case
of no modifications applied the copy is being deleted.
The current workaround is to press the "Apply" button
before closing the settings dialog. This issue is to be
addressed separately.

Change-Id: I3c48b035daf1d099a1e8fa0762a6d6d0eca9592c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-04-29 15:57:20 +00:00
Jarek Kobus
cdae5bdebd LinuxDevice: Don't use SshRemoteProcess for shell
Use simple QtcProcess for it.

Change-Id: Ie73a287cc4bf37a0fba273f3fe355626ff1c27f6
Reviewed-by: hjk <hjk@qt.io>
2022-04-28 15:13:41 +00:00
Jarek Kobus
d1d2477605 LinuxDevice: Restart shell when ssh parameters changed
Change-Id: I96fa7de4f8314ccd3c78bee165b722fdbba6e8d0
Reviewed-by: hjk <hjk@qt.io>
2022-04-28 13:57:08 +00:00
hjk
aa3bdcb427 Utils: Add a QString-based write to QtcProcess
Centralize some boiler plate and warn about best-guessed cases.

Keep the QByteArray based access as writeRaw()

Fixes: QTCREATORBUG-27445
Change-Id: I948d80fba78b36cf85cc73664175ab05eb7707d4
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-04-28 08:20:11 +00:00
Jarek Kobus
8d2c9aa8d4 LinuxDevice: Implement shared ssh connection
Change-Id: I1897f0a468e477e0be61767d4bad0086d59fb075
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-26 17:36:01 +00:00
Jarek Kobus
ec4fb84f8d LinuxDevice: Connect to QtcProcess::done() signal
Instead of connecting to errorOccurred() and finished() signals.

Change-Id: I939927b68e84b32455a914cef26200b4edcbcbb6
Reviewed-by: hjk <hjk@qt.io>
2022-04-14 13:12:52 +00:00
Jarek Kobus
6e666b3bfd Introduce DeviceFileSystemModel
This is going to replace SftpFileSystemModel.

That's needed before planed removal of SshConnection in order
to not to use SftpSession class.

Change-Id: I97f0ffd3418f7e71819ac95048a75e4a17901c71
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-04-08 06:39:28 +00:00
Jarek Kobus
13013acf3a Finish the shell process on shutdown, before deleting it
Change-Id: I62f3754325da9141e5ab870ff4750109a836b092
Reviewed-by: hjk <hjk@qt.io>
2022-03-31 10:26:14 +00:00
Jarek Kobus
c94564d910 LinuxDevice: Get rid of a marker for outputForRunInShell()
Don't rely on a synthetic marker when running a shell
command and expecting any output. The marker might always
be a part of the output data from the running command.
That's unreliable.

A solution is to do a similar thing that we are doing
inside runInShell(). We ignore the error channel there,
so it means that when calling outputForRunInShell() we
have two channels for our purposes. So, the output from
the command we pass through, and its error channel we
redirect to /dev/null. Later, we run "echo $?", which
prints the return code from the last command and we
redirect it to standard error channel. Inside
outputForRunInShell() we read the error channel as long
as we detect something there. We assert if it's being
convertible to int and we also assert that the command
itself succeeded. Afterwards we break the endless loop
and read the output channel for the first time - it
should contain all the output gathered from the running
command.

Change-Id: Ia0ad73623f813ef593c11dff9bdba4df9e524315
Reviewed-by: hjk <hjk@qt.io>
2022-03-21 11:32:31 +00:00
Eike Ziller
b6f679d777 Merge remote-tracking branch 'origin/7.0'
Conflicts:
	src/plugins/webassembly/webassemblytoolchain.cpp

Change-Id: Ia75c783e3ecab1f97de2b5c73a0979c49da82009
2022-03-18 16:07:51 +01:00
Christian Stenger
7012aa621c RemoteLinux: Allow open remote shell from Windows as well
Was originally restricted to UNIX hosts, but works for Windows
as well.

Change-Id: I233ec73760134256723a927de5e9e6cc9aefa8ac
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-03-18 14:39:30 +00:00
Jarek Kobus
481df466e2 Fix FileSystemAccessTest::testFileActions() flakiness
Always add " > /dev/null 2>&1" infix so that the
output of e.g. "rm" command, when failed, is redirected
to dev/null.

Enclose the input data in runInShell() with quotation
marks and escape all the characters in passed data
accordingly. Pass the "-e" option to echo in order to
turn on the escaping mode.

Add a new test for testCreateRemoteFile().

Change-Id: I7db07b57035242279cac7dd77a80ac6dd05bfb1f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2022-03-18 08:36:59 +00:00
Jarek Kobus
4bb4bc2a99 Use ProcessInfo instead of DeviceProcessItem
Remove DeviceProcessItem class.

Change-Id: I2fcac473dc12b47f50c329645f27d60619304e77
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-03-02 09:53:29 +00:00
Jarek Kobus
8af62eb256 DeviceProcess: Minimize the usage of DeviceProcess
DeviceProcess doesn't provide any public API, so
replace all usages of it with QtcProcess.
Keep using DeviceProcess only for reimplementations.

Change-Id: I35a14251a81dd0dde426f56ca2e809b527cc863c
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-28 13:10:42 +00:00
Jarek Kobus
098e3794db Get rid of SshProcess (one process class less)
Introduce static SshRemoteProcess::setupSshEnvironment()
method instead.

Change-Id: I9a49bc68bd96ddf0f58234d28b92a721f7d4bb56
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-21 16:17:31 +00:00
Jarek Kobus
48960b5cfc QtcProcess: Extract QtcProcess specific enums into separate header
Change-Id: Ib3498f189000fd8f5501130c0d280b0f5ae83849
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:51:55 +00:00
Jarek Kobus
97264e0591 Ssh: Drop ProcessMode from c'tors and creator methods
Change-Id: I2db51f26d9a841f60d5ab3722fa82b3a89d57146
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2022-02-18 10:49:29 +00:00
hjk
f7a585fad9 FileUtils: Add some helper to handle ls-style output
Unix-ish device implementations would otherwise repeat that code.

Change-Id: I1265fe1a69e55409ab2875d0b6f6113ec92edd79
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-02-15 08:57:19 +00:00
hjk
95c9579c58 ProjectExplorer: Normalize DeviceProcess::start() signature
Change-Id: I2915be34d4a1eed64567874dcf0263b7583cc142
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-14 15:10:12 +00:00
hjk
e2cb64471a Utils: Move QtcProcess constructor setup data to shared setup data
This includes replacing DeviceProcess terminal handling with base
member.

Change-Id: Id1541bfce33c71dddc71b4816ad0b174dce3879c
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-11 17:33:48 +00:00
hjk
75ef67615d ProjectExplorer: Remove IDeviceFactory::setCanCreate
That's implicit now by using setCreator()

The Android case looks odd as this is (and was) effectively static
information at startup. This will be addressed in a follow-up patch,
for now keep it functionally equivalent.

Change-Id: I4e6082f88dcd21379186340189acb581caef172a
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-04 12:10:07 +00:00
hjk
9ff851a204 Docker/RL: Be more lazy with output decoding
Conversion to QString is often not needed.

Change-Id: I22fe0ec89419f784d2fe02245094fbe6da719f75
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-04 08:35:48 +00:00
hjk
7c128638ea Docker/Linux: Fix outputForRunInShell
... in case there is embedded NUL in the output.

Change-Id: Ic899bcf8d01cceed4ea6e16d4991fb80b7ac70ca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-04 08:35:21 +00:00
Jarek Kobus
f5b946abbe LinuxDevice: Implement runProcess()
Change-Id: I5300d36119ffb9fdd82a2ba7e02f76edc0fe2eda
Reviewed-by: hjk <hjk@qt.io>
2022-02-03 14:20:18 +00:00
hjk
2be0fc2537 ProjectExplorer: Use CommandLine instead of Runnable
Lighter and sufficient for all use cases.

Change-Id: Ic6749a1a9e3e6906ce71b87b237cc94a6d8a4cbf
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-03 10:15:44 +00:00
Christian Kandeler
6993bc7382 Fix various warnings
Change-Id: Iea85f4b890ce7700e8b3632de4656cf848729a36
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-27 10:42:23 +00:00
hjk
4e34921451 ProjectExplorer: Rename DeviceProcess::error to errorOccured
That's what QProcess favors nowadays and QtcProcess uses.

Change-Id: Ie9492ae62f23e35a8a70f72196c3d1b6bc50cbdc
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-01-27 10:12:38 +00:00
hjk
2b6f26dee2 ProjectExplorer: Use a lambda for DeviceFactory::create()
Somewhat slimmer interface on the user code side and follows
existing practice.

Change-Id: I20ed8f5a00591265d32ea9ce93e1f1bbc76d2437
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-26 14:51:09 +00:00
hjk
1fc83d2a56 Utils: Wrap various file system iteration flags and filters
... into a single class.

This makes passing them around as a whole easier, and opens a path
to have "generic" filters in form of a lambda or such.

Change-Id: Ibf644b2fedcf0f1a35258030710afff8f5873f88
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-26 13:13:41 +00:00
Jarek Kobus
8260074c67 Integrate ConsoleProcess into QtcProcess
Change-Id: I8e2b43ef27af6ff279b575a8d43f1ff918562951
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-01-25 08:36:09 +00:00
hjk
f9c97d23c7 Utils: Add optional recursion for file system iteration
Change-Id: Icded897b129aebd7132376cff55717e16dffc040
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-01-18 11:52:29 +00:00
Jarek Kobus
7c91900cfb LinuxDevice: Run test echo command after successful start
After we have started the shell it can happen that
it will finish silently soon due to e.g. ssh server not running.
Before we try to execute any command in the shell we
schedule a test echo command just after successful start
in order to confirm that the shell is running fine.
If waiting for ready read returned false (i.e. the shell
process finished) or if we don't receive the expected
newline character we report a start failure.

Fixes: QTCREATORBUG-26861
Change-Id: I7387b3a366f8e6f4a58745582bb803f5060cfc36
Reviewed-by: hjk <hjk@qt.io>
2022-01-13 14:08:59 +00:00
Jarek Kobus
79ce29b5a1 Simplify RemoteLinuxCheckForFreeDiskSpaceService
Use FilePath::bytesAvailable() on remote device instead.

Change-Id: I2431641ea2f4c090439e0380a378e39aa617540a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-01-11 10:15:36 +00:00
Jarek Kobus
35cde5ddae Introduce IDevice::bytesAvailable()
It's going to replace RemoteLinuxCheckForFreeDiskSpaceService.

Change-Id: If8c30a57b9013387c69412f12102bcd4d41a88b5
Reviewed-by: hjk <hjk@qt.io>
2022-01-05 14:33:50 +00:00
Artem Sokolovskii
aafb5cb9a3 RemoteLinux: Move test actions to special test dir
Change-Id: I9be4a1e7de1ae1accc507109bcf5f3b6188a8925
Reviewed-by: hjk <hjk@qt.io>
2022-01-05 09:57:10 +00:00
hjk
20d19aa5bf RemoteLinux: Implement some of the remote file API
Implementation of remote file API for correct FilePath
work with RemoteLinux.
Added tests for this functionality

Run ssh shell in separate thread.
The linux device instance keeps its own thread for running
SshRemoteProcess. In this way all calls to filepath
interface of linux device coming from different threads
are executed in one thread (SshRemoteProcess is reentrant,
but not thread safe). The redirection to the device thread
is done by invoking SshRemoteProcess' methods through
BlockingQueuedConnection.

Done-by: Artem Sokolovskii
Change-Id: Id8756738d3a4597f175c8ef000c148d0c8536eeb
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-01-04 11:16:14 +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
hjk
52e5023bcc ProjectExplorer: Use Utils::CommandLine in ProjectExplorer::Runnable
Change-Id: Id965f1f9047dcbc3ea5c9ddaa550d12668cf8ae6
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-13 15:04:30 +00:00
hjk
4a42bcd4e8 Utils/ProjectExplorer: Use FilePath for Runnable::workingDirectory
... and in some using code.

Change-Id: I231ea56628908f7d305d13f07eabe8803fe8a791
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-06 12:51:24 +00:00
Eike Ziller
6263a58ef3 Devices: Do not pop up general messages pane
That should only happen on direct user interaction.
Also use new message manager API.

Task-number: QTCREATORBUG-24430
Change-Id: I87297b2ec7191b88210d3a2037afe27b8a3f40e9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-01-06 10:52:08 +00:00
Eike Ziller
3f42c989ee Fix Qt 6 build of ProjectExplorer and targets & build systems
QStringRef is gone.
qsizetype vs int.
QMultiHash::insertMulti is gone.
QXmlStreamWriter writes UTF-8 by default.

Task-number: QTCREATORBUG-24098
Change-Id: Id217e40a1f17993a84fc725976e9cb84618b0580
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-21 11:31:54 +00:00
hjk
2d78bd4b19 Some Qt6 porting
- new ambiguous overloads for mapToGlobal
- some functions now return qsizetype instead of int

Task-number: QTCREATORBUG-24098
Change-Id: I0020e5689e093653e9e0e6f0d6263720bc2e003b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-22 10:22:56 +00:00
hjk
43b658e9e7 Utils: Drop Utils::SkipEmptyParts again
We require Qt 5.14 nowadays.

Change-Id: Iff245257d3cb19207007c0445ee13814e66152dd
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-07-21 12:42:27 +00:00
hjk
430a33dcd9 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-06 06:07:13 +00:00
hjk
1c81a3b3e8 All: Use Utils::SkipEmptyParts
Task-number: QTCREATORBUG-24098
Change-Id: Iab45de9a9c17ddc39a0e343b1175d4f6cb94b098
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-06-17 05:55:25 +00:00
Eike Ziller
5b364de168 Use dialogParent() instead of mainWindow()
There are very few reasons to use mainWindow() directly.
Especially for modal dialogs, using dialogParent() is important, since
that guarantees the stacking order in case of other dialogs currently
being open.

Change-Id: I7ad2c23c5034b43195eb35cfe405932a7ea003e6
Reviewed-by: hjk <hjk@qt.io>
2020-06-02 11:44:53 +00:00
hjk
ed9f4be3ee RemoteLinux: Use a RemoteLinux.SupportsRSync key
... into the Device::extraData map instead of dedicated accessors.

This weakens the compile time dependencies of the RSyncBuildStep,
LinuxDevice, and GenericLinuxDeviceTester at the price of weaker,
local typesafety for one bool value.

Potentially this could go into the direction of re-using bits
of "device feature" discovery and use. Nothing planned, though.

Change-Id: I9aa6dce8066b82d344f64f38707f17416e273957
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-09 11:19:36 +00:00
hjk
d08c0f31c4 De-Q_OBJECT-ify most DeviceFactories
WinRt is the odd one out.

Some were using setObjectName, but only used for debug reasons,
not really needed.

Change-Id: I4a370e4694443bc1c455fda4337ef3acfb9259b8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-01-23 13:32:12 +00:00