Commit Graph

425 Commits

Author SHA1 Message Date
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
hjk
4d3d2d0dfb ProjectExplorer: Remove Project manager parameter from some constructors
Can be done generically when creating projects. The only wart is
the use from BaseQmakeProjectWizardDialog::writeUserFile.

Change-Id: Ie98c9f88ec142e82443e204a0075e3ae9e163752
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-28 14:56:21 +00:00
Tim Jenssen
2631ffabd5 Remove spaces in initializer lists
Format initializer lists code style like.

Change-Id: Ib82c235e4ba7dc75ee96a7abc0c47eff7b0a9013
Reviewed-by: hjk <hjk@qt.io>
2017-02-22 16:25:09 +00:00
Nikolai Kosjar
8c90998fff CppTools/ProjectManagers: Reduce ui blocking when loading projects
${AnyProject}::updateCppCodeModel() did two potentially not that cheap
operations in the ui thread:
 (1) Querying the MimeDatabase for the mime type for the source files of
     the project. In 99.9% of the cases no files need to be read for
     this as the file extension will resolve the type. The expensiveness
     comes from the sheer number of files that can occur.
 (2) Calling compilers with the "(sub)project's compiler command line"
     to determine the macros. While the caches avoid redundant calls,
     the number of the unique compiler calls makes this still a
     ui-freezing experience.

These two operations are moved into a worker thread. For this, the
expensive compiler calls are encapsulated in thread safe lambdas
("runners") in order to keep the "mutexed" data minimal. The original
API calls of the toolchains are implemented in terms of the runners.

While adapting the project managers, remove also the calls to
setProjectLanguage(). These are redundant because all of the project
managers already set a proper value in the constructor. Also, currently
there is no need (client) to report back detection of C sources in
project parts. This also keeps CppProjectUpdater simple.

There is still room for improvement:
 * Run the compiler calls in parallel instead of sequence.
 * Ensure that the mime type for a file is determined exactly once.

Change-Id: I2efc4e132ee88e3c8f264012ec8fafe3d86c404f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-20 09:18:13 +00:00
Alexander Drozdov
bc46ba11ee CMake: fix crash on project close during active file system scanning
TreeScanner uses callbacks that can refers to the destroyed objectes
when project closing.

Found scenario:
1. Open big CMake-based project (CLang/LLVM good choose).
2. Until file system scanning finished switch to another session.

Change-Id: Ia0f55f38aea6a9d07ca81aee6c9e9c5662d74f3a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-15 09:55:39 +00:00
Tobias Hunger
4f40d7778d CMake: Introduce project importer for cmake projects
Change-Id: Ie215e1c3f0286f6d98d10865e2b0a16b01391cd5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-10 10:34:07 +00:00
Ulf Hermann
c70b689526 Unify projectexplorer language IDs
We don't need two IDs for C++ and the QmlJS ID should look the same as
as the others.

Change-Id: Ib9747f6b36a90bb652951d85eec69666615670c4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-30 15:34:46 +00:00
Filippo Cucchetto
4b1f8f3609 ProjectExplorer: Added support for registering custom languages
Change-Id: I728a2ed1ef7d9f44d7c2b59d27d6e23444cd3bb5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-23 11:19:11 +00:00
Tobias Hunger
1b2fc1c815 CMake: Pass const QList<const FileNode *> to Directory Readers
This makes sure they need to copy whatever they need.

Change-Id: I767ac0c5f54ca1f9f46acdefe4bd7fea35657312
Reviewed-by: Alexander Drozdov <adrozdoff@gmail.com>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-21 14:19:36 +00:00
Alexander Drozdov
dfaf01614d CMake: make project file system tree scanner persistent
Project source tree is a same for all build configurations so it is
a good idea to keep it persistent between CMake runs, configurations
switches and so on. It safes a lot of time for big projects.

Move more operations to the scanner thread:
 - Nodes filtering: skip .user files on top level of the project, skip
well-known extensions and octet-streams: In most cases these are not
required to be shown in the project tree.
 - Nodes sorting

Fix small memory leak: we have .user in the scanner result. After this
node filtered out, but is not feed (old code at the
BuildDirManager::generateProjectTree()). Now .user file skips during scan
without memory allocation at all.

Allow user manually rescan project tree by call Build -> Rescan project
tree. It runs CMake and Tree Scanner together: in most cases only CMake
run requires but time to time (VCS update) full rescan also required.

Change-Id: I4a6e6c897202da557509291c79932dd7751860e5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-13 21:16:56 +00:00
Nikolai Kosjar
521423b433 CppTools: Call ProjectInfo::finish when we get it
No need to require the project managers to do this. Also, it is easy to
forget.

Change-Id: I96f7a5e5547418678af9653e5753c372f0880e5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-06 14:34:39 +00:00
Tobias Hunger
45ad669a88 CMake: Return empty tree on errors in server-mode
This triggers the fallback mechanism which will make sure the CMakeLists.txt
file will be displayed.

This used to fail since one empty folder was left over in the project.

Task-number: QTCREATORBUG-17383
Change-Id: I867fd9039bc5df805ff5174ec49084bbcf688824
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-05 16:21:30 +00:00
Tobias Hunger
53d45de8a0 CMake: Allow to build target from context menu of CMakeTargetNodes
Change-Id: I0457abd6dabea1699272482eb5f7fbb3ca097310
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-15 09:30:59 +00:00
Tobias Hunger
4b4dc9d06c CMake: Project tree for server mode data
Change-Id: Ief884a76c1b4211501dd6515b17b6e88a8e881e5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 10:29:53 +00:00
Eike Ziller
30f71eddf8 Merge remote-tracking branch 'origin/4.2'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I245212bd45104636b1c9737b36d3db3e4af23092
2016-11-01 09:30:49 +01:00
Nikolai Kosjar
6e6d5b5309 ClangStaticAnalyzer: Tests: Rely on projects telling when they finished parsing
We relied on the CppModelManager to tell us whether a project was reparsed
after a kit change. While this worked, it was not guaranteed that the project
is really finished (and ready for e.g. building) after pushing new ProjectInfos
to the CppModelManager.

Rely on the projects telling when they are finished with parsing. This is more
accurate and future-proof.

The introduced signals in Project and SessionManager are (at the moment)
only for tests.

Change-Id: I1b368ec4585ffa8755eb28fac6d187cce31243ee
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-31 15:09:01 +00:00
Tobias Hunger
4798d038a4 CMake: Clear files when cleaning CMakeBuildTargets
Change-Id: I16fefae569f807776e422b4b662d5b42d1230df2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-17 13:48:52 +00:00
Tobias Hunger
9ff2bd16d3 CMake: Use Utils::FileName where appropriate
Change-Id: I3ab0a68920e27ebcf4e1dd58180a72ded58b892e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 11:41:51 +00:00
Tobias Hunger
9e67dfbe17 CMake: Move more code into BuildDirManager
Continue to concentrate all the code reading random cmake files in
BuildDirManager. Now the task is to clean up the code, make it less
dependent on values it should not depend on (kits, etc.), make it
handle changes better and finally add another implementation that
uses the cmake server mode to extract the data.

Change-Id: I533625e376b969b64287bc205bd2e4be7a605306
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-10 14:45:51 +00:00
Tobias Hunger
683b965297 CMake: Encapsulate BuildDirManager in CMakeBC
This will make it easier to introduce a new type of BuildDirManager
to accommodate cmake server-mode.

Change-Id: I989aab9df44dff1cfdff226ef97bb30bb092ffdd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:59 +00:00
Tobias Hunger
5481ca6edb CMake: Properly split QML_IMPORT_PATH
Change-Id: I0626da3a08e0e190757900a2df312ab0cee948d0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:47 +00:00