Commit Graph

445 Commits

Author SHA1 Message Date
Bernhard Beschow
3bdb7d1de5 CppProjectUpdater: Remove unread attribute
Change-Id: I51123e5b5609de431cfa6d1558aed0b9739ff9c8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:49:28 +00:00
Alessandro Portale
17f169c291 CMakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using

Change-Id: I6a272bc3b75835840b3d6cbe83be6f50f94bbedb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 07:50:15 +00:00
Christian Kandeler
73b1a765f3 Move evaluation of QtCreatorDeploymentData.txt to ProjectExplorer
We want to re-use it outside of the CMakeProjectManager.

Change-Id: I7550f86704bb7c2a683e831cf8827d5b0f6d90f6
Reviewed-by: hjk <hjk@qt.io>
2018-11-14 13:03:12 +00:00
Robert Loehning
4032f6383a Fix frequent typo
can not -> cannot

Change-Id: Ie872ada1bc9b4ed64bffb667c2e44dbb13b4ad11
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-10-23 09:30:20 +00:00
Nikolai Kosjar
5900766ecb Toolchains: Detect unspecified language version
We checked the command line from the project manager for "-std=X" and
friends to figure out the language version to use. However, if such a
flag was not provided, we assumed the latest version we support. This
could conflict with the actual version of the compiler and its
predefined macros.

Figure out the version by inspecting __cplusplus/__STDC_VERSION__ in the
predefined macros of the toolchain. The MSVC compiler is an exception to
this, as it does not seem to properly set the value - check for
_MSVC_LANG if possible, otherwise simply assume some versions as before.

While at it, add also support for C17/C18 and the upcoming C++2a.

Task-number: QTCREATORBUG-20884
Task-number: QTCREATORBUG-21188
Change-Id: I464ffcd52d2120c0208275a050e82efda44fae1c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
2018-10-08 09:07:56 +00:00
Eike Ziller
6e66b2a078 Remove some lambdas from Utils::transform calls
It is often possible to user (member) functions or members directly.
That improves readablility and potentially reduces the total number of
symbols.
Also use qobject_container_cast at places where it is appropriate.

Change-Id: Ia2591bca356591e001e2c53eeebcf753e5bc3c37
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-05-28 13:45:20 +00:00
Tobias Hunger
fdccc54275 server-mode: Always try to read CMakeCache, even after error
Change-Id: Ib3d4fb5ac14340a7f706e4a1d8a0cbdc420d01d1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-22 15:21:54 +00:00
Tobias Hunger
5754d5accf ProjectExplorer: Use unique_ptr for Project::setRootProjectNode
Change-Id: If63a49d0eecfb93adcc6076fcb3208c87603af10
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 11:34:35 +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
bc698d4ce6 ProjectExplorer: Consolidate RunConfiguration identifications
The previously per-Project/RunConfiguration changing meanings of
BuildTargetInfo::buildTarget have by now been split
into separate values in BuildTargetInfo:
  - buildKey     a handle to one item in Target::applicationTargetList
  - displayName  a user-visible string in the run settings page

The buildKey was tweaked to coincide with the previous 'extraId',
i.e. the non-RunConfiguration-type part of the project configuration
id that (still) use id mangling.

This allows replacing the cases of locally stored seven different
versions of buildKey(-ish) data by one RunConfiguration::m_buildKey,
and do all remaining extraId handling in RC::{from,to}Map only,
i.e. remove the base ProjectConfiguration::extraId() virtual and
remove the "re-try fromMap with mangled id" hack entirely.

The id mangling is still used to temporarily maintain .user file
compatibility in some cases for now, but should be replaced by
storing the build key and the RunConfiguration type soon. Qbs
already changes in here to only use the uniqueProductName as
buildKey, without the previously added display name which is
stored as part of the ProjectConfiguration already.

It turns out that RunConfiguration::buildSystemTarget was intended
and used to retrieve an item from the Target::applicationTargetList
for some configurations, coinciding with what buildKey does always.
So use that insteand and drop RunConfiguration::buildSystemTarget.

There is clearly is further consolidation potential left.

handling of (default)displayNames is still a per-runconfiguration
mess and there is further consolidation potential left.

Change-Id: I448ed30f1b562fb91b970e328a42fa5f6fb2e43e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-12 12:11:45 +00:00
Orgad Shaneh
7d3a79c696 Utils: Purge asConst
Replace by qAsConst.

Change-Id: I3301366f73c066c86f08df7188d70dc3b613c55c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:00 +00:00
hjk
8c713d45a8 CMake: Use new ExecutableAspect
Change-Id: Ic880351802c52b61c53c6730d23dfe3f124ebc44
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-29 14:27:14 +00:00
hjk
a5d6fe33cb Partially decouple local CMakeRunConfiguration from CMakeProject
Funnel all relevant data through target.applicationTargets() as
done for the non-local CMake-supporting setups and QBS already.

There is cleanup potential left for later changes.

Change-Id: I49ed6abd98c058a7fd1545e41b3bcd6ecb758a8b
Task-number: QTCREATORBUG-19985
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-13 15:02:54 +00:00
Tobias Hunger
835d4e92f3 Project: Improve default implementation of Project::needsConfiguration
Change-Id: Ic4d227334d818658f179c0589462551509274c17
Reviewed-by: hjk <hjk@qt.io>
2018-03-09 12:57:59 +00:00
Tobias Hunger
997ece4361 Project: Remove unused Project::requiresTargetPanel(...)
Change-Id: I7a5298edefd7e26841c4070be23534dd33d093cb
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 13:22:21 +00:00
Tobias Hunger
8059bf6204 Project: Make setRequiredKitPredicate private
Make calling Project::supportsKit(...) the default implementation.

Change-Id: I0e47972097e760e2ff3be229afb85eff839146b8
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 09:28:02 +00:00
hjk
b2a16190e8 Use project id uniformly as project context
The possibly intented flexibility e.g. to have different project types
share the same idea of a common context was never used, in all cases
we had a 1:1 relation ship between project ids and ids that were used
as context. This led to oversights like the one fixed in 60fb35a2.

This patch here uses the project id unconditionally as context and
drops all context ids. If we'll ever have the situation where the
original flexibility was needed, Project::projectContext() could be
made virtual and overridden were needed.

Also, the context was never modified for any given project, so the
updating machinery is not needed.

Change-Id: I3f7fac0ed5e4704e126558987c48577f26082dfd
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-20 12:35:14 +00:00
Tobias Hunger
f542e24eca Project: Make Project::file take a std::function to match files
Make Project::files take a standard function to match files with instead
of an enum (and a std::function).

Change-Id: I6a24e40dba0e972ff96c0a57e775d2377e2545e0
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:56:29 +00:00
Tobias Hunger
18f38ff18e Project: Make Project::files return a FileNameList
Change-Id: I75ceb22ac65b8288d824f229d44089cba6fc8ea3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-12-08 09:09:59 +00:00
Tobias Hunger
216e40b3f0 CMake: Fix tree scanner not getting run automatically
This lead to <Headers> entry being missing from the project tree.

Task-number: QTCREATORBUG-19333
Change-Id: Ice3bab6d92aaa3799e66800cbae0bacd57537322
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-21 10:19:53 +00:00
Tobias Hunger
a65630ef8c CMake: Pass C toolchain on to the project model
Change-Id: Ice833d9b180d7bac109c7cdf9e63fdba0bbce86e
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-01 14:19:10 +00:00
Tobias Hunger
4acb16272d CMake: Enable switching between different temporary CMake configurations
This got broken when moving the BuildDirManager from the BuildConfiguration
into the Project itself.

As a side-effect this patch also fixes the persisting of cmake state.

Task-number: QTCREATORBUG-19075
Change-Id: I1fc696097b09f5285e67f20885eb1fa27504990b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:13:42 +00:00
Tobias Hunger
0a5f32ff75 CMake: Fix crashes when last target is removed from a project
Task-number: QTCREATORBUG-19112
Change-Id: I17893c3e15e9cabc09bf5ebb6746a5d76d9cc0bd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-10-17 14:46:49 +00:00
Tobias Hunger
02533e61cf CMake: Fix project parsing notification
This builds on top of 08677c0b01 and
fixes one more code path to go through a common entry/exit point.

Change-Id: I1d00fa9242f247028e5d3b0ef3b5fe1d3f4cb03d
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-06 09:53:40 +00:00
Tobias Hunger
08677c0b01 CMake: Quieten soft-assert on small project loads
The directory tree scanner and the project parsing work independently of
each other. Add logic to combine these two sets of results into one
parsing state.

Change-Id: I46e94f0e866b40ee7225235c536c742cecf11b45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-26 14:31:25 +00:00
Claus Steuer
100cd10d6e CMake: Set CMakeRunConfiguration executable and working directory
Since 131c7a1 the executable and base working directory property of
CMakeRunConfiguration objects is no longer set when the project data
is updated. At least the executable is required in the AutoTest plugin.

Change-Id: I31c4cb37983d3983664d178c0f8c08d491f719ad
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-24 12:23:45 +00:00
Marco Bubke
b6e12f4a1c Convert macros from plain QByteArray to a vector of structs
The old code model expected the macros as C++ formatted text
("#define Foo 42) but newer targets like the Clang codemodel expect key
value arguments like "-DFoo=42". So instead of parsing the text again and
again we use an abstract data description.

Task-number: QTCREATORBUG-17915
Change-Id: I0179fd13c48a581e91ee79bba9d42d501c26f19f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-14 15:23:56 +00:00
Eike Ziller
ca959d8063 Merge remote-tracking branch 'origin/4.4'
Change-Id: Ic9a1cf3b40b259d9c77f2f542405d189171e0fbf
2017-09-05 12:15:42 +02:00
Ivan Donchevskii
410e31c665 CppTools: set default -std=c++11 for Qt4
qmake from Qt4 does not provide C++ standard and
clang can't properly compile Qt4.8.6 and earlier
with c++1z. Behavior in this commit mimics qmake
from Qt5 which also provides c++11 as a default
standard.

Task-number: QTCREATORBUG-16441
Change-Id: I3d29891d6e47f2367f2b3b2bf4be4d86661924e9
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-05 09:37:14 +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
Tobias Hunger
46f39f5601 CMake: Simplify signaling
Change-Id: I50fdaed0d813b5004c1756e9c5a6efd3ce7a3318
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-26 09:29:47 +00:00
Tobias Hunger
09b127f9f1 Project: Move signalling of parsing state into Project
Get rid of duplicated code to do such signaling in derived Project types.

Change-Id: I26914a1d751d72ee65c15a7943e0e7f34978f042
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-26 09:29:21 +00:00
Tobias Hunger
64c5f960e8 CMake: Return an empty project tree if parsing failed
This triggers the logic in Project to show the top level project
file in the project tree.

Remove similar logic in CMake.

Change-Id: I2bfdd3f5e3d4126910a3feb480cec5ef689954ed
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
2017-06-23 09:56:07 +00:00
Tobias Hunger
dac2a188de CMake: Make sure no empty strings end up in deployment data
Task-number: QTCREATORBUG-18406
Change-Id: I0b9f8ca76cee8ad2e9ae2ee1f124f16f473033d5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-20 13:39:12 +00:00
Christian Stenger
cce1e130d7 AutoTest: Fix handling of multiple build targets
If project files are not mapped 1:1 to targets the result
of the chosen executable was more or less random.
Try to handle multiple targets as correct as possible by
checking for build targets already where we still know
which files are part of the respective test cases.

Task-number: QTCREATORBUG-17783
Task-number: QTCREATORBUG-18357
Change-Id: I82dcc26bf52c9918e2727b439a719af08879ef49
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-06-19 08:14:55 +00:00
Tobias Hunger
0a3409112b ProjectNodes: add listInProject() to Node
Add a setter/getter for listInProject to Node and make the project
list all nodes with this property set in Project::files.

Task-number: QTCREATORBUG-18132
Change-Id: I334e627856d1bc0d033e13c5d629f6657d8d7fee
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:56 +00:00
Tobias Hunger
0951589420 Project: Unify handling of displayName
Unify the handling of displayName with a proper changed signal across
all projects.

Change-Id: I7e503528854b85f6f38de4b0943775f82a0d6123
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-04-07 14:49:51 +00:00
Tobias Hunger
b0c7bb0f7b Project: Move ProjectDocument setup into Project class
Change-Id: I5c0ec79ddf066e37660fb9a6b24f9d882355d511
Reviewed-by: hjk <hjk@qt.io>
2017-03-29 11:53:24 +00:00
Tobias Hunger
348aa12eaa ProjectExplorer: Provide ProjectDocument and use it in all projects
Change-Id: I6e054ebf1043bd1f6748f1567f35c68394bd6528
Reviewed-by: hjk <hjk@qt.io>
2017-03-29 11:03:34 +00:00
Tobias Hunger
75538aa060 CMake: Speed up extra compiler processing a bit
Makes extra compiler selection 30% faster on my test project.

Change-Id: If78084ce4a5a93140598dd19e8448295ca122863
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-29 07:54:01 +00:00
Tobias Hunger
fc5ce1e710 ProjectExplorer: Handle project file list globally
Handle the generation of the list of files in a project globally, based
on the project tree.

Creator now has the concept of TreeManagers which can enrich the project
tree with additional data (e.g. the files found in a resource file), which
the project does not necessarily know about. So use that tree to find
the files that belong to a project instead of implementing similar features
in each project.

Change-Id: Ia375a914a1f2c0adaa427f9eda834eec2db07f68
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-03-27 15:32:13 +00:00
Tobias Hunger
d1a5304564 CMake: Fix WS
Change-Id: Id06a9d8d831fcc0ce3fe38f852e34e144a79e0e9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-27 15:32:02 +00:00
hjk
54fa601e5f ProjectExplorer: Remove unused Project::displayName() signal
Only ever emitted by the cmake project and never consumed

Change-Id: I689120a2ac2c77896eed72da9bd0be194ac1af86
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-27 08:51:40 +00:00
Tobias Hunger
b1826c2f7f CMake: Fix file list for "AllFiles"
Change-Id: I7f3e9d7169227483cf50bfed4659cc93372fca51
Reviewed-by: hjk <hjk@qt.io>
2017-03-21 14:07:40 +00:00
Tobias Hunger
9f1a9078c2 CMake: Fix possible crash before the project is fully set up
Change-Id: Iacbf49e296a72176ae828fa11286432212078694
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2017-03-17 16:33:23 +00:00
hjk
a6a271881f ProjectExplorer: Inline FolderNode::recursiveFileNodes()
... into its only remaining user.

Change-Id: I5efa716ce34ba6a237dfcbcfebb257c863fdd21d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-14 12:33:47 +00:00
Tobias Hunger
d08cbf6641 CMake: Fix empty display name when opening project
Change-Id: Id89177f6502c7f4f8bb121acefe3f3efca82828f
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:44:40 +00:00
Tobias Hunger
49fef0ae24 ProjectExplorer: Create initial project tree
Create an initial project tree with a ProjectNode and a FileNode for
the project file itself.

Fix the Projects to not implement their own tree before they have
better data.

Change-Id: I147ccd5603d22d1d60880a97f30fd8c271eac88c
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:22:31 +00:00
Tobias Hunger
2fde3fffa9 Make all projects generate a fresh project tree
Do not update the existing project tree anymore: Start a fresh one
and throw the old one away.

Change-Id: Ifabe293b6ca668b0672516a6d81acd5346d98fe5
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:22:26 +00:00
Tobias Hunger
71a5aee36f Session: Update SessionNode when Project tree changes
This moves ownership of the project's root node from the
project into the project tree!

Change-Id: I84eba884bd63b44e56c75023d8bf12caf5cc2833
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:22:21 +00:00