Commit Graph

183 Commits

Author SHA1 Message Date
Jarek Kobus
97a66067bb TaskTree: Prepare for de-utils-ization - part 2
Move TaskTree into Tasking namespace.
Move Tasking namespace out of Utils namespace.

Change-Id: Ib4c1d7f54f1808517e54768dfa27209c33517b61
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: hjk <hjk@qt.io>
2023-05-12 08:09:19 +00:00
Jarek Kobus
a0f6e8dc04 Utils: Rename qtcprocess.{cpp,h} -> process.{cpp,h}
Follows QtcProcess -> Process rename.

Change-Id: I97235a9a40cb7fd52944515b7ab878d96528f919
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2023-05-04 05:52:26 +00:00
Jarek Kobus
470c95c94b Utils: Rename QtcProcess -> Process
Task-number: QTCREATORBUG-29102
Change-Id: Ibc264f9db6a32206e4097766ee3f7d0b35225a5c
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2023-05-04 05:52:16 +00:00
hjk
305ccfe259 Utils: Replace FilePath::onDevice() by new FilePath::withMappedPath()
Basically a.onDevice(b) == b.withNewMappedPath(a), matching the order
of b.withNewPath(a).

Whether the (curretly docker-specific) path mapping is useful /there/, and
whether some of the calls are needed at all is dubious. I added some
FIXME and changed a few cases directly.

Change-Id: I7514736ce922f632f1f737bc496f6783389a42b6
Reviewed-by: Marcus Tillmanns <marcus.tillmanns@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-04-04 06:56:55 +00:00
Orgad Shaneh
4bfdfc2fbc ProjectExplorer: Fix potential division by zero
Reported by Coverity.

Change-Id: Ie11625afc862bd7918d5b9bffd73e6726adaac0f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-31 18:05:35 +00:00
hjk
c5f7f5ab0a ProjectExplorer: Tr::tr
Change-Id: I8f1b463c5cc7a53627f7a9ad261998b92f13e56a
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-16 12:10:24 +00:00
hjk
4ddd28ae22 Utils: Rename QtcProcess::readAllStandard* to readAllRawStandard*
... and re-use the old QtcProcess::readAllStandard* names for
a QString-returning 'decoded' version.

For now, only use that in 'full Utf8' cases, to stay bug-compatible,
the plan is, however, to employ the QTextCodecs we have already
in the channel buffers. That will be one-by-one, though.

Change-Id: Id209e0671920d4ea4197918e872f441254112d52
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2023-01-10 12:08:53 +00:00
hjk
c7884a2b17 Qmake: Enhance remote parsing
When parsing remote .pro files the parsers needs to pretend it runs
on the remote device.

All internal data are now "local on the remote", so that string
manipulation in .pro files "just works", and a 'device root'
string is passed around to relevant functions which then use
it to construct FilePath::toFSPathString()-style paths that
our custom FSEngineImpl can then map to the real device.

Remote $$system() calls are intercepted by the local parser and
redirected using the usual QtcProcess mechanims.

Quite a bit of the ProParser needed adjustments, so there's some
potential for regression.

Task-number: QTCREATORBUG-28242
Task-number: QTCREATORBUG-28161
Task-number: QTCREATORBUG-28355
Change-Id: I6100e7aca4e1db35f5e9689004110aab57e2c595
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2023-01-10 12:02:23 +00:00
Kai Köhne
56baf8c058 Remove GPL-3.0+ from license identifiers
Since we also license under GPL-3.0 WITH Qt-GPL-exception-1.0,
this applies only to a hypothetical newer version of GPL, that doesn't
exist yet. If such a version emerges, we can still decide to relicense...

While at it, replace (deprecated) GPL-3.0 with more explicit GPL-3.0-only

Change was done by running

  find . -type f -exec perl -pi -e "s/LicenseRef-Qt-Commercial OR GPL-3.0\+ OR GPL-3.0 WITH Qt-GPL-exception-1.0/LicenseRef-Qt-Commercial OR GPL-3.0-only WITH Qt-GPL-exception-1.0/g" {} \;

Change-Id: I5097e6ce8d10233993ee30d7e25120e2659eb10b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2023-01-06 11:15:13 +00:00
Jarek Kobus
acd55c0677 AbstractProcessStep: Provide API for running TaskTree
As an alternative to calling AbstractProcessStep::doRun().

Change-Id: I53142b7470a3e2aed0e219300fb3e0b4621630db
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2023-01-05 13:53:13 +00:00
Jarek Kobus
ea35ed9ffe AbstractProcessStep: Merge finish() with processFinished()
Change-Id: Ied15ec3ee9d3bcc80b03b2589d101c65f2fd062a
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2023-01-05 08:43:21 +00:00
Jarek Kobus
354f67f11a AbstractProcessStep: Remove two virtual methods
Remove stdOutput() and stdError() virtual methods.
Connect to addOutput() signal in subclasses instead and
filter for desired channel.

Change-Id: Ifd9a2e4ff037776caa706bbdb9634992060172ff
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-12-13 16:23:49 +00:00
Jarek Kobus
ebe708c1a3 AbstractProcessStep: Remove processStarted() virtual method
Add concealedParameters / setConcealedParameters instead, to be
used in AndroidBuildApkStep.

Use concealed parameters also on start failure and on done.

By default, concealedParameters() equals processParameters()
(i.e. no sensitive data to hide) unless the implementation decides
to replace some sensitive data (e.g. password) with asterisks.
In this case the reimplementation needs to store separate instance
of ProcessParameters and redirect the pointer of
concealedParameters() into own structure.
This is being done through a call to setConcealedParameters().

Change-Id: I8b1573b007c0f8a10c9592ccaf25e6f088f04691
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-12-06 22:45:40 +00:00
Jarek Kobus
51b6efb116 AbstractProcessStep: Don't read std channels on done
Since we are connected to process' readyRead signals
and perform readAll inside handlers, there is no need to
do it again inside process' done handler. It's guaranteed
that before process emits done() signal it emits readyRead
signals if new data appeared on any channel.

Remove processReadyReadStdOutput() and processReadyReadStdError()
helpers.

Change-Id: I7e921335e6410a26efd9619cbed8f5e6852d2cf2
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-02 16:23:53 +00:00
Jarek Kobus
dfd079f050 AbstractProcessStep: Merge virtual functions
Merge processSucceeded with processFinished into one virtual
function. Leave default implementation empty, so that
reimplementations don't need to call base impl. Move
processFinished into private section. Pass just one bool success
parameter into processFinished.

Change-Id: Ide3e262de0c0c5583c9fec2426fa460b6b74a49d
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-12-02 15:37:16 +00:00
Marcus Tillmanns
6dd15ef3f3 ProjectExplorer: Ensure working dir is reachable
Previously the working directory might not be reachable by
the executable.

This change fixes that by calling "ensureReachable", and
changing the path to an on-device path of the exectuable.

This also fixes the path when the Host is Windows, and
the build device is a unix type system by changing the paths
from e.g. "c:/..." to "/c/..."

Change-Id: I6c86e16c867bb654b6c2a4951d9f62fdb879298e
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2022-10-19 08:56:35 +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
Jarek Kobus
bdf79d41b2 AbstractProcessStep: Don't call blocking waitForStarted()
Connect to started() signal instead. Delete the process
later when process failed to start.

Change-Id: I9901a52c90b018af06348892e2bd97cf967418af
Reviewed-by: hjk <hjk@qt.io>
2022-06-30 08:26:15 +00:00
Jarek Kobus
8e586dfa02 AbstractProcessStep: Connect to QtcProcess::done() signal
Instead of connecting to finished() signal.

Change-Id: I2c1266bf699f54053fde37bb7ff22a93131e6b11
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-04-28 09:44:36 +00:00
Jarek Kobus
4093fbe826 Don't delete process directly from process' finished handler
AbstractProcessStep::slotProcessFinished() slot is connected
to m_process finished() signal. We call there
AbstractProcessStep::Private::cleanUp(), and that calls
m_process.reset(), so it invokes m_process d'tor directly.

SshRemoteProcessRunner::handleProcessFinished() slot is
connected to d->m_process finished() signal. We call there
SshRemoteProcessRunner::setState(), and that calls
d->m_process.reset(), so it invokes m_process d'tor directly.

Delete later m_process instead in both cases.

Change-Id: I4a0f2a631b676b57e8bcc3a7878620bc76dc74de
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-05 12:41:26 +00:00
Jarek Kobus
1b5c4504af Get rid of no-op calls to QtcProcess::kill()
Leave the work for implicit ProcessReaper.

Change-Id: Ie01c4e996fda18b7cee77851394174556c6f3857
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2022-03-24 08:53:59 +00:00
Jarek Kobus
2bd6498278 Fix canceling compilation
Don't expect that the process being reaped will emit any signal.
Before deleting the process inside AbstractProcessStep::doCancel()
we do the expected cleanup immediately. We can't expect that the
process being reaped will return fine, so we set exitCode to -1
and exitStatus to CrashExit.

Fixes: QTCREATORBUG-26271
Change-Id: I0afd7ba8846d0fa57a0531201bbed9bd7a490942
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-09-21 10:59:00 +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
hjk
fe7d6f0def Utils: Drop QProcess specific parameters from QtcProcess::finished()
Mid-term plan is to concentrate on use of QtcProcess::result()
instead which is a bit more system-agnostic.

There's quite a bit of potential for downstream cleanup by
re-using QtcProcess::exitMessage() now.

Change-Id: I3806b3f5933d96e64b7cfb18cc6c52823fddcbcd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-06-14 13:31:05 +00:00
hjk
4245d89a67 ProjectExplorer: Show a verbose error message if available
... when a start failed, e.g. due to a inacessible working directory.

Change-Id: Ibcec1c5323c37f1e8f6c9e55439439b24f3b40b1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-07 15:18:08 +00:00
hjk
a09851ff1f ProjectExplorer: Fix Coverity warning in AbstractProcessStep
*** CID 1505141:  Null pointer dereferences  (FORWARD_NULL)
/qt-creator/src/plugins/projectexplorer/abstractprocessstep.cpp: 409 in ProjectExplorer::AbstractProcessStep::slotProcessFinished(int, QProcess::ExitStatus)()
403         if (!process) // Happens when the process was canceled and handed over to the Reaper.
404             process = qobject_cast<QtcProcess *>(sender()); // The process was canceled!
405         if (process) {
406             stdError(d->stderrStream->toUnicode(process->readAllStandardError()));
407             stdOutput(d->stdoutStream->toUnicode(process->readAllStandardOutput()));
408         }
>>>    CID 1505141:  Null pointer dereferences  (FORWARD_NULL)
>>>    Passing null pointer "process" to "cleanUp", which dereferences it.
409         d->cleanUp(process);
410     }
411

Amends 4a26a2c28.

Change-Id: If9a66841b05e389a87a1b843ee5ef9e66edf15dd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-06-07 08:22:58 +00:00
hjk
accb1e6e08 Utils: Make QtcProcess::{setW,w}orkingDirectory use FilePath
But keep the old setter for a while to ease transition.

Change-Id: If02b79b1fcd31fbf8b06ef26876c41af891127f9
Reviewed-by: hjk <hjk@qt.io>
2021-06-03 10:31:13 +00:00
hjk
08040e4e94 Utils: Move QProcess base to QtcProcessPrivate
Change-Id: I4c6811d42e051fadfcf32edb664ff3bc09e692e6
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-06-02 13:21:08 +00:00
hjk
77d7b24326 Utils: Make Environment::setEnglishOutput a proper member function
The previous indirection was useful as long as they were overloads
for QProcessEnvironment and QStringList, but these are gone now.

Change-Id: I5066bd2e72fd06948a5cc7bbac6dda9006db96ed
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-21 15:07:34 +00:00
hjk
29b58f3488 ProjectExplorer: Remove some unneeded #includes
Change-Id: I08cdf8bb02a1cc394dc0698d1eaa5341ab82aa71
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-05-06 13:12:00 +00:00
hjk
ebd8d520fc ProjectExplorer: Make AbstractProcessStep::doRun() tests work remotely
By funneling file system accesses through Utils::FilePath.

Change-Id: I13a3aac23bd5fc301edf5e5c52e0c7ebd1e6ca6c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-05-03 13:38:05 +00:00
hjk
8e2522f290 ProjectExplorer: Better start/stop messages for remote commands
Change-Id: I749e178d87e1721b09b8a6d867ab799967acad7c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-29 08:41:40 +00:00
hjk
77fd9661ec ProjectExplorer: AbstractProcessStep code cosmetics
Namespaces.

Change-Id: I7781bcf7125ad854e05a3b3a6a97d0c39b76df69
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2021-04-23 10:10:29 +00:00
Alessandro Portale
176122fa94 ProjectExplorer: Make APS::setupProcessParameters const
Change-Id: I357505131cff5c98b5c9fe0a3967c79d009167e6
Reviewed-by: hjk <hjk@qt.io>
2021-04-21 13:32:17 +00:00
hjk
0d185a0ad3 ProjectExplorer: Simplify use of AbstractProcessStep::init()
1. Systematically check for AbstractProcessStep::init() first in
   derived classes.
2. Use setupProcessParameters(processParameters()); by default in
   the base implementation.
3. Drop all re-implementations that are effectively the same.

Change-Id: I0ae54dd4909b354672a63ee56d0b7c2ea0732494
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-09-16 16:16:13 +00:00
hjk
070e0932c9 ProjectExplorer: Remove redundant MakeStep::{is,set}Clean()
This was only used for setIgnoreReturnValue(), which can be done
directly and also does not need to be stored in the settings.

Change-Id: I7419efe66d164b223463e19c3daf2350b4a2bae4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-08-26 04:51:47 +00:00
hjk
70b226144f ProjectExplorer: Start to consolidate AbstractProcessStep setup
Add some convenience functions to the base class to avoid repetition
in the derived classes.

Will be used immediately it in some derived classes.

Change-Id: I8fd6aa4f8351720cdc8f63f7fa5f506e32a8143b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-08-14 14:15:23 +00:00
hjk
0e5cc282e6 ProjectExplorer: Small code cosmetics
Unused declaration, const, ..

Change-Id: I0de544ba9be36a291fec5d1ab187e038a4fcc464
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-07-28 11:59:22 +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
Christian Kandeler
1c6e4fbd32 Merge output formatters and output parsers
Now only one piece of code needs to be written to both linkify output in
an output pane and create tasks for it in the issues pane.
The calling sites are also simplified. For instance, until now, build
steps had to feed their output parsers manually and then push the
created tasks up the signal stack in parallel with the actual output,
which the build manager relied upon for cross-linking the output pane
content. Afterwards, the output would get forwarded to the formatter
(and parsed for ANSI escape codes a second time). In contrast, a build
step now just forwards the process output, and task parsing as well as
output formatting is done centrally further up the stack.
Concrete user-visible improvements so far:
    - File paths in compiler/linker messages are clickable links now.
    - QtTest applications now create clickable links also when run
      as part of a build step, not just in the app output pane.

Task-number: QTCREATORBUG-22665
Change-Id: Ic9fb95b2d97f2520ab3ec653315e9219466ec08d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-04-23 08:47:08 +00:00
Eike Ziller
5838b40c6d Enforce PWD in the environment of build steps
In the shell PWD can be different from the "real" working directory,
because the latter never contains symbolic links (getcwd).
E.g. Clang uses PWD as the basis for debug information.

Fixes: QTCREATORBUG-23788
Change-Id: I19f06dcfded5ccca2dc0162a3a543cdc756bffb0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-21 12:31:22 +00:00
Christian Kandeler
c564805095 Output parsers: Make file look-up self-contained
Change-Id: Iffe104b6b52f0902f1977adeaa0fee3dc1e374a4
Reviewed-by: hjk <hjk@qt.io>
2020-04-17 08:14:14 +00:00
Christian Kandeler
6f32538c5d ProjectExplorer: Split up the IOutputParser class
For symmetry with Utils::OutputFormatter.

Task-number: QTCREATORBUG-22665
Change-Id: I148fed69dba042ad3ef26e080829c31cd3f357fd
Reviewed-by: hjk <hjk@qt.io>
2020-04-16 10:40:33 +00:00
Christian Kandeler
45ba9fcd53 Output parsers: Replace the chaining approach
Use "flat" aggregation instead.
This is another step towards the formatter/parser merger.
Along the way, also fix some some subclasses (mostly in BareMetal) that
erroneously forwarded handled output to other parsers.

Task-number: QTCREATORBUG-22665
Change-Id: I12947349ca663d2e6bbfc99efd069d69e2b54969
Reviewed-by: hjk <hjk@qt.io>
2020-04-09 14:49:32 +00:00
Christian Kandeler
c58b1b2ca6 ProjectExplorer: Dissolve the AnsiFilterParser class
This class was different from all the other output parsers in that its
only responsibility was to pre-process the output before it was passed
to the real parsers. We now make this explicit by introducing the
concept of a filter function and turning the AnsiFilterParser class into
one of those.
This also gets rid of a case where the order of output parsers in the
chain matters, which we want to move away from.

Task-number: QTCREATORBUG-22665
Change-Id: Ica135e54ab43cf2ca8186073dc2487c906d4b38d
Reviewed-by: hjk <hjk@qt.io>
2020-04-07 09:21:48 +00:00
Christian Kandeler
b15d1951a2 ProjectExplorer: Let IOutputParser handle newlines
This makes IOutputParser structurally more similar to
Utils::OutputFormatter, which makes it simpler to explore possibilities
of somehow uniting these two related classes.

Task-number: QTCREATORBUG-22665
Change-Id: Ibb12ab6c8c785d863b9a921102a929864d0a5251
Reviewed-by: hjk <hjk@qt.io>
2020-04-07 08:13:58 +00:00
Christian Kandeler
cddaecfe21 ProjectExplorer: Clean up IOutputParser interface
- Remove unneeded/unused functions.
- De-virtualize where possible.

In particular, after untangling a number of self-referential
redirections, it became apparent that the outputAdded()
infrastructure was entirely unused.

Change-Id: I51e1beed008df2727b42494b087efa476342397e
Reviewed-by: hjk <hjk@qt.io>
2020-04-03 10:57:06 +00:00
Eike Ziller
897abf24e2 Merge remote-tracking branch 'origin/4.12'
Change-Id: I79083060dfc3bc4408123acd3b7305b9701650fd
2020-04-03 08:12:52 +02:00
Christian Kandeler
7834f172ce ProjectExplorer: Fix copy-paste error in AbstractProcessStep
Change-Id: Id345f3c2c51d4ac4b773113c7e22533ebcbcfaf7
Reviewed-by: hjk <hjk@qt.io>
2020-04-02 08:55:31 +00:00
hjk
3fe1911d46 ProjectExplorer: Introduce some BuildStep convenience accessors
... and use in ProcessStep and related classes.

Change-Id: Ie6f1403d0aa2b9f5bcde06e994809466700b1357
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-19 16:11:05 +00:00