Commit Graph

122 Commits

Author SHA1 Message Date
hjk
d75005fbd2 Docker: Use mapToDevicePath() in startContainer()
Change-Id: Iad91144413a176bee036e03192713f5bf4695dcb
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-12 11:24:38 +00:00
hjk
34b42a4772 Utils: Introduce FilePath::mapTo{Device,Global}Path
Re-directing via IDevice::mapTo{Device,Global}Path

Change-Id: Ica957839479967790bbd93e90eced66aa0b122a8
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-12 11:24:29 +00:00
hjk
033d2c5cc3 Docker: create container before running image
Change-Id: Iea4a4ec446a2df6fc299be24615bca605fca83e9
Reviewed-by: hjk <hjk@qt.io>
2021-10-07 08:41:41 +00:00
David Schulz
704a758f69 Docker: use PathListEditor for mounts
Change-Id: I5ed0ebf5ecdad17c1800f15906063d3413307da3
Reviewed-by: hjk <hjk@qt.io>
2021-10-06 09:57:02 +00:00
David Schulz
0f480cee70 Docker: allow windows style paths in settings
Makes sure to convert it to unix style path on the target and use the
correct capitalisation on the host

Change-Id: I0c6dff47c34c1844a8198c3215ea857fdb6375c7
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-10-06 09:56:53 +00:00
Christian Stenger
b7815a4187 Docker: Use shell if possible
Using the shell for short running processes that do not
modify the container environment is recommended as it
avoids starting up another process.

Change-Id: I32a1f348bfa56ee4094599cff1af17525a6d2a98
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-06 07:26:47 +00:00
hjk
7a20a8e70a Docker: Split early return in tryCreateLocalFileAccess()
For easier debugging.

Change-Id: I427ec3ce10b3eae50a3fa67d5bba9951e9de4c14
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-30 10:04:24 +00:00
Eike Ziller
19abb9f877 Merge remote-tracking branch 'origin/6.0'
Change-Id: I9d25a7ac39b3619856fc8d8a6be6f91a403b3969
2021-09-30 09:03:12 +02:00
hjk
bb9bfa1cd4 ProjectExplorer: Allow devices to report tasks in validate
And use it to report a hard error when docker devices don't have
a shared directory set. While this is possibly too harsh in the
long run it fits the current situation where we want to use the
container for building projects.

Change-Id: I1430716b5722fba537bb964463ce25c7001be6a4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-29 13:09:38 +00:00
David Schulz
958ce4f308 Docker: assert and return false if runInShell fails
Change-Id: I0e285e84db1b5442fb4b761597d25e798ac4e94f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-29 08:28:20 +00:00
David Schulz
82b250d901 Docker: add option to disable file path mapping
Can be used to easily reproduce the current windows state that has no
way to map the remote file system to a local path on other systems like
linux.

Change-Id: I32cd1852dd0b4fc0890a503c244f34065c29e18c
Reviewed-by: hjk <hjk@qt.io>
2021-09-24 04:23:06 +00:00
hjk
478ce99942 Docker: Don't try to re-start running container
Change-Id: If8594ce467c44be7a67aa2a7e783028306731af1
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-23 06:10:05 +00:00
hjk
1e18678383 Docker: Extend log messages
Add some indication which container the log messages belong to.

Change-Id: Iafdc7f9c77e58649f2922aefd2a109cf17db78ff
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-23 05:30:17 +00:00
hjk
9c66b493e1 Docker: Add some more information why certain operations fail
Change-Id: I7f561fbf089fff5ba0151f72789aad4c216b15fe
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-23 05:03:05 +00:00
Christian Stenger
f2c501a5bf Docker: Tweak handling of DISPLAY
Passing the DISPLAY variable differently on Windows allows to
even run a gui application on the docker image if there is an
XServer (e.g. vcxsrv) running on the Windows host that can be used.

Change-Id: I36f849c4efc6e53ef92fcea96b4b256fd92a01c6
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-22 12:53:29 +00:00
hjk
a16144b89d Docker: Override entrypoints when starting our shell
Some images have convenience entrypoints set, these get into the way
when we want to run a shell deterministically.

Change-Id: Ifedb9924456b80a9a3cdca64b5431c457b052f1a
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-09-22 08:13:30 +00:00
Christian Stenger
64e438ed83 Docker: Implement directoryEntries alternative
Use 'find' on a docker image to search for diretory entries
if it is available.
If the find call fails we still may fallback to using 'ls'.
This silences currently active soft asserts regarding the
usage of sort or file filters when we are able to use 'find'.
Only support the most common and currently used options and
bark if some unsupported option is in use.

Task-number: QTCREATORBUG-26258
Change-Id: I9a082ea7aca1b6db7dcb668cfe40ed0ed48cd567
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-09-16 06:18:59 +00:00
Eike Ziller
3d4d7c7e14 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/clangtools/clangtoolssettings.cpp
	src/plugins/clangtools/executableinfo.cpp
	src/plugins/clangtools/executableinfo.h

Change-Id: Id8caf63e3e594792467d3447870086bd2d8f73b9
2021-09-13 17:03:55 +02:00
David Schulz
0caa8cbd60 Docker: reset process working directory if it needs a device
Change-Id: Ided00a328279b7b82814dcbb79434063ed7ec5f6
Reviewed-by: hjk <hjk@qt.io>
2021-09-13 12:00:20 +00:00
Christian Stenger
4ed03777d3 Docker: Fix condition
Change-Id: I28c845ebd5a04e13cb109af03f6094306da64394
Reviewed-by: hjk <hjk@qt.io>
2021-09-09 09:52:13 +00:00
hjk
bbe506d29b Docker: Show error when container environment retrieval failed
Change-Id: I2e2226493969e322c9dab44ceb5106b1a207369b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
2021-08-25 05:38:54 +00:00
hjk
20a63d6c7e Utils: Drop OsType parameter from CommandLine functions
The type is implicitly given by the command's executble FilePath.

Also, rename the rarely used addArgs(const CommandLine &) overload
to addCommandLineAsArgs() and make it strip scheme and host from
the wrapped executable as there are no uses expected where keeping
them would be the right thing.

Change-Id: Id0b76778e7e01ac16e477f36bf30bb28d96bb177
Reviewed-by: Artem Sokolovskii <artem.sokolovskii@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-24 07:36:04 +00:00
hjk
3d920bc000 Docker: Fix shell running
Change-Id: I07822296ca1b4ec9e571aac29c79de58425a62a0
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2021-08-19 08:52:49 +00:00
hjk
27708158db Utils: Introduce FilePath::setPermission()
And implement it for the direct access docker case.

Change-Id: I5c91402630a5b010fdbcaab96c435f66a36f2e3e
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-18 12:25:44 +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
Eike Ziller
c7168d1063 Merge remote-tracking branch 'origin/5.0'
Conflicts:
	src/plugins/coreplugin/locator/executefilter.cpp

Change-Id: Iff5b82a9e491b782e4720138904f389d318b005c
2021-08-11 10:10:51 +02:00
Christian Stenger
f95d6c6009 Docker: Handle daemon globally
The daemon state is not a device dependent setting.

Change-Id: Ic972fdc5cbb06395e04709858312b4d336321577
Reviewed-by: hjk <hjk@qt.io>
2021-08-11 06:37:59 +00:00
Jarek Kobus
d22505c41f Use refactored ProcessMode
This patch needs to be applied together with the parent change.

There are 3 basic cases:
1. The user doesn't write anything to the write channel:
   You don't need to call closeWriteChannel manually anymore.
   By default the QtcProcess you create is in ProcessMode::Reader mode.
   Internally it opens the process in ReadOnly mode and
   closes the write channel just after starting.
2. The user writes some initial data (after being started)
   and then closes the write channel:
   All what is needed now it to set the write data
   (QtcProcess::setWriteData) before calling start.
   You also use the default ProcessMode::Reader mode.
   Internally it opens the process in ReadWrite mode
   and writes the writeData asynchonously when the process
   already started. After writing the data it closes the
   write channel automatically.
3. The user writes the data also after calling start.
   All you need now is to create a process with
   ProcessMode::Writer mode. In this mode the write
   channel is not closed.
   Internally it opens the process in ReadWrite mode
   as some writers also read the data from the process.

All the code base is adapted here to the above rules.

Change-Id: Id103019d1d71a3012fd1eade226fe96b9aaa48c2
Reviewed-by: hjk <hjk@qt.io>
2021-08-09 07:51:31 +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
Christian Stenger
bf93998fb4 Docker: Fix filtering without a filter
If there is no filter accept all instead of nothing.
Fixes e.g. ABI detection on docker image running
on Windows.

Change-Id: I17588f71018952b1087b5b8f700b6c158bf5b89d
Reviewed-by: hjk <hjk@qt.io>
2021-08-05 13:35:26 +00:00
hjk
91d3d83eab Docker: Implement DockerDevice::permissions()
Change-Id: Ib2daf4a631c5c1bf851720b7094f027ce11dd3e0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-08-03 11:44:26 +00:00
Orgad Shaneh
69c6c9f7d5 Merge remote-tracking branch 'origin/5.0'
Change-Id: I4ea793c0b2d1980e5ed79bcc985c0f26a4de7aa4
2021-07-29 16:03:09 +03:00
hjk
b3af1ccd4c Docker: Move container start into function of its own
Change-Id: Id83345895fd2e1e6668def91d8bb3fe39eca4f8c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-29 08:29:48 +00:00
Orgad Shaneh
61008441da Merge remote-tracking branch 'origin/5.0'
Change-Id: I9aa7b7a6490e8fb592a0e785a57128d438fdbab5
2021-07-27 11:39:29 +03:00
hjk
764bf7396c Utils: Introduce FilePath::fileSize()
And implement it locally and for docker.

Change-Id: I362f4cae95560836d9300473a286429eb4569329
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-07-27 08:19:43 +00:00
Christian Stenger
b8bcdd9568 Docker: Correct environment for docker exec calls
Provide way to clean QtcProcess environment which is needed as
e.g. toolchains, build tools, and debugger otherwise run
inside a wrong environment when using docker exec for the
respective process calls.

Change-Id: Ia6de1c90f2134fce260d293a2f6937ab3cfca2ce
Reviewed-by: hjk <hjk@qt.io>
2021-07-23 11:55:27 +00:00
Christian Stenger
a0da3ce69f Utils: Move filterEntriesHelper() out of FilePath
Currently only used inside DockerDevice and it fails to build
when building sdktool with old Qt which is still necessary.

Change-Id: Ic48414f0cb8f0955e7561f7484e3ea1c726c816a
Reviewed-by: hjk <hjk@qt.io>
2021-07-22 12:49:45 +00:00
Christian Stenger
dfb0edf4ce Docker: Fix logic and Qt6 build
Change-Id: I3f0ec2cc86f48578e9dcd2ebfaa685cc577141c3
Reviewed-by: hjk <hjk@qt.io>
2021-07-22 08:46:52 +00:00
hjk
41355d7cd7 Docker: Implement DockerDevice::writeFileContents()
Change-Id: I686eb6da5ec0a59da3b8c5e32e1ff2f9fa9621b2
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 12:54:28 +00:00
hjk
2dafeadd0c Docker: Enable DockerDevice::removeRecursively()
With some half-baked sanity checks.

Change-Id: Ic3b9977f2bb8218105c5b7dba26df5cb933840c6
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 11:11:00 +00:00
hjk
8c1edf2be8 Docker: Juggle messages on the Daemon state button around
Change-Id: I64cef2458e475a8edd796d6a7ca5f3feb8bd0ac0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 10:26:33 +00:00
Christian Stenger
4895eb346a Docker: Implement symLinkTarget() for non-local access
Change-Id: I895d7e190a556ee582e7c767e7045362e9a7adce
Reviewed-by: hjk <hjk@qt.io>
2021-07-21 10:16:27 +00:00
Christian Stenger
9e015dbaf7 Docker: Let some commands run inside shell
If there is no local access for the docker container we
create lots of explicit docker calls which take time
to be created and executed as this always fires up
another connection to the container.
Currently we expect the container to have a shell and
we already have it in place, so re-use the shell to
execute at least a couple of commands.
This heavily increases the performance of these commands.

Change-Id: Ic778a250a2b3b8c5ce2a8dd6b7fa8c532bc6d4bf
Reviewed-by: hjk <hjk@qt.io>
2021-07-21 10:16:13 +00:00
Christian Stenger
7ef50ec70c Docker: Use shell to exit container
..and only fallback to calling docker command if this
fails.

Change-Id: I854499f7df8605ffe444c43bc6d1dc0155183627
Reviewed-by: hjk <hjk@qt.io>
2021-07-21 07:39:19 +00:00
hjk
cb23530798 Docker: Add a button to list auto-detected kit items
Helps to understand what's going on.

Change-Id: I5b8c591cbd60227cf250932c8654063236eec05f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 06:44:21 +00:00
hjk
8a28f43a81 Docker: Implement fallback for DockerDevice::lastModified()
Change-Id: I66923cd06b53ecc6883c3b324fd46d89994572ee
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-21 06:24:39 +00:00
hjk
486fd8f7d6 Docker: Implement fallback for DockerDevice::directoryEntries()
Change-Id: I57430bc4cf79abfc07ccbe06746a0857e10053da
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-16 14:37:15 +00:00
hjk
5acbe8d9d8 Docker: Implement fallback for DockerDevice::readFileContents()
Change-Id: I89ca268d226019a21bb73a2f039e781d0f595336
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-16 14:09:04 +00:00
hjk
c1d95beef6 Docker: Make fallback code less repetitive
Change-Id: I81762ef7e2ee66e9b053d3fcf8676a7920a63e12
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-16 14:08:51 +00:00