${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>
The CMakeProjectImporter will need that in addition to the tealeafreader.
Change-Id: I453a7a124b5303e163e9c85bc3fc215215617119
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
One step closer to direct use of Utils::TreeNode.
Change-Id: Icd0dfd2fa4d12c2572a68f61ae43c5e906956a0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Both wrap the corresponding Qt class, but make sure all temporary files
or directories are created inside a "master temporary directory".
Change-Id: I55461be507c828c965224c02863ea5ed9bbf9498
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Even if there was none found by the project reader. This can happen
when the cmake binary can not be started at all with the server-mode
reader.
I wanted to avoid just creating this node as that does mess with the
expansion state of the tree. But considering that we know that the
tree is empty otherwise that should actually not be a problem.
Change-Id: I5ae5ed3e2fa7eebdfc1f9b7d55d70417abfcd125
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
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>
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>
Server-mode only used to clear the tasks for normal parsing.
Change-Id: Ibbc3ac30f00afaff4874cb0682f5d7e8f1abafcd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
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>
The reader notifies us about the configuration being changed, so there
is no need to tell it about those changes again.
Change-Id: I458947babf1cd9c50a66ea7863f37d1e43d6c5f2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
According to the cmake developers this needs to be done.
Change-Id: I85670da11be31a71dd22fe2ea8d9102e47cc6535
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
No need to have the builddirreaders to so.
Change-Id: Ia7e38f6483b29d6a4f4b65baacc17bf184a3cb34
Task-number: QTCREATORBUG-17359
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Always show the top level CMakeLists.txt file in the project tree,
even when parsing failed.
Change-Id: I42c844eb54b32fcb51131ad63a8fc372622636fc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
This prevents stale tasks from piling up in the issues pane.
Change-Id: I90f79e969b8929e5bb43e3964c01fcd10af2ea33
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
CMake is pretty poor with the data on which files are contained in a project.
Run a filesystem scan of the project directory to find more files.
Change-Id: I9cc3293a9faf9a967efa5f586c144c3e7773588b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
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>
...otherwise all previously selected build configurations begins to
process changes in CMakeLists.txt or other cmake-related files after
save it.
Change-Id: I86ff59022c85d88052ff434480e670ebddd90864
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Add a method to turn a CMakeConfigItem into a string suitable to be passed
to CMake.
Change-Id: Ia7834f1c2fad387dd6e6eaa3863f93385d48ca71
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
No need to pass in the complete kit. Remove a couple of unnecessary
namespace names.
Change-Id: I2ac895535a80b4a54a423ce62dbdede65b67437b
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
CMake provides "hack" for cmake-gui, that allows set options variants
and select then from drop down list. Allows Qt Creator re-use this
solution.
See:
- https://blog.kitware.com/constraining-values-with-comboboxes-in-cmake-cmake-gui/
- http://blog.bethcodes.com/cmake-tips-tricks-drop-down-list
Drop down values can be added to option via:
SET_PROPERTY(CACHE OptionName PROPERTY STRINGS Option1 Option2 Option3)
This solution should not restrict to provide any other value, it
provides only suggestion for user to select one of prdefined values.
Change-Id: I8fc52155775f1e04979db8206bb42363df9359e8
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
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>
Make sure to run cmake *before* cmake --build when cmake files just
got saved. This helps e.g. when editing CMakeLists.txt files and the
hitting "Built" and "Save all" (or "Always save before build").
Task-number: QTCREATORBUG-16187
Change-Id: I16b1d02eb342a447003380946ce7a9d785476a0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
This is in preparation for having support for cmake's server
mode.
Change-Id: I6cc04fe7c5132c491c3f3c0f46560b8ad88808e8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Generator is only part of the picture now that the extraGenerator
is separate. Use CMakeGeneratorKitInformation::generatorArguments
instead, that is always the complete thing.
Change-Id: Ifb6238397e70b36e2dc1b145d3dfad1afa2caa3f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
The toplevel CMakeLists.txt file should always be visible in the project tree,
otherwise there is no way to fix problems that stop creator from reading the
project structure.
Since the cmake configuration may add that file itself, creator needs to
check before adding that file. All other files are taken straight from
cmake, which makes sure they are unique.
See the minimal project attached to QTCREATORBUG-16671 for an example
triggering this issue.
Change-Id: Iff3e307134b023e6955f47657e998a5981b03da0
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Rip out QFileSystemWatcher and use Qt Creators IDocument for file
watching instead. The latter properly delays any action till creator
gets focus again.
Task-number: QTCREATORBUG-16354
Change-Id: Ibb71963416b09712a80ee95347425550453b7fd4
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
Testcase: trying to use an existing build dir which was
made for /d/foo where /d is a symlink to $HOME/d.
To help understanding the problem, the error message now prints
both source dirs, the one found in the builddir and the one we expected.
Change-Id: I9a24fbd6ef3cf8108c5edba0d2a5b99ecdea0e89
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Was submitted by mistake for 4.0 (and reverted). Resubmit for master.
Change-Id: Ie3401d009044a46af7fac314d1f29975543a44b0
(cherry picked from commit 0043c721c2)
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
I have missed that this change was headed for 4.0 instead
of master. It breaks the build there.
This reverts commit 0043c721c2.
Change-Id: Ia359798c2636b2b4699de9cc73484ec12a757601
Reviewed-by: Orgad Shaneh <orgads@gmail.com>