Commit Graph

188 Commits

Author SHA1 Message Date
Christian Kandeler
65db684c7d ProjectExplorer: (Re-)Add run config variables
As for the build config, we provide a global variant for use by external
tools, and one for use in the respective run configuration itself.
Also hide the deprecated "CurrentRun" variant, which was forgotten in
b55825a420.

Fixes: QTCREATORBUG-25561
Change-Id: I51aaff10301f7ff1256abf1c09ac9f5be136ab00
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2021-04-08 13:22:39 +00:00
Orgad Shaneh
3122a1bfc5 Aspects: Remove some more default values
Change-Id: Iadee8b8f1eeb3ff009a667d45a51f6f5a94329ca
Reviewed-by: hjk <hjk@qt.io>
2020-11-10 08:06:51 +00:00
Leena Miettinen
f2254419af Project explorer: Fix UI text
Fix punctuation.

Task-number: QTCREATORBUG-24873
Change-Id: I5cc5e80915b891efa2cd2268e3302feb39b7a576
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-11-09 09:52:12 +00:00
Thomas Hartmann
98a649ccfd Fix crash for missing BuildSystem
There is no gurantee that a Target has a BuildSystem.
Target::additionalData() does expect a BuildSystem.

Task-number: QTCREATORBUG-24817
Change-Id: I41edf89fa6dbf6ed24a27129b8353a9506b7b176
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-10-22 13:34:09 +00:00
Christian Kandeler
b55825a420 ProjectExplorer: Clean up variables
Global variables with names such as "CurrentProject*", "CurrentKit*" etc
are harmful, because the term "current project" as used in Qt Creator
does not refer to the "active project", but simply stands for the
project that contains the node that is currently selected in the project
tree, which in turn may or may not correspond to the current editor
document, depending on the "sync with editor" setting. In other words,
the "current project" is almost a random value with little meaning
outside the project tree itself.
Therefore, we remove "CurrentProject*" and friends, except the ones that
are currently intentionally in use. The latter get renamed to
"CurrentDocument:Project*", so their purpose becomes clear. Their old
names are kept around for backward compatibility, but are not suggested
by the variable chooser anymore, so new usages are unlikely and we can
remove them at some point.
We also add some ActiveProject* variants that have been requested in the
past.
Also remove the "CurrentSession" prefix that was deprecated six years
ago.

Fixes: QTCREATORBUG-12724
Fixes: QTCREATORBUG-24606
Change-Id: Ibba5d0e0ce3d2beb444a5eec01fbb9b745d90a1d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2020-10-02 07:49:08 +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
hjk
beee392dd8 ProjectExplorer: Consolidate RunConfigurationFactory::ids
It was already only one id string with two names. Since it is not
an id for the factory but the id of the created run configuration,
settle of  runConfigurationId() as accessor.

The factory and id fields in RunConfigurationCreationInfo were
redundant. factory always implies (runconfiguration)id (but not
necessarily the other way round, in theory different factories
are possible for the same runconfiguration type for different
devices). So drop the id field here.

In one case now factory pointers instead of ids are compared, but
this is neutral there as this happens in a context of a fixed Target,
device and project are fixed there, so id and factory are equally
unique.

Change-Id: I859aa91486a2dd4abfc7369540a3322d6ec6260d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-06-15 12:13:38 +00:00
hjk
f83347ec00 ProjectExplorer: Introduce an Targer::activeBuildKey()
... redirecting to activeRunConfiguration()->buildKey()

This will allow the user code side to be moved closer to a setup
that will allow to shift the build data stored in project nodes
to the build system.

Change-Id: Icdf03e77bf61ee03b3a16855ac67652c205402fa
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-04-01 13:19:50 +00:00
hjk
dd980e23f8 ProjectExplorer: Remove Target::applicationTargets()
That's BuildSystem::applicationTargets() nowadays.

Change-Id: I01cf0a491e4cb289af08f529fd15c85bfcdf5493
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2020-03-25 10:42:22 +00:00
Christian Kandeler
4657563e4a ProjectExplorer: Try harder not to lose custom project settings
... when a kit disappears.
This can easily happen, for instance due to a Qt version update via the
installer, and until now resulted in the disappearance of all user
customizations of build and run configurations.
We now store some additional data when serializing a target, and use it
to recreate a kit of the same type upon restoring. While the resulting
configurations are not guaranteed to be functional, they should contain
all the customizations, which the user can then copy over to a proper
kit.

Fixes: QTCREATORBUG-23023
Change-Id: I659d52808b2f8a308e6aa094e8ef2ee60d586952
Reviewed-by: hjk <hjk@qt.io>
2020-03-19 14:28:40 +00:00
Eike Ziller
995ba78fae Merge remote-tracking branch 'origin/4.12'
Conflicts:
	src/plugins/cmakeprojectmanager/tealeafreader.cpp
	src/plugins/cmakeprojectmanager/tealeafreader.h
	src/plugins/projectexplorer/miniprojecttargetselector.cpp

Change-Id: I88d85be3903f57a55fddb7901e771a4822db1b85
2020-03-04 08:15:50 +01:00
hjk
6164378372 ProjectExplorer: Replace a few foreach()
Change-Id: I445cdfaac13ac894be3cd6fc8c20b4a09f460a01
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-03-02 11:54:00 +00:00
hjk
fb447f9999 ProjectExplorer: Trigger updates more directly
Changes of active run and build config impact some visible state, but
instead of connecting and disconnecting signals to the target, make the
call explicit.

Also, triggering only updateAction is sufficient, as this will already
run updateRunAction. This makes the number of doUpdateRunAction calls
when opening a normal QMake project with one target, three build configs
drops from 17 to 15.

There was some mechanism on the receiver side originally meant to
prevent excessive updates, which broke with 7ae3589 when remembering the
previous configurations was accidentally removed.

This here drops the mechanism completely, as active changed signals
would not trigger twice in succession for the same config anyway.

Change-Id: Id9f87e542d8871733966ab79118734b7e9ad1e8a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-28 15:31:52 +00:00
hjk
7f1c8aea5d ProjectExplorer: Make communication between target and selector direct
Architecture-wise, this now means that Target knows about the
MiniProjectTargetSelector, otoh, Project does less, and quite
a bit of signal, slot and qobject_cast is gone.

Change-Id: I0feef9328144282c7c4ca710a12ac0e495810684
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2020-02-20 11:45:48 +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
Christian Kandeler
c4254722df RemoteLinux: Let user override deployment data
That is, instead of what is specified in the project files of the
respective build system, let the user manually set the data in the
deploy configuration.
This is intended as a last resort for use in project managers that are
not able to deduce any deployment information from the project.

Fixes: QTCREATORBUG-21854
Change-Id: I2fefb89a4aa846e52aeca69749ca03534f4f0a67
Reviewed-by: hjk <hjk@qt.io>
2020-01-27 17:32:16 +00:00
hjk
c8137bdcf9 ProjectExplorer: Consolidate some Session::active* accesses
Change-Id: I47b0f6c2c60b2f7c86b6ffd1ad3df393d1321c8b
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-29 08:39:07 +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
Eike Ziller
646c7860cb Merge remote-tracking branch 'origin/4.11'
Conflicts:
	src/plugins/genericprojectmanager/genericprojectplugin.cpp
	src/plugins/projectexplorer/environmentaspect.cpp
	src/plugins/projectexplorer/environmentaspect.h
	src/plugins/projectexplorer/environmentaspectwidget.cpp

Change-Id: Id21d62cf14419febd1e06c9b429fcdf4501c0eaf
2019-11-11 12:58:11 +01:00
Christian Kandeler
88b4d44c50 ProjectExplorer: Do not set run config display names unnecessarily
... when restoring a target.
The run configuration may not have its default display name yet, in
which case all but the first restored run configuration would get a
number as its display name.

Fixes: QTCREATORBUG-23123
Change-Id: I5068cb85b67166357e0a88fb9638131a24e1340f
Reviewed-by: hjk <hjk@qt.io>
2019-11-07 15:45:35 +00:00
hjk
5e4d13f343 ProjectExplorer: Remove unused Target::{is,set}Enabled
Change-Id: Ie36af0b57fb77c4c1ddb92ca5a6d92746577ad11
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-11-04 13:12:05 +00:00
Christian Kandeler
139196b93c Fix restoring cmake run configurations
Amends 5bcd59c94f.

Fixes: QTCREATORBUG-22932
Change-Id: I46b42f0e15eaf1fe4bd2f1ea4a87286ee68cfee8
Reviewed-by: hjk <hjk@qt.io>
2019-10-17 13:11:09 +00:00
Eike Ziller
fcb12a275f Merge remote-tracking branch 'origin/4.10' into 4.11
Conflicts:
	cmake/QtCreatorIDEBranding.cmake
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/plugins/cmakeprojectmanager/cmakebuildconfiguration.cpp
	src/plugins/projectexplorer/deploymentdata.cpp
	src/plugins/projectexplorer/msvctoolchain.cpp

Change-Id: I64c304fc71435629a6a0060a9df71e8952699508
2019-10-16 15:27:22 +02:00
Christian Kandeler
d56e88d36a RemoteLinux: Fix look-up of remote file path in deployment data
If the deployment configuration contains an "install into temp dir"
step, then the local file paths of the binaries built by the build tool
will not be in the list of deployable files, because all deployables
come from the temporary install dir. Therefore, look for just a file
name match as a fallback.

Fixes: QTCREATORBUG-21235
Change-Id: Ie3fad515515b4f28cc6bdef1254f4c05a0557569
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-10-10 07:42:18 +00:00
hjk
423f516cf5 ProjectExplorer: Remove Project::aboutToRemoveProjectConfiguration()
Nobody listened to that signal.

Change-Id: I456d663fdec7ac67507a8f9f7ed1e5d7b520b7cc
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-20 11:05:03 +00:00
hjk
16b9a47e83 ProjectExplorer: Replace Project::projectConfigurationChanged
... by a Project::buildConfigurationChanged. That's the only case
used, and saves filtering on the receiver side. Also, the passed
bc is (in non-null) the active one, so isActive checks are not
necessary.

The null case seems to be only possible to trigger when removing
the currently active build configuration manually i.e. happens rarely,
so having it trigger an unneeded final display update on the dying
build config is tolerable, so drop the null check in such cases
to achieve a more uniform pattern.

Change-Id: I46f72e9e277767214dbd6920dd86b026a7084f46
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-02 13:59:31 +00:00
hjk
4c80380478 ProjectExplorer: Remove Target::*ProjectConfiguration(...) signals
The only listener left is the target's project, which is known at each
emitting location and can be called directly.

Change-Id: If07d2c1c43fcf5d2094c0b6d59f773d12b4f6d6b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-01 15:23:25 +00:00
hjk
0d6468a8af ProjectExplorer: Don't remove build configuration
... before announcing it and trying to remove it a second time.

Change-Id: I0f0238974fa317051d99b8f096cfc472e4f0cbe3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-31 15:20:06 +00:00
hjk
4461efdfbb ProjectExplorer: Move *ConfigurationModel ownership to target
The models hold essentially duplicated information besides the actual
configuration lists that are already in the target and are only
used in a context where the target is known and accessible.

As the models keep track of all added or removed configurations
and can be fed configurations of the right types only, the need
to filter is gone.

Change-Id: Iec2c6879223893297c71e7632310ac526b704237
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-31 11:36:55 +00:00
hjk
7d3091a7b9 ProjectExplorer: Remove ProjectConfiguration base from Target
Targets are different from {Run,Build,Deployment}Configurations,
both regarding the level in the ProjectExplorer hierarchy, and
also by the set of supported operations (e.g. aspects).

Change-Id: Ia8490e2280a9ecc518395c5e48ce2fd5d6d58fd2
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-31 11:18:16 +00:00
hjk
d16330de6d ProjectExplorer: Add a ProjectConfiguration::target()
... with a suitable default implementation accessing a member
populated at construction time instead of walking the parent
chains on each access.

Change-Id: I58dae6da80ed0b023cc603fca13a5a205b123672
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-29 12:06:19 +00:00
Christian Kandeler
b1dbd7e358 ProjectExplorer: Update run config list centrally
This prodecure requires no further information from the specific project
managers, so we can start it from the ProjectExplorer itself.
Also wait until after project parsing has officially finished and the
run configurations have updated their "enabled" state. Otherwise,
RunConfiguration::isEnabled() will always return false, potentially
leading to the active run configuration getting switched
unintentionally.

Fixes: QTCREATORBUG-21692
Change-Id: I32f4f758b5baa6222329d07b811993568eff1ee3
Reviewed-by: hjk <hjk@qt.io>
2019-07-22 14:02:57 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
hjk
6a58666f44 More Utils::toSet/toList
... and unrelated cosmetic changes.

Change-Id: I591b17fd5289831e701b683f8fb47816efd1fa67
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-04 12:28:38 +00:00
hjk
e7c6169d70 ProjectExplorer etc: More FilePath usage
Mostly for project files.

Change-Id: Icb6059f80758865e42cc9f9c092ec6782770dfd7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-26 16:02:23 +00:00
hjk
ce449e4219 ProjectExplorer: Remove BuildTargetInfoList wrapper class
Change-Id: I1a2ae06ec8c5b7278abca2386834d7edd31597d7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-14 13:30:34 +00:00
hjk
1de548d1cb Revert "ProjectExplorer: Upstream CMake's handling of outdated builds"
This reverts commit 8536504caa.

Break CustomRunConfigurations.

Change-Id: I43020bd34780cb5fd02bbe640a817370d73cca18
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-05-03 16:05:34 +00:00
Christian Kandeler
261d7752b0 RemoteLinux: Retrieve deployment info from local install root
This provides correct deployment information as seen by the build system
when Qt Creator cannot retrieve it directly.
It's most useful for autotools and cmake projects, but can also help
with qmake in certain edge cases.

[ChangeLog] It is no longer necessary to provide a
QtCreatorDeployment.txt file when using CMake projects with remote Linux
devices.

Fixes: QTCREATORBUG-21855
Change-Id: I27e07a45dd1565e489f4b573cc3fff8191c57d9b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-04-23 15:52:05 +00:00
hjk
8536504caa ProjectExplorer: Upstream CMake's handling of outdated builds
This is mainly there to make the local runconfiguration implementations
more uniform. Both qmake and qbs will drop runconfigs for builds that
are not available anymore, so that's a no-op for them.

Change-Id: I8aa32d779f67cce7a4d4733cfbe0c9a136bfd3f7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-22 12:35:14 +00:00
hjk
ea9dad4719 ProjectExplorer: Introduce Target::buildTarget(buildKey)
A convenience wrapper for

   applicationTargets().buildTargetInfo(buildKey),

the only context using the BuildTargetInfoList member.

Also, only one of the free comparison functions is ever used,
only in one place. Inline it there.

Change-Id: I7565e9d51d429af34352649e235243e5b3328fe9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-02-20 11:27:16 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
hjk
9bb936499d ProjectExplorer: Collapse BuildInfo hierarchy
... to pass it around as real values, avoiding, among others,
the need of occasional explicit deletion.

The formerly extra members of the derived stuff are handled via
an extra variant (for data) and via a functor in the build
configuration factory.

The change is mechanical.

Change-Id: I19ca4e0c5f0a5b196fc16dfb98bb005dc679f855
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-30 16:51:05 +00:00
hjk
070e0efdcc ProjectExplorer: Rename IBuildConfigurationFactory
... to BuildConfigurationFactory. It hasn't been an Interface for a
while and the new name matches Run- and DeployConfigurationFactory

Change-Id: I923c6a27e18a99628251b69e0270e910836e7b2a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-29 11:38:31 +00:00
hjk
7f3de881e3 ProjectExplorer: Remove some Id use from DeployConfig interface
There's a 1:1 relation between the involved types, having either
the factory or the id implies having the other. So shorten interfaces
that used both so far. Also canCreate() == canHandle() && id matches,
so use that directly.

Also drop/QTC_ASSERT former canHandle() checks that are implicit
in preceding ::find() calls.

Change-Id: I686ea5774c5a01b05b3b4882b3d59080a812a677
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-24 13:09:13 +00:00
hjk
a2d5ebccd2 ProjectExplorer: Simplify availableCreationIds(Target *parent) use
Similarly to before, it's either an empty list, or a single id.

So use a function with bool return saying whether an id is returned
and a plain accessor the the id.

Change-Id: Ied2900f23bdb4c264d9fb1944c60bed734d1d8bb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-16 10:26:47 +00:00
hjk
7c547eba9b ProjectExplorer: Add an option for automatic generation of runconfigs
Default to 'on'.

Task-number: QTCREATORBUG-18578
Change-Id: Ib430542b00d93138827fe8930db6a4e5a03c014c
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-08-30 10:02:33 +00:00
Christian Kandeler
2485eb1a8c QmlDesigner: Do not require a qmake project for designer import paths
Let's enable all build system plugins to provide this information.

Task-number: QTCREATORBUG-20810
Change-Id: I0ef953e3c2c9a2be1fc4187e93232e9a2aeacafd
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2018-08-20 12:44:41 +00:00
Tobias Hunger
80c2ce118d ProjectExplorer: Modernize even more
Use unique_ptr for all *Private classes, except for those
in singletons.

Change-Id: Ib56c31ddedc6e9cf321f15de1f1e697a27ad4089
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-24 09:04:54 +00:00
Eike Ziller
bb28b10add Introduce static_container_cast
Casting all elements of a container, similar to qobject_container_cast.

Change-Id: Ib455fe8c7fa0d4acda7e29685c3100638a0152f8
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-29 13:44:51 +00:00
Eike Ziller
c8c6b28e22 Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h

Change-Id: I192b9e88f967182f3275b4b98abed1220c26daac
2018-05-28 16:10:23 +02:00