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>
This fixes auto-running cmake on changes to the project files.
Change-Id: I652b48b243b5decb6927b1619c47527af83d7f03
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
${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>
Add a method to FolderNode that compresses a tree of folders like
A/B/C/file.txt into one FolderNode (A/B/C) and a FileNode (file.txt)
Change-Id: I5efa038c33b91ea01017269daa048ba101085d01
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
The actual problem is fixed by 1f540c6c9, this is to make sure we
don't crash if this regresses again.
Change-Id: Id081ce9a9c3602c3a90216f53d63535097fabd2d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Via CMake project we can add subdirectory like:
> add_subdirectory("subdir/subsubdir" "enotherdir")
Where "subdir" my not contain "CMakeLists.txt" file.
And intermediate directory can contain CMakeLists.txt file
that is not a part of the root node.
This change fix it.
Task-number: QTCREATORBUG-17721
Change-Id: Ice9fba1ca5a979955ec8f44324f75f3bc16ee198
Reviewed-by: hjk <hjk@qt.io>
One step closer to direct use of Utils::TreeNode.
Change-Id: Icd0dfd2fa4d12c2572a68f61ae43c5e906956a0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Use a more robust logic to find existing CMakeListsNodes again.
Change-Id: Id26031c1164eb6271b74ccf39071219938b285fc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
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>
Do not put the cmake server-mode socket into the build directory, but
put it into a temporary directory instead.
This makes sure it will not stick around and also avoids polluting the
build directory with Qt Creator specific files.
Task-number: QTCREATORBUG-17320
Change-Id: Id849b1a80d7cba07c026cc2ecd7030435c401884
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Keep settings when switching from the temporary build directory to the
real one using cmake with server-mode.
Task-number: QTCREATORBUG-17360
Change-Id: If36489cb2584dc5e0b021430e5d860e146fd8a86
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
CMake uses definitions with assign operator notation, so, we should
replace first assign operator with space to omit parser damage.
Change-Id: I795c4371a1fdd534a42eb01bdcbe852534ce2bcf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Do not list <Build Directory> twice when switching from a temporary
build folder to the real one.
Change-Id: Id7d5f4a4b48d6c63dd4c7da2932b6a857ff0c7f7
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Always list CMakeLists.txt files, even if CMake thinks they are part
of its own modules. This unbreaks opening the cmake project with
a cmake built from those sources.
Change-Id: Ia7245aa0fa39854fe228cdff75b2256115545b39
Reviewed-by: Tim Jenssen <tim.jenssen@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>
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>
Work-around the first configure argument getting ignored by cmake 3.7.0
and CMake 3.7.1.
Change-Id: Iaf164cbf973672c1d899738a374c65ea5641132c
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>
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>
Files below <Build Directory> could not be opened from the project tree
since their file path was broken. Fix that.
Task-number: QTCREATORBUG-17297
Change-Id: Id785ffa1c4d22c4dfdc0b5ecf8217d3f8bc319c4
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Unify names for important directories in the project tree of
server-mode cmake projects.
Change-Id: I6354e0a1cfb71f9038d9110438622c824deedebe
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Do not trim out targets every second time the project tree is generated.
Change-Id: I6ed9cd7bb6b2e88ec6dbe063f90719ffacffdd61
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Do not keep data around once it is used. It will not help on the next run,
especially not when the parsing fails then:-)
Change-Id: Ifa1259b74349ac172a5c9d5411c10d429085b853
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
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>
Implement a reader that interacts with CMake server mode to retrieve
its data.
Change-Id: I4146a648475c2c5811b8a08126f10ff3b99e79f5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>