Commit Graph

222 Commits

Author SHA1 Message Date
hjk
a6c85993ba ProjectExplorer: Propagate build environment changes more directly
To check this still works I used a CustomRunConfiguration with
a executable name $AAA, the tooltip there tries to expand that
(and complains that $AAA is not an executable).

By inserting a AAA=/bin/ls in the build environment, the tool tip
on the run config exectable path chooser changes appropriately,
same for changing the AAA value.

The connection seems also needed, dropping it destroys that updating.

Change-Id: I28965cbd3ce530a83d98808ca7624a6799cd9800
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-26 12:05:52 +00:00
hjk
251287f0d3 Avoid warning on empty expressions
For some reason, Q_UNUSED includes already a semicolon, adding one
on the user side creates an additional empty statement.

Change-Id: I9c5e8fac381345a60792cb75e2938fd53958d3b0
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-23 11:55:59 +00:00
hjk
5dbfd46bcf ProjectExplorer: Merge BuildConfigurationFactory::availableBuilds
... and availableSetups as far as mechanically possible.

Change-Id: Ia1d7babe943eea25da97cef7838187c234378673
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-27 14:19:53 +00:00
hjk
f94e55b807 ProjectExplorer: Align signatures of BuildConfiguration
... availableBuilds() and availableSetups().

Goal is to merge them and inline all the local createBuildInfo()
functions.

Change-Id: I9f19093163808b6da6dc83977894420e08a1edd9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-27 13:59:39 +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
Marco Bubke
4bae5de36b Enable macro editing for the Clang indexer
Refactor much of the code from Environment* classes to NameValue* classes
to share it with the preprocessor macro settings.

Change-Id: Ica4ee817aa338230c422b30d91240d266248d226
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-06-13 16:51:48 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
2b1c8aa877 ProjectExplorer: Introduce a alias for QList<Tasks>
Change-Id: I91391ad22b420926b0f512cac23cfe009048b218
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 05:51:40 +00:00
Christian Kandeler
be9bd1505b ProjectExplorer: Trim value of build directory
... coming from the line edit. Nobody enters a build directory with
leading or trailing spaces on purpose.

Fixes: QTCREATORBUG-16805
Change-Id: Ic33f126fb9c4c0d008ebeaf00a78c737729be623
Reviewed-by: hjk <hjk@qt.io>
2019-05-27 15:23:39 +00:00
hjk
44e97b3055 ProjectExplorer: Inline convenience overload that was used just once
Change-Id: I4b695a07b60df0d197f549657e0ce23ca4fe5ccb
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-03 14:14:26 +00:00
hjk
02ab64f239 Nim: Aspectify NimBuildConfiguration
Change-Id: Iccf81e3a089a6b6d756aace99c5051dc7349b6b9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-30 09:06:30 +00:00
hjk
8e1e312273 QbsProjectManager: Aspectify QbsBuildConfiguration
Change-Id: Ifff6b770b9c6e2313809b35eef041c674df362e4
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-30 09:04:38 +00:00
hjk
a64b969f6f ProjectExplorer: Consolidate setup of build dir aspect
This is getting repetitive.

There's a new connect too, that's not wrong in the current two uses
and will be helpful in the upcoming Qbs one.

Change-Id: I4a4923a43937922c66be1f73822103b1e3e7b077
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-04-29 12:05:38 +00:00
hjk
3941f0593b AutoTools: Use the base BuildConfiguration config widget
Change-Id: I928b9bc7adc3424008ead27fe8457d345e1bcda5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-29 09:04:45 +00:00
hjk
34eb195358 ProjectExplorer: Use a BaseStringAspect for build config build dirs
Just for the "storage" part with this change.  Plan is to also
use the gui parts one-by-one in the BuildConfig reimplementations.

Change-Id: Ie5e4e701eea8d83336103654c708f4f1ab8132e8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-26 15:28:20 +00:00
hjk
0a8546ab13 ProjectExplorer: Add a BuildConfig::createConfigWidget() implementation
Mimicking the other aspect-unsing setups. It is currently re-implemented
in all derived classes, i.e. unused.

Change-Id: Ia1c16318347baa13a869d3eb03717a0f5ff0d8f8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-26 15:26:48 +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
Christian Kandeler
8bc7e04012 ProjectExplorer: Fix build directory expansion
QDir::cleanPath() must be called on the expanded path, otherwise it
messes with the data. For instance, QDir::cleanPath("%{a:b}/..") yields
".".

Change-Id: If55b9c7a733097cb36f62fbdae49fe03b542fcdf
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-02-07 12:06:35 +00:00
hjk
a235d33837 ProjectExplorer: Remove BuildConfigurationFactory::priority
It's essentially an intrusive hack that's used only to prioritize
Ios+Qmake over plain Qmake. The effect is now achieved by an
arguably equally evil dependency on the construction order of
BuildConfiguration factories.

It can be argued, however, that this is a feature as it allows
user plugins to intentionally override core functionality by
using the standard setup pattern and depending on the to-be-
overridden plugin.

Change-Id: Ic1efa305daf3ca19a880d2a7ccb40e2768d8f57c
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-31 14:33:05 +00:00
hjk
4ae0ad3ab5 ProjectExplorer: Use a addSupportedTargetDeviceType function
... also for BuildConfigurationFactory, similar to Run and Deploy.

Change-Id: I453f08bf145d6a2e764d150646c698d624ae2ce9
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-01-31 14:32:54 +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
Tim Jenssen
a78e3e5dd5 use initializer lists
Change-Id: I82b04601f1db52197b3dc625b6b7e0f143c1c8b6
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2019-01-21 15:10:54 +00:00
Alessandro Portale
8d19333075 ProjectExplorer: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-default-member-init
modernize-use-equals-default
modernize-use-transparent-functors

Change-Id: Iebed22caa2e733d292f334e956e3d16b844e14e3
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-16 10:01:53 +00:00
Tobias Hunger
e20075f8cf ProjectExplorer: Trigger environment evaluation on current project change
This makes e.g. %{CurrentProject:VcsTopLevelPath} in the kit's
environment much more useful.

Task-number: QTCREATORBUG-20752
Change-Id: I4bf49e61a7a7281a6c9bf039a1d9118b6e4060ef
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-13 11:06:28 +00:00
Tobias Hunger
9452c36025 ProjectExplorer: Simplify BuildConfiguration a bit
Change-Id: Ia44049039c32a598b6da212290d339b8f3705835
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-07-13 11:05:59 +00:00
Tobias Hunger
22568df2e8 ProjectExplorer: Small header cleanup
Change-Id: I110320198363f4d349d709c28bafcefebf9ff267
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2018-07-12 11:04:54 +00:00
hjk
18b2865834 ProjectExplorer: Add a BuildConfiguration::regenerateBuildFiles
That's effectively a generic hook for "re-run qmake" without the
qmake/QmakeProjectManager dependency.

Change-Id: I236d40690cde9047831422b2651ed2284b220959
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-10 09:57:55 +00:00
Tobias Hunger
460fdc02e0 ProjectExplorer: Report project-specific kit errors/warnings
Report project-specific warnings about the kit used in Project Mode.
E.g. a python project should not complain about missing toolchains,
while a qmake project should.

Change-Id: I5ce6742683cdeffc7ff3f1a3e8f0b89aee9aa0b4
Reviewed-by: Thomas Hartmann <thomas.hartmann@qt.io>
2018-04-19 13:21:45 +00:00
hjk
66d18ce07f ProjectExplorer: Simplify IBuildConfigurationFactory interface
Following the RunConfigurationFactory lead this replaces
f = Foo::find(); f->do() by static Foo::do() stanzas.

Also de-virtualize/private-ize IBuildConfigurationFactory::canCreate()
as it is only a local helper nowadays.

Change-Id: Id36ba514f426ebd054592189aa29c170ba00d92f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-04-04 10:14:22 +00:00
hjk
048a05584c ProjectExplorer: Fix handling on restrictions of usable kits
Fixup after 45d6a34f: An empty list of target device restrictions
means 'no restriction'.

Change-Id: I15773e75e58c3ba543d62e13d728cf08dccc3650
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-11 10:48:14 +00:00
Vikas Pachdha
45d6a34f1e Android: Fix BuilConfiguration priority calculation
Check the supported devices and return the base priority set by the
factory implementation

Task-number: QTCREATORBUG-19573
Change-Id: Ieae68a618d625b3f16f205e544f4626e6a410b91
Reviewed-by: hjk <hjk@qt.io>
2018-01-10 11:37:57 +00:00
hjk
280b7e2109 Ios: Use device types as restrictions on project configurations
Change-Id: I3c31f14eba9d9f68a333a814bea800a3da38d4a2
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
2017-12-19 09:16:45 +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
Robert Loehning
b054e1b1f5 BuildConfiguration: Check return value of fromMap
Change-Id: I18edefc20ff962720f36192121e3f6e341b1bcbc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-12-12 14:30:00 +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
Tobias Hunger
78ef474c71 Qmake: Set up environment for initial project parsing
Set up a better environment for initial project parsing (before Kits
are configured).

Task-number: QTCREATORBUG-19241
Change-Id: I2431113dbbe6fb6a66f95fb1efb36834fa184f3d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-28 16:33:47 +00:00
Tobias Hunger
03e629e5f9 ProjectExplorer: Handle Macros in build directory
Macros in build directory were not consistently expanded, so building
failed (at least in qmake projects).

Task-number: QTCREATORBUG-18601
Change-Id: I7ab06a1b969866748cf4062d1c820e5830efe281
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-06 09:24:09 +00:00
Tobias Hunger
813212396b BuildConfiguration: Make method name clearer
Make it clear that emitEnvironmentChanged also updates the cache of the
current environment.

Change-Id: I012c5a2b3d7d4037ed609b26e053ce0ce36f6cec
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-18 14:36:28 +00:00
Tobias Hunger
10cb0b77a0 ProjectExplorer: Do not prepend compiler path to PATH everywhere!
Do not unconditionally prepend the (c++) compiler path to PATH for
all projects using GCC-derived toolchains.

Prepend the compiler path in the Qmake- and GenericBuildConfigurations
instead.

Also change the order: Apply buildconfiguration's addToEnvironment first,
only then apply the kit's addToEnvironment.

This does change a few things:
 * CMake and Qbs will now get the normal PATH
 * MSVC compilers will have their compiler path prepended to PATH
   by the effected BuildConfigurations. This should be harmless,
   since that happens before the environment setup script is appended.

Task-number: QTCREATORBUG-18714
Change-Id: I548182bc447d80d24f4de4ce7cf12ee1a753ed26
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-18 14:35:07 +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
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
4672624bdc ProjectExplorer: Add CurrentBuild:Env to the MacroExpander
Make BuildConfigurations provide %{CurrentBuild:Env:VARNAME} via the
macro expander infrastructure.

Change-Id: I1bed8c6aa9003c361a07fa69a5a3840f7a4e0d17
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-27 15:40:56 +00:00
hjk
532c9d49ac QmakeBuildConfiguration: Pass build dir to base setter
Change-Id: I55bd47d62ef644257b49d3423c4d43a6443564aa
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-05 09:20:55 +00:00
Tobias Hunger
4c0dec4ecd IBuildConfiguration: More const
Mark member function const.

Change-Id: I0ebdeec625ea5c6d315d5e73793f7acb6f927b39
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-08-26 13:14:01 +00:00
hjk
c94ce7b205 Remove BuildStepList::isNull
It's not really needed. The Null-ness is equivalent to a failed
fromMap() which we execute on all usage paths anyways.

Change-Id: I72bb7fb55b7f26680fa68da8eef751ca96380ecd
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-21 08:47:12 +00:00
Tobias Hunger
95ac4edfd4 Projectexplorer: Modernize codebase
Change-Id: I4793b58aa77bcd46af99f8b843c0f7439cdc9269
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Reviewed-by: Vikas Pachdha <vikas.pachdha@theqtcompany.com>
2016-04-15 09:40:53 +00:00
Orgad Shaneh
15f8bb07ed ProjectExplorer: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I619db09a79760186b72e7662490ed1205155c1a7
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-01 15:51:34 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00