Commit Graph

404 Commits

Author SHA1 Message Date
hjk
d162085377 ProjectExplorer: Use RunConfigCreationInfo struct for rc creation
The struct will likely gain qtcrunnanable/terminal members,
better pass all to where it is needed.

Change-Id: Ieb0dae8b56ce5c0992955dbfc0cd89cdd7bfe848
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-03-05 07:15:40 +00:00
hjk
6781217280 ProjectExplorer: Consolidate RunConfig creation codepaths
Move some code around to make interfaces slimmer.
Also no need to check canHandle() twice per creation.

Change-Id: I7c86e2dc78ebd53a0f8e9609e9fa135aaf31e7b7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-03-02 15:32:21 +00:00
hjk
38d15ebe2f RunConfiguration: Avoid unneeded calls to availableCreators()
It has been used twice on each Target::updateDefaultRunConfigurations():
Once to help filter out potentially interesting factories, and then
to actually retrieve the creators from the interesting factories.

The same result can be obtained with less effort and less code.

Change-Id: Ic83423bbbc172c842ec5a55fcd6ad83106e268aa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-23 07:09:41 +00:00
hjk
39b66f2cb8 Introduce and use IRunConfiguration::addSupportedTargetDeviceType
In line with addSupportedProjectType, saves a few cycles due to the
non-use of the temporary list, and in theory more flexible than the
existing set...(QList<Id>) as it potentially allows dependent plugin
to declare support for already existing configurations instead of
re-implementing their own.

Change-Id: I2b83e90de49daa9bfce6f780c5f51c2e971eb7d1
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-23 07:08:55 +00:00
hjk
231a9d2c58 RemoteLinux: Also decorate empty/invalid targets with device name
Change-Id: Iff9f80490ba3a59e0c17b28acd2376cfc0bf9d87
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-16 07:32:51 +00:00
hjk
018581a8c2 ProjectExplorer: Show non-desktop device names in remote run config names
So far we used device type in some cases, not even following a specific
pattern.

Showing the device name gives a bit more detail in cases of multiple devices
of the same type and offers the user a bit more control on what it shown.

Change-Id: I2bd6bbd404577db3afca0f84b8a976cb07b1cfd0
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-15 14:29:02 +00:00
hjk
9f2bb5d0c5 ProjectExplorer: Simplify collection of RunConfigurationCreationInfos
Instead of calling twice for AutoCreated and UserCreated, call once
and record to which case it belongs. Only the 'both' and
'user only' combination are ever used.

Change-Id: I9c15085bcbb4bf6584a6156135f2084dbfc51c1c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-15 14:23:02 +00:00
hjk
e5a3a8d189 ProjectExplorer: Remove BuildTargetInfo::displayName
This was previously intented to be used in the RunConfig Add... menu,
but this role is now taken by RunConfigurationCreationInfo::displayName.

This fixes also a regression for setups that relied on
QmakeProject::buildTargets() and a fix up empty display names later.

Change-Id: If75fc79efbdedc918a126e50c962fc188d7a3ebc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-02-09 14:15:54 +00:00
Tobias Hunger
e1409ae50f IRunConfiguration: Remove BuildTargetInfo from the RC factory APIs
Change-Id: I1d77d22a1c1ce1cbcfca8af7855ae7b935ac1c2c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-02-06 09:01:32 +00:00
hjk
1ec9d76e2b ProjectExplorer: Promote RemoteLinuxRunConfigFactory::availableBuildTargets
This was already almost the desired final pattern, so make it the default
implementation of ProjectRunConfigurationFactory::availableBuildTargets.

For the only remaining feature of "decorating" the build target names,
introduce a property m_displayNamePattern.

Un-adapted sub-classes still need (and are able) to overide.

Change-Id: Ia7d2d2f7d53f8b1da487fa82c8265ad5deb47500
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-01-08 14:07:45 +00:00
hjk
c3d87e81c5 ProjectExplorer: Return BuildTargetInfo from availableBuildTarget()
... including build target name and display names instead of
returning QString build target names and producing display names
via displayNameForBuildTarget()

This is a mechanical intermediate step on the road to use
Target::applicationTargets().list uniformly as source of build
targets.

Change-Id: I7b0b1fb398d5061b0cec0b86890f9eaf0bb53a19
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-01-05 09:34:29 +00:00
hjk
32f2169f77 ProjectExplorer: Add a IRunConfigurationFactory::addFixedBuildTarget()
To be used for "special" build targets (Custom executables etc) that do not
depend on the project. This reduces user side boiler plate in a couple of
cases and is a bit clearer than the magic {QString()} result anyway.

Change-Id: I105b6ab952981143b2abf9b218fed30cee80b648
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-01-03 14:04:00 +00:00
hjk
4a66cae854 ProjectExplorer: Use ids in RunConfigFactory:: setSupportedProjectType
More similar to what build/deploy uses.

Change-Id: Icf8bd7031d00a6e2831f8c1f3b1bdcaa8bf259b4
Reviewed-by: hjk <hjk@qt.io>
2017-12-19 09:42:01 +00:00
hjk
cc88302309 De-emphasize PluginManager::getObjects<Type>()
... by additionally keeping local (currently non-owning) pools per
"interesting" type.

Current situation:
  - The global object pool does not scale well for looking up
    objects, as iteration plus qobject_cast typically iterates
    over all pooled objects.
  - User code that can use typed results from the object
    pool need to have access to the full type definition anyway,
    i.e.  depend on the plugin of the target class anyway.

The patch here solves the scaling problem is to have local
type-specific pools to which objects register in their
constructors and deregister in their destructors.

This patch here does *not* change the ownership model of the
pooled objects, however, it opens the possibility to change
the ownership model per type (e.g. by not putting things into
the global pool at all anymore and make the local pool 'owning')
and the intent is to handle that in later patchs.

Even without the follow-up patches this here is a performance
improvement for the cases that access the local pools instead
the global one, i.e. "practically all".

Change-Id: Ib11a42df2c4ecf5e1155534730083a520dd1995b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-12-15 07:08:05 +00:00
hjk
53a151074a ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.

- Collapse the two lines of constructors similar to what
  890c1906e6 did for RunConfigurations
  * Deploy* was purely mechanical
  * Build* ctors are split in connects() in the ctor body
    to create "empty shell for clone" etc
    and build step additions in initialize() functions which
    are only used in the create() case.
  -- Allows to collapse the shared 'ctor()' functions, too.

- Move FooBuildConfigurationFactory::create() implementations
  to FooBuildConfiguration() constructor. That was a strange
  and unneeded ping-pong between factories and objects, and
  furthermore allows one level less of indirection (and for a
  later, left out here, some reduction of the
  FooBuildConfiguration interfaces that were only used to
  accommodate the *Factory::create() functions.

- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
  but there wasn't one in the base classses. Have one there.

- Most canHandle() functions were checking simple restrictions on
  e.g. project or target types, specify those by setters in the
  constructors instead and check them in the base canHandle()

- clone() is generally replaced by a creation of a "shell object"
  and a fromMap(source->toMap()), implemented in the base, there
  are two cases left for Android and Qbs that needed(?) some extra
  polish

- generally use canHandle() in base implementation, instead
  of doing that in all Derived::canFoo()

- as a result, canCreate/create/canClone/clone reimplementations
  are not needed anymore, keep the base implementation for
  now (could be inlined into their only users later), but
  de-virtualize them.

- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
  'dsym' build step they could create.

- Split the 'mangled' id into the ProjectConfiguration subtype
  specific constant identifier, and a QString extraId() bit.
  Only maintain the mangled id in saved settings.

- Make ProjectConfiguration::m_id a constant member, adapt
  all constructors of derived classe.

Not done in this patch:

- Finish possible cosmetic changes on top

- Add a way to specify restrictions to supported Qt versions
  (used in Android/Ios), as the base implementation does not
  depend on the qtsupport plugin

- Combine the QList<X> availableFoo() + createFoo(X) function
  pairs to somthing like a direct
   QList<struct { X; std::function<X()>; }> fooCreators()
  to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
  pingpong

- Remove the *Factories from the global object pool

- Do something about priority(). Falling back to plain
  qmake in android+qmake setup is not helpful.

Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-12-08 11:17:55 +00:00
hjk
1697f97aff ProjectExplorer: Register createes' base id in RunConfigurationFactory
This shifts the resposibility of creation/splitting of RunConfiguration
ids into what are essentially "type ids" and "build targets" to the base
implementation, possibly opening the path of abandoning the mangled ids
in favor of explicitly storing their constituent parts.

Take advantage of base id split in RunConfigurations for availableIds
/displayNameForId and for canCreate/canRestore/canClone.

Change-Id: I19fefb32757407ab5053a2ae0e5a79438659f6ec
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Filippo Cucchetto <filippocucchetto@gmail.com>
2017-11-27 07:23:17 +00:00
Tobias Hunger
58fd29e0ed ProjectExplorer: Do not add too many newlines
Do not add newlines when output gets flushed.

Task-number: QTCREATORBUG-17403
Change-Id: I0dea3a15611fcde8aa8cbc5fbc6b7f22c9c40dd7
Reviewed-by: hjk <hjk@qt.io>
2017-11-24 10:23:51 +00:00
hjk
d1c9b33eb7 ProjectExplorer: Add a RunConfigurationFactory::canHandle(Target *)
All RunConfiguration factories had some kind of canHandle(Target *)
implementation. Centralize this notion.

Change-Id: Ie24a355e857bddfd76b866859b8c7a42ffc83840
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-20 08:52:00 +00:00
hjk
9792547ef9 ProjectExplorer: Implement RunConfiguration::do{Clone,Restore} in base
It's possible now.

Change-Id: I49ed73312aea1627a9543890431e2e379e3fb3ec
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-11-16 14:08:33 +00:00
Eike Ziller
f58a617ea9 Merge remote-tracking branch 'origin/4.5'
Change-Id: Iab6befd5e713289877aa0a47b9ce6bddfb5e2593
2017-11-16 08:49:06 +01:00
Tobias Hunger
77bea93a6e RunControl: Make RunControl::canReUseAppOutputPane more robust
The pointer passed in was assumed to be non-null, but that does not need
to be the case.

This should make the function more robust in face of errors. The RunControl
passed into the method is taken from a QPointer. So if the RunControl is
destroyed, that pointer may be nullptr.

Task-number: QTCREATORBUG-19269
Change-Id: I42e7b9d5582df2ee0830c8f92af4e4a97e7d6417
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-14 14:19:58 +00:00
hjk
dfd4ad8c2d ProjectExplorer: Simplify IRunConfigurationFactory::clone() use
Change-Id: I005d6c87142d26dfc7ae1349329737a68f54c427
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-11-14 10:58:30 +00:00
hjk
5ca90a4a5e ProjectExplorer: Fix copying of RunConfigurationAspects
Moving aspect data closer to real Value semantics fixes
the regression introduced by 890c1906e.

Task-number: QTCREATORBUG-19186
Task-number: QTCREATORBUG-19192
Change-Id: Ieaeef3995ae06a817f266c1e2514f9e5793bd4e8
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-11-10 15:09:59 +00:00
hjk
7c26e3336f Kill RunWorker start/stop watchdog times in case of reportFailure
Change-Id: I2eb4d9667482edbaafe6bf780a94e440c2d39881
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-10 13:55:06 +00:00
hjk
5f09b3234e ProjectExplorer: Make RunWorkerPrivate::runControl const
It's not meant to ever change after contstruction.

Change-Id: I912b58dfb70b40c9763b902650d2c657c28ccc5c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-27 11:57:36 +00:00
Eike Ziller
19bb8e34f8 ProjectExplorer: Fix translation issues
Add missing Q_OBJECT macro, use sensible contexts, and use "simpler"
namespace resolution (for QTBUG-64007)

Change-Id: I2417a7a40e8ba0ff4bfdff34d2a4c57d8dcdeb00
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-10-24 14:31:15 +00:00
Christian Kandeler
9a493f8b83 Fix using (local) custom run configuration with non-Desktop kits
For targets such as remote Linux, we would run all run configurations on
the remote device, even "custom run configuration", which is explicitly
intended for running locally.

Task-number: QTCREATORBUG-19121
Change-Id: I83d6bdd8a47440047d230266845286715432604a
Reviewed-by: hjk <hjk@qt.io>
2017-10-24 12:30:01 +00:00
hjk
3d11a27ad0 Debugger: Consolidate "Attach to running process"
Change-Id: I78e89a662140f37f5f9719dbbbff070f1e2fbe84
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-19 08:31:33 +00:00
Christian Kandeler
63a472a81a Fix run control startup message for remote targets on Windows
The exectuable path in the user output was always converted to native
separators, even for non-Desktop targets.

Change-Id: I5b43b2da8a2b791472a1fd58940b179dcbaa28d0
Reviewed-by: hjk <hjk@qt.io>
2017-10-17 08:49:15 +00:00
hjk
4fa869f6a0 ProjectExplorer: Provide optional callbacks to RunWorker timeouts
Useful in some more complex setups.

Defaults to the tradionally unconditional reportFailure().

Change-Id: I26acaace1fa1e12caf83b785e4be539d8af7eb73
Reviewed-by: Filipe Azevedo <filipe.azevedo@kdab.com>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-10-16 08:55:08 +00:00
hjk
f3afac128b ClangStaticAnalyzer: Avoid use of DummyRunConfigurations
This moves the explicit build step into a dependent runWorker,
making the whole setup more aligned with a normal tool run.

Change-Id: Icd01b2e82f7f95774434d2ede04d08a5311b64e7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-26 11:19:40 +00:00
hjk
7f2cb9ead9 ProjectExplorer: Allow user stopping ill-behaved RunControl
If a RunWorker fails to report success or failure (should not happen in
theory, but has been observed in practice, typically in exceptional code
paths) the RunControl will stay in 'Starting' or 'Stopping' state
forever. Give the user the opportunity to force a 'Stopped' state by a
second (or when 'Running' a third) time on the Stop button.

Change-Id: Iec58434927777bd67bfe01c5144ee5695b4d6cf1
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-09-13 13:40:02 +00:00
hjk
890c1906e6 ProjectExplorer: Re-organize RunConfiguration constructors
The idea is to massage the setup in a way to make implementation
of new configurations less error prone by identifying recurring patterns
and sharing repetitive code that tends to be forgotten (see Android cloning).

The former two lines of constructors (owner-and-id, owner-and-source)
are split into a simple, shared, constructor and new setId() and
copyFrom() functions.

The change is mostly mechanical, some multiple calls to fromMap
have been removed, though, some consts added.

Otherwise, to keep the patch small it temporarily introduces two
helper templates in IRunConfigurationFactory. Also, setId() signatures
have not been unified yet. These won't be needed in the final setup.

Change-Id: I8c0734496caae744a9883fe6d92c1d8f8e0234ea
Reviewed-by: hjk <hjk@qt.io>
2017-09-13 09:24:26 +00:00
Eike Ziller
ddd9e96afa Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/libs/utils/utils-lib.pri
	src/plugins/clangcodemodel/clangbackendipcintegration.h
	src/shared/qbs

Change-Id: I240e89afc76d8f40ce69d66683014b603f714707
2017-08-23 12:12:41 +02:00
hjk
db005bf5eb ProjectExplorer: Workaround for displaying startup failures
Failures during RunControl construction currently get not to
the user as the Application output pane is not yet available.

In theory it should not happen, rather the condition should
be checked to disable running entirely, but in practice it
can happen e.g. in the BareMetal setup right now.

To avoid pre-release code restructuring, force a message box
in such cases.

Change-Id: I703c47b270d153afff34e08dad7833540a5983a2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-08-18 10:11:14 +00:00
Eike Ziller
d8fd5292f1 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/tools/clangbackend/ipcsource/clangiasyncjob.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.h

Change-Id: Ib8602530663813ade418f995dfd2a736908cfe75
2017-08-15 10:07:51 +02:00
hjk
c839e86863 ProjectExplorer: Introduce RunWorker::reportDone()
To be used for short-lived tasks to signal that they are done.
Essentially an optional reportStarted() followed by reportStopped()

Using it in GdbServerPortsGatherer when the port list is ready fixes
the wrong "un-stopped" situation in RemoteLinux debugging when
the inferior finishes by itself.

Change-Id: I310831a7875fe6f2c598302b73cda6c9669efb1d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-08-09 14:12:45 +00:00
Ulf Hermann
68e8a56b3b ProjectExplorer: Introduce an "essential" flag for RunWorker
An essential RunWorker triggers the whole RunControl to stop if it
spontaneously stops.

Change-Id: Ia05b927e306022e99b45cc8cd7ab9636f4d3c129
Reviewed-by: hjk <hjk@qt.io>
2017-08-09 12:25:11 +00:00
hjk
4023e56d42 ProjectExplorer: Allow RunWorker::Starting -> Stopping
Can happen on worker startup, e.g. missing binaries, permissions, ...

Change-Id: Ibeee0a6992af80d3486b00890664e83525f17204
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-08-09 12:16:27 +00:00
Ulf Hermann
a62f882c42 ProjectExplorer: If a worker fails while we're stopping, continue
We don't need to re-initiate the stopping.

Change-Id: I2c19dca854c93e0340227d08a381c3bde919363d
Reviewed-by: hjk <hjk@qt.io>
2017-08-09 11:55:07 +00:00
hjk
96dd315f61 ProjectExplorer: Remove RunWorkerState::Failed
It is always acted upon essentially the same as Done, but
complicates the scheme.

Change-Id: I8d9161fb162195a533c7ed29e251c3f486479dc9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-08-09 08:01:43 +00:00
Ulf Hermann
c392d3ee13 ProjectExplorer: Kill dependent RunWorkers if dependencies go away
There is no point in e.g. keeping the QML profiler RunWorker going if
the process has spontaneously stopped.

Change-Id: Ifdae17231cb193fd220397fa0739a74871ceeab3
Reviewed-by: hjk <hjk@qt.io>
2017-08-08 14:12:38 +00:00
Ulf Hermann
a028f6717f ProjectExplorer: Add stop dependencies for RunWorkers
A run worker will only be stopped if all its stop dependencies are
stopped.

Change-Id: I16a42253874adafb9ca87d175bfb361fae46cc39
Reviewed-by: hjk <hjk@qt.io>
2017-08-08 13:58:36 +00:00
Ulf Hermann
8b5582c424 ProjectExplorer: Rename worker dependencies to "startDependencies"
There will be stopDependencies, too, which apply when stopping the
runcontrol.

Change-Id: Id72771d28cbb6b254572c9f93db93e0d054b890f
Reviewed-by: hjk <hjk@qt.io>
2017-08-08 13:57:38 +00:00
hjk
3d25d2d96c ProjectExplorer: Add some basic RunWorker documentation
Change-Id: I06dfdf3d20d0bd040dd96d9ebd5c0542afbde1aa
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2017-08-07 09:31:32 +00:00
Tobias Hunger
ef2f2804a1 ProjectConfiguration: Add isActive() method
Returns true if the ProjectConfiguration element is currently active
and false otherwise.

Just a convenience method.

Change-Id: If75809ae7e78149d264deaaf6adc4ca8a8be43c2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-02 11:18:52 +00:00
Tim Jenssen
afbfcf8d70 ProjectConfiguration: Add project() member
Change-Id: I0a7170c1721a9e5bcf18af1bab8158af71c64454
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-31 13:20:48 +00:00
Tobias Hunger
131c7a1c4e ProjectExplorer: Introduce base class for enabled/disabled project configuration
... and use this as a base for all RunConfigurations.

Clean out code in the individual run configurations dealing with their
enabled/disabled state.

Change-Id: Icc2ea136b056f7aea7ce96480b4402459d7ac0ce
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-28 17:26:03 +00:00
Leena Miettinen
97a6dc2c36 ProjectExplorer: Add punctuation to ends of messages
Change-Id: Idaa794204b87b5a139203a6d183935425ecfd67e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-28 08:24:38 +00:00
hjk
a54cba428a ProjectExplorer: Fix crashes on shutdown
Ensure that RunControls ramp down asynchronously.

Since RunControls now ramp down asynchronously the plugin can
only report synchronous shut down if no RunControl/OutputPane
was present.

Task-number: QTCREATORBUG-18605
Change-Id: Ib8d1f857f85c74d4f18ecb85db537121a2275668
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-07-20 13:50:31 +00:00