Commit Graph

100 Commits

Author SHA1 Message Date
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
Christian Stenger
ae16958fd8 Docker: Improve marking daemon problems
Small positive exit codes can result for different reasons.
Real docker issues result in small negative exit codes.

Change-Id: Ibd800b7806f3014ffccd39638c06b2dd93e8a5a1
Reviewed-by: hjk <hjk@qt.io>
2021-07-16 08:26:45 +00:00
Christian Stenger
88310df13d Docker: Handle docker daemon
Avoid calling the docker daemon again and again
if it is currently not running.

Change-Id: I17afa2eca098589bd362149d18e090252ef83f6e
Reviewed-by: hjk <hjk@qt.io>
2021-07-15 13:21:23 +00:00
hjk
f8c7d2e848 Docker: Rework auto-detection and removal of kit items
- Use more uniform messages for the different kinds of items
- Remove all auto-detected items

Change-Id: I0b0df0bca484337039432b163bd8e19593b1cd22
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 12:55:53 +00:00
hjk
5d17ff7a67 Docker: Make temporary messages shorter
Kinder to the translators.

Change-Id: If9c7eb265b2f86fec274e9db7b0d76424cd703cc
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 12:21:34 +00:00
Christian Stenger
d61600a8e2 Docker: Disable merged channel access for Windows
This is not supported and anything related to accessing
merged channels on Windows fails due to the need of
using wsl or a named pipe.
On the downside this may crash QC in cases where e.g.
Qt detection still tries to handle qmake as if running
locally, but at the current state this seems to no more
happen automatically (e.g. when using the auto detection).

Change-Id: I983cad66c1210de38a33e26958857a5dcaeef767
Reviewed-by: hjk <hjk@qt.io>
2021-07-14 11:52:03 +00:00
hjk
324ff024d7 QtSupport: Rename BaseQtVersion::autodetection* to detection
It's also used for manually triggered detection nowadays and
closer in naming to what kit, debugger and kit have.

Change-Id: I68705aafe297d61afc8b5918650e47353d3ccce1
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-07-14 10:19:05 +00:00
Tim Jenssen
22121885fe baseqtversion: commands are FilePathes
also renamed the qmlscene* qmlRuntime*

Change-Id: Ifd522e21f5ce30aaa54060fdcebee2cd8b9463c4
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2021-07-14 09:50:01 +00:00
hjk
a4c05f585f Docker: Move some cmake detection logic to cmake plugin
This make the code better re-usable from other places that
wish to put a cmake version into a new kit.

Change-Id: I1ef7770a7f8efa36e88b2f3862b011fecd38de98
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 09:41:30 +00:00
hjk
076d1bf10a Docker: Fix debugger auto-detection
Mark detected debuggers as such and give them some bonus to match,
overriding other hacks.

Change-Id: Iaf4d88fa22dd50e68124b61087d4c742f7a56d0f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-14 08:28:56 +00:00
hjk
e8521e6fe1 Utils: Add/fix FilePath::isFile and FilePath::isDir
In general, the more specific isReadableFile etc are preferred, but for
porting a 1:1 match to QFileInfo functionality is helpful.

Change-Id: I5b575ca9a5053f13f63c0fbe0e3dcc222494280f
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-07-14 08:16:57 +00:00
hjk
bb77053e6d Docker: Add a hint on what to do with "Paths to mount"
Change-Id: I992e73f78ff18ac5ed89ff5ce6fb6e7f98e1cb2c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-13 07:26:43 +00:00
Christian Stenger
d0172f80b4 Docker: Guard against empty mounts
Using empty mounts makes using the container fail.

Change-Id: I65041eae3a1ebeec936861b4f85977981bbd84d3
Reviewed-by: hjk <hjk@qt.io>
2021-07-13 05:36:08 +00:00
hjk
1936006a91 Docker: Force a container restart when mounts have changed
Change-Id: Iaddb52b6c4fb27ff9ccc098d76cc6e333e02c7e4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-12 13:21:44 +00:00
Eike Ziller
e895a0380b Fix lupdate issues
Some tr functions missing, some places where we need full qualification
because lupdate gets confused with namespaces.

Change-Id: Ic1d6ef3b31960dda02bc0788a255857117acdca9
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2021-07-09 13:05:03 +00:00
hjk
97578a4fee Utils: Allow an offset in FilePath::readContents()
Also, change the size limit to take a qint64. Contrary to e.g.
Q(6)Hash::size() there is a realistic chance that 31 bits are not
enough.

Change-Id: Idbe6e765a5cac4336b3d64a8e0adb14966fd18a3
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-09 12:48:37 +00:00
hjk
05545adb93 Utils: Change semantics of FilePath::onDeviceSearchInPath()
... and rename it to searchOnDevice().

We need to handle additional search directories anyways, so its more uniform
to always pass a list all of them.

Change-Id: I46c7860b51d11c26db58045ff3ab922148af021f
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-08 10:28:49 +00:00
Tim Jenssen
59ac4dbf0d fix msvc Qt6 dev builds
Change-Id: I4264a15c5033b9123c4e97caa86a909e654cef34
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2021-07-07 17:39:56 +00:00
hjk
d7062b5b92 Utils: Allow additional directories for FilePath::searchInPath
This mimics Environment::searchInPath().

Change-Id: I8c772ed31c31c74b09c7aa0e4912de8586dd2468
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-07 10:43:46 +00:00
hjk
10ca1c711e Docker: Partially split out kit item autodetection
Most of it is independent of the docker device as such, this should be
centralized somehow. This here is a first step.

Change-Id: If32063559a4c7c6c3cecf1973e1ef1f634e5f8f4
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-06 06:46:13 +00:00
hjk
fd71cbf135 Docker: Properly map back DockerDevice::directoryEntries() result
Even though the file is accessible in the local path, not mapping
back loses its relation do the docker container used for further
decisions like FilePath::needsDevice().

Change-Id: I7c693d604364b9e42bf7310c072be0f33d149626
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-07-05 13:00:16 +00:00
Leena Miettinen
67ac04bdce Docker: Fix UI text
Task-number: QTCREATORBUG-25915
Change-Id: I8f0b368f77af39a586963765a63e1618a0ee9bd6
Reviewed-by: hjk <hjk@qt.io>
2021-07-02 13:51:25 +00:00
hjk
4a8c222c18 Utils: Add FilePath::symLinkTarget
And implement it for the docker device.

This replaces the previous unused and not really implemented
FilePath::resolveSymLinkTarget.

Change-Id: I9dcb4f8276dbb88b21959276da0d50135742fba0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-30 11:11:10 +00:00