Commit Graph

79 Commits

Author SHA1 Message Date
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
Nikolai Kosjar
8a076e3f4b CppTools: De-duplicate and rename function in ProjectPart
Change-Id: I675ce4c9059d8ae4046f6a13aa7c04b88141d443
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-09 14:35:29 +00:00
hjk
8b5b1f1de7 CMake: Move CMakeProjectManager::findCbpFile to tealeafreader.cpp
That's the the only user of that code.

Change-Id: Iabc6a1fa9a4ad05c467e8ed64386d3185de25f02
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-28 11:59:07 +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
Tobias Hunger
c09b3709b9 CMake: Reimplement CMakeCache.txt parsing in BuildDirManager
The CMakeProjectImporter will need that in addition to the tealeafreader.

Change-Id: I453a7a124b5303e163e9c85bc3fc215215617119
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-10 10:33:56 +00:00
hjk
30bf801629 ProjectExplorer: Further tree node related simplification
Drop the list sorting and difference generation which is not
needed in the "build from scratch" setup.

This also removes some of the intermediately introduced
convienience functions and fixes a regression that led to
missing project files.

Change-Id: I39d1966324917f466fb347da3a52552393ca4a01
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-01-30 07:56:05 +00:00
Tobias Hunger
36a49ed103 CMake: Set project file information (when available)
Change-Id: I854a0207bd8568bc8f324840cba52dfb3ca880e9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-27 14:53:06 +00:00
hjk
beaba559a5 ProjectExplorer: Slim down user side ProjectNode handling
Change-Id: If727ff6cd09cc127e031c49c47f61ffda631a80e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-26 15:24:57 +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
Christian Stenger
95fa59dd6c Cmake: Fix regular expression
Change-Id: Ibcd5f62ace4adb4516ecaeba987eb8747996ba04
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-13 05:44:44 +00:00
Tobias Hunger
4f8769d844 CMake: Tealeafreader: Emit start signal before actually starting
This way we will get the start signal before the done signal if something
fails early.

Change-Id: I015017fdba16dd84f830b2e1fe2742eb0bec02a0
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-05 09:22:50 +00:00
Tobias Hunger
63c0fbc4e4 CMake: Cache cmake configuration only once
This fixes saves memory and fixes some update issues with the cmake
configuration, where the three layers of caches used to interfere
with each other.

Task-number: QTCREATORBUG-17360
Change-Id: I5564bbe46ca8de6b38dd710100bfc18fad98eac5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-02 12:00:09 +00:00
Tobias Hunger
49e255c4d5 CMake: Check result of file open
Change-Id: Ia4a11359f7cb08ee3fa55c77dc54d42890f37845
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-30 14:24:55 +00:00
Alexander Drozdov
651460cd8d CMake: separate processing C and C++ flags in TeaLeafReader
C and C++ flags holds at the different variables/compiler settings in
the generated Make and Ninja files.

Currently only C++ Flags processed and assumes that same one uses for
C lang. But now QtC core can handle C and C++ separatelly, so just
add processing for that flags and use it for code model.

Change-Id: If1f71a2c58284a46324f04e962fc120cc316b0fb
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-25 13:59:20 +00:00
Tobias Hunger
591d693d0d CMake: Move code to read CMakeCache.txt into CMakeItem class
Change-Id: Ie5d76a2b50007c80d68b2e97d3339a582afce469
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-17 13:10:47 +00:00
Tobias Hunger
e37539a16c CMake: TeaLeafReader: Simplify code
Change-Id: Ib615fde89952848c4cfe392a2e84c15f6b73de80
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 12:30:43 +00:00
Tobias Hunger
ff68d4cab1 CMake: TeaLeafReader: Fix include path detection
Change-Id: Ifcd64836aef7fc69b3cc0d4c27a07293348b91a6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 12:30:39 +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
Orgad Shaneh
9c09ca9e42 Merge remote-tracking branch 'origin/4.2'
Change-Id: Ia98031eb87f1859c3736faa0cdd8b655e8a50689
2016-11-14 11:17:13 +02:00
Tobias Hunger
ae46c06ac6 CMake: Show scanned header files in project tree (TeaLeafReader)
Change-Id: I06ed341a603f4062b41eabc91a90d6d8041aaa4b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 09:03:37 +00:00
Tobias Hunger
269e699fd9 CMake: Pass scanned files on to builddirreaders
Change-Id: I226aeafe6800a84fe4bbf8cf6fd21b8237575a88
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-14 09:03:28 +00:00
Tobias Hunger
4c3885a584 CMake: Polish TeaLeafReader
Change-Id: If379e1d53f2da61dccb1e72ea1a516e3bd788b60
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-04 10:21:29 +00:00
Tobias Hunger
ce3e586198 ProjectExplorer: Shorten space needed to store a FileType
Use class enum to shorten the FileType to quint16. This frees up a couple
of bytes per FileNode and we can have many of those.

Change-Id: I3a9ae25059690fefa15305a4268269647d6dc1c9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-03 15:55:39 +00:00
Tobias Hunger
6ad21cab82 CMake: Small updates to tea leaf reader
Change-Id: Ie68ed562415ee0024254729ea95591b59bb8f0cf
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:39 +00:00
Tobias Hunger
73dee5193c CMake: De-noise TeaLeafReader
Change-Id: I387bf0e1cc123d78591f95aacecb7be05c7455c2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:34 +00:00
Tobias Hunger
36cfa32a86 CMake: Use ServerModeReader to retrieve data
Change-Id: I415dbf7ca79c909eea23ef3dc3a1d87438e9f261
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:27 +00:00
Tobias Hunger
e3c1e7ade3 CMake: Unify mapping of type strings to CMakeConfigItem::Type
Change-Id: I29b905aac8965039369891e6aad7e356fa1dad8f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-31 13:03:08 +00:00
Tobias Hunger
9a980adf3c CMake: Implement different backends to run cmake
Only the original one is implemented so far, but at least
in theory backends for retrieving data from cmake can now
be switched at runtime.

Change-Id: Id73a81c7d40f078be95defd30a38511dca3a3720
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-10-31 10:40:24 +00:00