Commit Graph

70 Commits

Author SHA1 Message Date
hjk
a579fa52ee ProjectExplorer: Rename some RunControl functions
Change-Id: Ia86a50100ddfd465d548863ae8d58033a5dbafc0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-05-02 08:10:28 +00:00
hjk
62f6c1e1d6 ProjectExplorer: Remove now-unused RunControl::runConfiguration
Change-Id: I312277813763d264dc7904042bbe6005350c3870
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2022-04-29 11:44:55 +00:00
Jarek Kobus
7fadaff5d4 IDevice: Make it possible to forward declare Ptr and ConstPtr
Most inclusions of idevice.h inside other headers are
required just because of IDevice::Ptr or IDevice::ConstPtr
was used there. Unfortunately, since these "using"
are defined inside a IDevice class, we just can't
forward declare IDevice::Ptr nor IDevice::ConstPtr.

Instead, create a separate header that defines
IDevicePtr and IDeviceConstPtr while having IDevice
forward declared. Redefine IDevice::Ptr/ConstPtr
inside IDevice to use IDevicePtr/IDeviceConstPtr.

Now, instead of forward declaring a IDevice::Ptr
it's sufficient to include the idevicefwd.h.

This drops the number of files being recompiled
after touching idevice.h from ~770 to ~210.

Change-Id: Ib6f2982aa0761fb4cd6593badb9c3c0c527ea535
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-04-14 12:27:04 +00:00
hjk
a26f0ba808 Debugger: Avoid one use of RunControl::runConfiguration()
Change-Id: Iaf9fb0cee4544121a4df433c3726d98ae0175ff2
Reviewed-by: David Schulz <david.schulz@qt.io>
2022-04-14 09:25:46 +00:00
hjk
530b9ae85a ProjectExplorer: Copy more RunConfiguration data to RunControl
The aspects are now responsible for defining what data needs
to be copied and also to provide a suitable interface (kind
of source-compatible to direct use) for access.

The important change here is that RunControl::aspect(...) doesn't
need to access RunControl::runConfiguration() in fully aspectified
RunConfigurations anymore. In not-fully aspectified the runConfig
access is moved to the user code to make the problem visible there.
Long term, aspectification should be finished.

As an additional benefit, the resolving of macros etc can
now be done at the correct time.

Change-Id: I690d9f8f696ce9b4efd42082ba3f81b514efcb77
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-04-12 08:43:09 +00:00
Alexander Drozdov
771d0d67b9 RunControl: fix device passing to the doStart()
Brokken by the f1e973de79.

We must pass local `runnable` instead of runControl()->runnable(),
otherwise device member will be nullptr that breaks all non-Desktop run
configurations, like RemoteLinux one.

Change-Id: I0499008aee14cb3bbcc3e1ebda71c50533b6502e
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-03-02 14:18:31 +00:00
Jarek Kobus
ff0ce27c1f ApplicationLauncher: Unify API
Make the API more similar to QtcProcess API.
Rename:
  processStarted() -> started()
  error() -> errorOccurred()
  processError() -> error()

Change-Id: I86d650d55a643f5999fc91e56b985f699e2d7245
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-03-02 12:34:06 +00:00
Jarek Kobus
f1e973de79 RunControl: Drop IDevice * from doStart()
Use device set inside passed runnable instead.

Grep for all usages of RunControl::start().
If passed device wasn't nullptr, set this device
inside passed runnable. Otherwise ensure that
passed runnable contains device set to nullptr.

Change-Id: I06fd42a16246fa9fedd81eeb47481a217f887cb0
Reviewed-by: hjk <hjk@qt.io>
2022-02-23 16:28:01 +00:00
Jarek Kobus
3f259da6d5 ApplicationLauncher: Treat DesktopDevice as local
Treat DesktopDevice and all derived devices as local
in application launcher.

Change-Id: Ie1a025c03f1c96158c67e0c900f89e33ec7c4663
Reviewed-by: hjk <hjk@qt.io>
2022-02-23 15:26:56 +00:00
Jarek Kobus
10abf43afa ApplicationLauncher: Remove start(IDevice *) overload
Take the device from runnable passed in setRunnable().
If the intention is to run locally, set the device
to nullptr inside runnable. Otherwise we don't run locally.

Follows 47957de2dc

Change-Id: I5b381bb499cf76e469c844ac7474ce2f60761cef
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Qt CI Bot <qt_ci_bot@qt-project.org>
2022-02-23 15:03:30 +00:00
hjk
6942c58d65 ProjectExplorer: Use simpler signature for ApplicationLauncher::processExited()
And rename it to finished().

Maps better to what QtcProcess uses.

Change-Id: Ibfa018549f436b27638a791c0b4937c4459c9452
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
2022-02-15 15:07:52 +00:00
hjk
47957de2dc ProjectExplorer: Split ApplicationLauncher::start() parameters
There's traditionally an odd duplication of the runnable.device
and the passed device here. Start disentangling things.

Change-Id: I1cc1628c99cea04d761fc4d8dd0cb232127ce055
Reviewed-by: Jarek Kobus <jaroslaw.kobus@qt.io>
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
2022-02-15 13:43:09 +00:00
Jarek Kobus
072750a284 Fix crash reporting in output pane when remote run in terminal
Fixes: QTCREATORBUG-27007
Change-Id: I6e409eb6489530dc6c48c90d20e28ff019eff187
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: hjk <hjk@qt.io>
2022-02-09 12:34:57 +00:00
Jarek Kobus
39d078700a Fix a warning about wrong RunControlState transition
The warning was issued when re-running from output pane.
According to RunControlState class description
the transition from Stopped to Starting is a valid one.

Change-Id: I264630dc1c23c359ff4e9d4a7a292b9b0c55ec5a
Reviewed-by: <github-actions-qt-creator@cristianadam.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2022-02-01 10:57:46 +00:00
Alessandro Portale
d7ed48ac6f Add missing "emit"s
Change-Id: I88a7397c7689b1e72cdd0e52077f8097443963c0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-11-11 14:10:42 +00:00
Jarek Kobus
a3ae60d729 Uniform ApplicationLauncher API: get rid of finished()
Use existing processExited() signal instead.

Change-Id: I1eecaa05fa8b3a97d8585fca4ca89e8e1acecec3
Reviewed-by: hjk <hjk@qt.io>
2021-11-10 14:07:29 +00:00
Jarek Kobus
94c70d1933 Uniform ApplicationLauncher API: get rid of reportError()
Use existing error() signal instead.
Implement errorString() and processError() in non-local case.

Change-Id: Ibdd6cec19ffa5efa0dad330515988da80e86e35b
Reviewed-by: hjk <hjk@qt.io>
2021-11-10 12:47:22 +00:00
Jarek Kobus
971b1b2269 Uniform ApplicationLauncher API: get rid of remoteProcessStarted()
Use existing processStarted() signal instead.
Replace isRemoteRunning() with isLocal().

Change-Id: I58d0204888116c00e793fa43f969707013db06eb
Reviewed-by: hjk <hjk@qt.io>
2021-11-10 11:38:48 +00:00
Jarek Kobus
d14e68eac2 Uniform ApplicationLauncher API: get rid of remoteStderr/out()
Use existing appendMessage() for this purpose either with
StdErrFormat for remoteStderr() or with StdOutFormat for remoteStdout().
In case when device process is used in ApplicationLauncher
no appendMessage() was emitted so far with StdErrFormat or StdOutFormat.

Change-Id: I2f6603aaf28113fea2a8bb6bd1738320cc39be75
Reviewed-by: hjk <hjk@qt.io>
2021-11-09 16:46:40 +00:00
Jarek Kobus
9739ded573 Uniform ApplicationLauncher API: get rid of reportProgress()
Use existing appendMessage() for this purpose with NormalMessageFormat.
In case when device process is used in ApplicationLauncher
no appendMessage() was emitted so far.

Change-Id: I96041ad19fe16066ea31d92f52253e0aa864f96d
Reviewed-by: hjk <hjk@qt.io>
2021-11-09 15:21:34 +00:00
Jarek Kobus
0556eec9b7 Use a new enum indicating various start failures
Before the m_startFailure flag was used to detect the case
when the process failed to start because of wrong filename.
As this flag was set on any possible error we have always
detected the wrong filename case. Replace this flag with a
new enum describing various start failures.

Don't report again the crashed message. Check if we have already
reported the stop and we don't report it again. The
processExited() handler is being called twice: directly from
localGuiProcessError() and through the delayed localProcessDone().

Fixes: QTCREATORBUG-26467
Change-Id: I3cc6aa0c0b702256cefd77ba95793cd31e82ae10
Reviewed-by: hjk <hjk@qt.io>
2021-10-27 07:53:53 +00:00
hjk
2292e3a7a6 ProjectExplorer: Always set a RunControl's macro expander
In some cases (e.g. "Attach to running application") there is no
proper RunConfiguration, so fall back to Target or Kit.

Amends e78f456083

Change-Id: I0093d5f573fc259fd2a72bbc1aaa22dcb8adbaee
Reviewed-by: David Schulz <david.schulz@qt.io>
2021-10-12 10:51:12 +00:00
Christian Kandeler
c045eb0cf9 ProjectExplorer: Prevent redundant output on process crash
... in run controls.

Fixes: QTCREATORBUG-26049
Change-Id: I51e560fb4674e2b8ac59cb1901d269d8179213d7
Reviewed-by: hjk <hjk@qt.io>
2021-08-16 12:26:14 +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
de6c7696d2 ProjectExplorer: Provide a way to extend RunWorkerFactory
In the light of docker support it would be nice to have a way
to tell existing RunWorkerFactories that they also work for
docker, or generally to increase the scope to which they apply
after construction time.

Small con: Some more boiler plate,
Small pros: Setup using the new method looks similar to what we use
in the other factories, and the Factories types are recognizable
when debugging.

Change-Id: Idb1757f519e7151b835326aa8b98aeaa4a372cc4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-06-18 09:53:02 +00:00
hjk
4059c27d7a ProjectExplorer: Use manual loop in RunControl::canRun() implementation
I find the std::bind version much harder to debug.

Change-Id: I0badb4c29097a5432b110a815cb2206477091d98
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-19 05:09:04 +00:00
Sergey Levin
0c01ef9998 Expand RunControl displayName
Change-Id: I654ec71aeea945b59eb8a557254530dff97bed8c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-04-07 08:25:25 +00:00
hjk
c4b7da9ab2 ProjectExplorer/Debugger: Add a 'Run as root' option for Unix hosts
For local run and GDB debug, with or without terminal.

Task-number: QTCREATORBUG-2831
Task-number: QTCREATORBUG-25330
Change-Id: I9b5d2156bcffea4f358474ecdbcad580a4419917
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-22 13:38:25 +00:00
Alessandro Portale
afc2fda8a9 ProjectExplorer: Use qAsConst w/ non-const Qt containers in range-loops
Change-Id: I6422b3e40a6925504a231be2d47b3214d86c6e06
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-17 11:19:21 +00:00
hjk
2845427d46 ProjectExplorer: create provideAskPassEntry(Environment &) convenience
... to centrally set SUDO_ASKPASS unless present.

To be used for 'Run as root'

Change-Id: I85bac939e6a7fba0b2299fd17edfe73577bfa5ad
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2021-02-16 14:27:00 +00:00
hjk
cec468d78a Utils/ProjectExplorer: Move re-usabled bits of aspects to Utils
Classes involved are BaseAspect and some derived classes,
LayoutBuilder and VariableChooser.

This is mostly mechanical, with various include/using changes
to make it compile.

Change-Id: I624a457f3555f102e541c4c71e33a9423af32250
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-09-23 07:44:42 +00:00
Christian Kandeler
cba414d501 ProjectExplorer: Fix crash when setting up run control
Amends 215b284666.

Change-Id: I2d820113153fc1c3326de00f38a5d14d71a501c9
Reviewed-by: David Schulz <david.schulz@qt.io>
2020-09-08 08:52:39 +00:00
Christian Kandeler
215b284666 ProjectExplorer: Properly set up the output formatter
... for the app output window.

Fixes: QTCREATORBUG-24560
Change-Id: I199d7b16f445db498027094792c6cf344d920a88
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2020-09-04 08:50:13 +00:00
hjk
e1c88116b3 Core/Utils: Migrate further to Utils::Id
The coreplugin/id.h header is kept for downstream for now.

Change-Id: I8c44590f7b988b3770ecdc177c40783e12353e66
(cherry picked from commit 430a33dcd9)
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-07-06 11:15:18 +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
Christian Kandeler
c563046145 ProjectExplorer: Fix possible crash in RunControl
There is not necessarily a run configuration.

Change-Id: I53e0a0ab322bcf1cbac2cbb6944602aeed933432
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2020-05-14 04:43:22 +00:00
Christian Kandeler
c15e09e0fe ProjectExplorer: Generalize the concept of custom output parsers
They can now be created independently of any toolchains, and we expose
them in the build and run configurations, so that users can easily get
tasks for output that comes from custom tools or is otherwise specific
to the user's environment.

Fixes: QTCREATORBUG-23993
Change-Id: I405753b9b68508ffe5deb4fcac08d6b213c7554d
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: hjk <hjk@qt.io>
2020-05-11 15:59:32 +00:00
Christian Kandeler
d3be54bcd1 QtSupport: Add QtTestParser to the list of output formatters
... when creating a run control for a Qt project. Now tasks will appear
in the issues pane for QtTest application output in the app output pane.

Task-number: QTCREATORBUG-22665
Change-Id: I2674f3d4f9aabc0a4db4178dcd5495b822f14022
Reviewed-by: hjk <hjk@qt.io>
2020-04-28 08:45:49 +00:00
Christian Kandeler
d42920d372 OutputFormatter: Take ownership of the line parsers
For symmetry with IOutputParser.

Task-number: QTCREATORBUG-22665
Change-Id: I92e93b32e87ff4f3fa163a2d2fe13768e56bfa24
Reviewed-by: hjk <hjk@qt.io>
2020-04-15 09:07:17 +00:00
Christian Kandeler
c0c2df203d Utils: Split up OutputFormatter class
An OutputFormatter takes some string and prints it into a text edit.
In addition, it can ask any number of registered OutputLineParsers
whether they think any special formatting should be applied to the
current line.
This mechanism is now properly modeled by our class design, rather than
being hidden in a monolithic class where everything had the same type,
no matter what its purpose was.
Prospective contributors can now simply be pointed to the
OutputLineParser class and will see at one glance what they have to do.

Change-Id: I9844499f062c94fb038ce73fd6f26576910148c2
Reviewed-by: hjk <hjk@qt.io>
2020-04-14 14:15:26 +00:00
Christian Kandeler
04a99c1de1 Remove the limitation that output formatters have to be exclusive
Introduce an aggregating output formatter that forwards its input to a
sub-formatter that feels responsible for it, or otherwise lets the base
class handle it.
Our output panes now use such an aggregating formatter.
In particular, this means that in the future, we won't have to stuff all
run control output formatting into the Qt output formatter anymore.

Change-Id: I5498f200a61db10ccff3ec8974c6825da7f7072d
Reviewed-by: hjk <hjk@qt.io>
2020-03-20 13:48:15 +00:00
Christian Kandeler
9348ac5fec Utils: Remove the *SameLine OutputFormat enums
Presumably, they were intended for output that shouldn't get an
automatic newline, but if there ever was such a thing as automatic
newlines, it must have evaporated over time. All users of
OutputFormatter provide a newline if they want one.

Change-Id: Ibd219b7305fd503ce075d6f77930d2b538d5e2e8
Reviewed-by: hjk <hjk@qt.io>
2020-03-18 13:52:17 +00:00
hjk
a68aee95a1 ProjectExplorer: Replace ProjectConfiguration::m_macroExpander
... by MacroExpanders in Build and RunConfiguration. Deploy didn't
use its own, BuildStep always composed an empty expander with
the BuildConfiguration's, uses now the BuildConfiguration's expander
directly.

Change-Id: I9de51bfc32aeb3d73f4974175e42a37807e49ac1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-19 09:31:02 +00:00
Alessandro Portale
9904464074 Make various Q_LOGGING_CATEGORY's static
Change-Id: I43d3a198b0863d85a7fb305c7cb768f68acbd139
Reviewed-by: hjk <hjk@qt.io>
2020-01-15 14:54:10 +00:00
hjk
2758682723 ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target.

This patch moves build system from conceptually "one per project"
to "one per target (i.e. per project-and-kit)" or "per
BuildConfigurations" for targets where the builds differ
significantly.

Building requires usually items from the kit (Qt version, compiler,
...) so a target-agnostic build is practically almost always wrong.

Moving the build system to the target also has the potential
to solve issues caused by switching targets while parsing, that
used Project::activeTarget() regularly, with potentially different
results before and after the switch.

This patch might create performance/size regressions when several
targets are set up per project as the build system implementation's
internal data are duplicated in this case.

The idea is to fix that by sharing per-project pieces again in
the project implementation once these problems occur.

Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-19 11:05:52 +00:00
hjk
bcaeb73e68 ProjectExplorer: Store parts of active build config in runcontrol
... on runcontrol creation to prevent later access. Adapt some users.
There are more to come.

Change-Id: I2a3fe5eea0ada4eff7d08b79a6f49694e6962c8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-09-24 11:20:51 +00:00
hjk
758986ea0e ProjectExplorer: Store some aspect data by value in the RunControl
Change-Id: Idb7e119b5b0b483ce91efeb21fb415b654cfed4f
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-05 13:45:25 +00:00
hjk
4028a41d2e ProjectExplorer: Use std::function for SimpleTargetRunner::start()
This spares us the typical r = runnable(); modify(r); setRunnable(r)
roundtrip and the m_runnable storage that might or might not
be the same as runControl->runnable. Similar for m_device.

Change-Id: I8300260dd8dd7cd395e40bcd3d2ae45089085008
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-09-04 11:08:34 +00:00
hjk
2e8f650044 ProjectExplorer: Store BuildTargetInfo in RunControl directly
Target might go away...

Change-Id: Icbe040b030148a75e84f89b1ea47867f7ab18519
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-28 11:49:56 +00:00
hjk
19580ab203 ProjectExplorer: Less use of stored RunConfiguration in RunControl
Change-Id: I501433dcbc3d40c6439f5ab003e06f5a72b9d83e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-27 10:44:49 +00:00