Commit Graph

300 Commits

Author SHA1 Message Date
Tobias Hunger
3eea938a04 Project: Rename Project::activeBuildEnvironment to Project::activeParseEnvironment
This is used for parsing the project only, so reflect that in the name. Not all
projects have build configurations, so the old name did not make too much sense
for what this has been used for.

Eventually this code should move into the BuildSystem.

Change-Id: Iff766150b5fe370f2912b0b3b15348b1c1fad5b5
Reviewed-by: hjk <hjk@qt.io>
2019-08-28 07:28:18 +00:00
Christian Kandeler
9f88fc881f GenericProjectManager: Support framework paths
Rather than adding yet another meta file, we use the .includes file with
a special line prefix.

Fixes: QTCREATORBUG-20099
Change-Id: I494e0143b8e0f1f8828a56d7487b2201f1680337
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-19 10:44:08 +00:00
Tobias Hunger
22092ee4e6 GenericProject: Simplify code based on Project::projectFileIsDirty signal
Change-Id: I3e9eb892f22c716c3b6cf40498f232d234aa163e
Reviewed-by: hjk <hjk@qt.io>
2019-08-16 12:46:13 +00:00
Tobias Hunger
09530d6dcc ProjectExplorer: Use RAII pattern for parsing start/stop signalling
Change-Id: I13de537140f265db3e3d0ab1cd924d6897cd90c8
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-09 12:45:29 +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
09e5c167bd ProjectExplorer: Add convenience Project::addTargetFor{Default,}Kit
Less noise on the user side.

Change-Id: I5cdf4af4910a3cc1ee0af1b43fcbc7329a6d59db
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-01 16:16:29 +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
Eike Ziller
4ce34fd90f Merge remote-tracking branch 'origin/4.10'
Change-Id: I88a6704fb8d723a3cbdfb1a2d9c84741f30d4da6
2019-07-22 09:34:47 +02:00
Christian Stenger
4c6c3de53b GenericProjectManager: Do not crash on removing all files
When removing all files from a generic project QC crashed on
trying to access the first item of the empty file list.

Change-Id: I85045bf126f4e12575305466f0f4a6c4191176d3
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-07-19 05:43:02 +00:00
Tim Jenssen
333b33edbe Merge remote-tracking branch 'origin/4.10'
Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
2019-07-12 15:53:56 +02:00
Christian Kandeler
f7520b7d99 Make the project managers tell the code model about include paths
... from the environment.

Fixes: QTCREATORBUG-17985
Change-Id: I9b54e550121cfcc0684a6e173337d59d235c6107
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-07-12 09:13:42 +00:00
hjk
c77cef5706 Avoid more deprecation warnings
Change-Id: Icc7bb7a4ccf7fc9f89f6f668c194ccd440e5231c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-05 07:49:48 +00:00
Ville Nummela
63e4180242 ProjectExplorer: Add special handling for removing files
... from a project which are pulled in via wildcards.
Such files cannot be removed from a project file, because they are
not listed verbatim. This kind of failure should not be reported to the
user if the file is also deleted, as the file list will have the correct
state after the next reparse.

Fixes: QTCREATORBUG-22586
Done-with: Christian Kandeler <christian.kandeler@qt.io>
Change-Id: I3dc66fe9a6594be7d0b86f46d830cd099ee49fd7
Reviewed-by: hjk <hjk@qt.io>
2019-06-25 11:53:58 +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
Martin Haase
76d44aea0d Generic Project: cut common part of path in project explorer
This is necessary, if the project files on a
different directory than the source files. In this case, the project
explorer will show the full path e.g. in windows starting by C: for each
directory until the source files.

use-case:
some directory
|- project directory
   |- *.creator & *.files & ... generic project files
|- source directory
   |- some sub-directories and the source files

Fixes: QTCREATORBUG-19454
Change-Id: I95eee4afdc11adf4281220edc5f6ff29da41a3a5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: André Hartmann <aha_1980@gmx.de>
2019-05-23 07:32:11 +00:00
hjk
1e9636ab8a Some more FileName::appendPath() -> pathAppended() changes
Change-Id: Ie494f7ae8a96d97c9497b3ef38d774d2cf787b7f
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 07:46:56 +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
e3a7aa1ad2 ProjectExplorer: Flip default for ProjectNode::showInSimpleTree
Change-Id: Ibd4f91ad55b2be93d20dfc4f583de95274e981ca
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-03-01 08:57:05 +00:00
hjk
09372918c1 ProjectExplorer: Remove FileNode's isGenerated constructor bool
Use setter of base class, similar to setListInProject() before.

Change-Id: Id620f0084a5dec0410f29c80f8f6393a6bcd5050
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-25 12:23:31 +00:00
Tim Jenssen
c3a04c1873 GenericProject: fix memory leak
Change-Id: I5f5811229c6311fa19432a5018a1da33ead7894a
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2019-01-21 12:44:30 +00:00
Nikolai Kosjar
62c8aecb5f GenericProject: Support forwarding flags to clang code model
...in order to specify e.g. the language version to use.

Create the additional files project.cxxflags and project.cflags. These
are expected to contain command line flags for the clang code model on
one single line.

For example, "-std=c++11" can be provided to set the language version
for parsing.

Fixes: QTCREATORBUG-19668
Change-Id: I7712f546ba1fae536c32adfa5bd449c5b3484521
Reviewed-by: André Hartmann <aha_1980@gmx.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-15 13:33:34 +00:00
Nikolai Kosjar
7b494c068e CppTools: Simplify ProjectUpdateInfo
...by using KitInfo.

Change-Id: I17b4dd6c368ba8b10b765f12a4663c041c9be7e5
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:49 +00:00
Nikolai Kosjar
4ce9ec5d63 CppTools: De-duplicate code for CppProjectUpdater
Centralize gathering the kit, toolchains and qt version.

Change-Id: I6bd586ac7925e2ee556fd119f1dab096cd500e41
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-10 07:13:38 +00:00
Bernhard Beschow
5916be8756 Remove unneeded invocations of CppProjectUpdater::cancel()
The cancel methods were called just before setting up the parameters
for the CppProjectUpdater::update() call, which calls cancel() as its
very first action.

Change-Id: I748cb4daa86bc8245cd906b2dff3c7b2d50795b2
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2019-01-06 21:49:53 +00:00
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
Christian Kandeler
1950b38668 GenericProject: Set deployment data, if available
We use the same approach as for CMake, namely the
QtCreatorDeployment.txt file.

Fixes: QTCREATORBUG-19202
Change-Id: I50605b8236b26f0c911e2448330019e94753af19
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-11-14 13:04:25 +00:00
Alessandro Portale
951eb885af GenericProjectManager: Modernize
modernize-use-auto
modernize-use-equals-default
modernize-use-nullptr
modernize-use-override

Change-Id: I67c9895f46efe8646176718949561240c7175c53
Reviewed-by: hjk <hjk@qt.io>
2018-11-09 08:03:13 +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
Andre Hartmann
c29e483607 GenericProject: fix sorting file list when appending an entry
pos was -1 for a value that should have been appended as
last element to the list. Unfortunately, list->insert
treats -1 as prepending in front of the list, which lead
to incorrectly sorted lists.

The function got broken during the review process of
the introducing commit 758544c058.

Change-Id: I693e4d79b0d493deeac0ea8781d637fe50d008b8
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-05 13:52:47 +00:00
Eike Ziller
0db5f13dd1 Move generic make step to project explorer
As a first step of creating a generic base for the 3 existing
implementations.

Change-Id: I2456db74cb635316f97a247e2a2b6bdb34931440
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-16 12:04:40 +00:00
Tobias Hunger
d332954567 ProjectExplorer: Add and use addNestedNode(...) that takes unique_ptr
Change-Id: Ieb26721d053111fb350494e31d1f6da3fe642420
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-02 14:55:15 +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
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
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
hjk
02157d77bc CustomExecutable: standardize RunConfiguration::initialize() signature
Most other signatures look like {...}RunConfiguration::initialize(Core::Id),
make this here the same, even if the Id is unused (or, rather always
the same) so we can use a virtual function in the base RunConfiguration
at some time.

Change-Id: I5d3d4a7bf856bb0cc31f8e26bc0e5a80fd1a4066
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-11-14 10:59:18 +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
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
45046f7071 ProjectNodes: Do not derive Project Nodes from QObject
That should save some memory per node, and since creator has a lot of nodes
(e.g. opening the LLVM project adds about 1 000 000 nodes) this should be
noticeable:-)

Calling update inside ProjectTree::currentNode() and rename it to
findCurrentNode() to make sure it is an still existing pointer.
Also, try to reduce the somehow more expensive currentNode() calls
and sprinkle some const around that usage.

Change-Id: I6a7c5db01a71d53d39544d3013cad557d5b96cdc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-08-01 11:24:53 +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
Eike Ziller
88897f3a87 Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/genericprojectmanager/genericprojectnodes.cpp
	src/plugins/genericprojectmanager/genericprojectnodes.h

Change-Id: Ie0c870f68c8d200a75489b75860987655b2f6175
2017-04-19 09:56:14 +02: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
Eike Ziller
bac2e6c17a Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/cmakeprojectmanager/servermodereader.cpp

Change-Id: I58e7b33d32c41cb48a24a5638ddb256212dd6107
2017-03-30 13:59:12 +02: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
Eike Ziller
016767b2a6 Merge remote-tracking branch 'origin/4.3'
Conflicts:
	src/plugins/genericprojectmanager/genericproject.cpp
	src/plugins/genericprojectmanager/genericproject.h
	src/plugins/projectexplorer/projectmodels.cpp

Change-Id: I290cba328212cadd3c12909d1f2f3642d326a1ca
2017-03-28 09:56:16 +02: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
hjk
4d3c297d02 GenericProject: Code cleanup
Remove unused code from project node, access own members
directly, etc.

Change-Id: Icbffb4d3328757ffe3aa756ca1448fefba9bb00a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-21 17:23:58 +00:00
hjk
4d8352a6c1 ProjectExplorer: Add a FolderNode::addNestedNode() function
Also, rename buildTree() to addNestedNodes(), it's really
adding things, not recompletely (re-)building the subtree.

Use it whenever possible to avoid intermediate lists of items
to insert.

Change-Id: I5fde41e5b164a8a292410bd381a85f5efadf3471
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-14 12:26:22 +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