Commit Graph

90 Commits

Author SHA1 Message Date
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
2dabdbd2fe CMake: Report cache configuration arguments in server-mode
Change-Id: I3cd7a9ac37a1b8c3c6018070c6fdc506abedd736
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-04 09:52:43 +00:00
Eike Ziller
3d9cf954e2 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/plugins/debugger/debuggerdialogs.cpp
	src/plugins/debugger/gdb/remotegdbserveradapter.cpp

Change-Id: I1ae77869887a8d9ef2a33439f2733315db9e0cf0
2017-09-19 12:10:26 +02:00
Christian Stenger
e255baaa8f CppTools: Add target type information to project part
Let project managers store information whether a project part
belongs to an executable or a library and use this information
inside the AutoTest plugin.
This information will help to determine which targets are
relevant for the execution of tests.

Change-Id: I93b42797bf55225425398dc83aecea3c99eea290
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-09-18 10:01:30 +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
Tobias Hunger
3bb3f4af56 CMake: Filter out CMake input files that are already listed
Filter out CMake input files that are already listed elsewhere in the
project tree. This is server-mode only.

Change-Id: Ib62cd5b521a51180d12d76ec2868a99dbdecc272
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-08 11:18:58 +00:00
Tobias Hunger
91f36271e2 CMake: Check build dir first, then source dir in server mode
The build dir might be contained in the source directory, but not
the other way around. So this should be more reliable.

Change-Id: I2459b249fcc1002aa7f7787231b5699444a4c6bd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-08 11:18:24 +00:00
Tobias Hunger
bcad4a1b94 CMake: Add header icon to <Headers> folder
Change-Id: Ibb5a61ab100dbd3b32de385df230dd0862faf670
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-08 11:18:17 +00:00
Tobias Hunger
4ef01c961e app_version.h: Make IDE name configurable
Change-Id: I993f452c8d09cf89e9a2958fc8e36b7d2c17ee6f
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-05 10:19:48 +00:00
Eike Ziller
d8fd5292f1 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	src/tools/clangbackend/ipcsource/clangiasyncjob.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.cpp
	src/tools/clangbackend/ipcsource/clangjobrequest.h

Change-Id: Ib8602530663813ade418f995dfd2a736908cfe75
2017-08-15 10:07:51 +02:00
Tobias Hunger
68768d8e61 CMake: Get rid of <Source Directory> in server-mode
Change-Id: Ifa4f813d577ab64351d25eb4be1dc7981687da23
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-08-04 13:33:56 +00:00
Christian Stenger
27cb331b4b AutoTest: Avoid guessing run configuration
Base the selection of the run configuration on the executable
we have gotten already from the BuildTargetInfo and take
deployment information into account.

This also reverts cce1e130 partially and avoids
stuffing unrelated information into the buildsystemtarget.

Change-Id: I3de6e910a5fd1092d428ec4afc33c4ca62daaa25
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-31 06:11:35 +00:00
Eike Ziller
efa5a7b6d7 Merge remote-tracking branch 'origin/4.4'
Conflicts:
	qtcreator.pri

Change-Id: If5f4a9821a23ac0df81eb84b3980f9cf7ecd70ba
2017-07-25 11:54:44 +02:00
Eike Ziller
41127e0f47 Merge remote-tracking branch 'origin/4.3' into 4.4
Change-Id: I4e14ef31dc6cdcc0606d39be90195e30c1ee9b25
2017-07-25 11:50:43 +02:00
Tobias Hunger
336f54def4 CMake: Fix progress calculation in server-mode
Add unit test to make sure this stays fixed.

Task-number: QTCREATORBUG-18624
Change-Id: Ieeb41982418481223d9ebf8f5c6ec4b3b78bfe00
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-07-25 09:35:24 +00:00
Tobias Hunger
d8e0ecb0ab CMake: Extract crossReferences data of targets in server-mode
Use the information to add a filenode below a target that takes
you directly to the target definition.

Change-Id: Ifcb8e2c4f085110033019ea3816c79f5b8630472
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-21 12:49:16 +00:00
Orgad Shaneh
5f973de952 Merge remote-tracking branch 'origin/4.3'
Change-Id: Ib5405ed2c3356f65b49fe2f454f8ac2e0de44ef6
2017-06-26 08:24:26 +03: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
228dec629f CMake: Remove spurios newlines
Change-Id: I6f381d4df8b9174f74d1b44364e0fbea58c1e6b6
Reviewed-by: Cristian Adam <cristian.adam@gmail.com>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-21 08:05:11 +00:00
Tobias Hunger
ba8e7d1156 CMake: Report more cmake errors in server mode
Handle more kinds of errors in CMake server-mode.

Task-number: QTCREATORBUG-18318
Change-Id: I43fff7f3cfbd86d01ff05a0936261b8d91aa5d70
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-20 12:52:34 +00:00
Orgad Shaneh
687466ac47 Merge remote-tracking branch 'origin/4.3'
Change-Id: I126f3a05212a3d5df78812e66285bc9e8078360b
2017-06-20 11:32:02 +03: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
210b9aa227 CMake: Provide more information in server-mode
Provide more information about what is happening in server mode.

Change-Id: I69cbf0b2cb197789231499ac601a08af33ed6b6e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-15 13:28:41 +00:00
Eike Ziller
64b19af7dd Merge remote-tracking branch 'origin/4.3'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I6d89ea588de955f5d878500b59285d3adde6c77d
2017-05-15 15:31:55 +02:00
Orgad Shaneh
689aa3891d CMake: Ignore dirty signal on server-mode on Windows
CMake sends false signals on Windows. Until this is fixed, ignore them.

Task-number: QTCREATORBUG-17944
Change-Id: If59f04fd68a899069ecc02df592d3105e531f5bb
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-05-15 13:23:30 +00:00
Tobias Hunger
112254dc67 CMake: Improve detection of build directory in server-mode
Detect both build directories next to the sources as well as below the source
directory properly. Without this patch all files that normally go into "Build
Directory" node were listed below "Source Directory" when the build directory
was a child of the source directory.

Task-number: QTCREATORBUG-18196
Change-Id: Ib8674489cfe04958f76df24904107bb7aa093162
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-12 13:15:32 +00:00
Tobias Hunger
4e6fd0a2c0 CMake: Improve handling of CMAKE_RUNTIME_OUTPUT_DIRECTORY
Set the working directory of binaries which got moved from the
build directory using CMAKE_RUNTIME_OUTPUT_DIRECTORY to the directory
the binay is actualy in.

Task-number: QTCREATORBUG-18158
Change-Id: I059d55a6c408799f3220bd90c271a6d743e6cd82
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-05-12 11:17:47 +00:00
Tobias Hunger
175643fd7e ProjectNodes: Do not define a copy constructor for FileNode
Nodes are QObjects (still), so they should not have a copy constructor.

Change-Id: I1b20663ee0ec121cda4d39ced7a9f204fb4621a1
Reviewed-by: hjk <hjk@qt.io>
2017-05-04 09:16:27 +00:00
Tobias Hunger
cad16c4bee CMake: Fix up file group information in server-mode
Server-mode reports a filegroup for all the listed headers and will
provide that without any information on the files (no language, include
paths, etc.).

Fix up file groups like these by using the best (with that being the
settings that effect the most other files) possible information for
these files.

CMake has no idea what headers are, so it has no way to provide any
better information, so Creator has to fix things up again:-/

Task-number: QTCREATORBUG-17971
Change-Id: Ib5ddab23cf725c7e03717b577cc9f9edc5bbfc61
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-25 09:21:16 +00:00
Tobias Hunger
ff46e67971 CMake: Use for instead of foreach
Change-Id: I4e2c929414cf1f7b052ae9f6846f43ae20fcee4c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-25 09:20:38 +00:00
Tobias Hunger
5972f7fac6 CMake: Deduplicate targets in server-mode
CMake server-mode does report targets for each "PROJECT" that was
encountered before the target was defined. So it reports several
copies of the same data all the time. Deduplicate that information.

This fixes files being duplicated in the code model and the project
tree.

Task-number: QTCREATORBUG-17955
Change-Id: I95daa0f48e37587234d7e04e9bed6d20884f8be0
Reviewed-by: hjk <hjk@qt.io>
2017-04-07 11:45:06 +00:00
Tobias Hunger
fd48d1fc02 CMake: Do not add empty "<Headers>" folder
Do not show a "<Headers>" folder if that is empty.

Change-Id: Ife37691600accb176b69eba9bc7e323fa1a01ae6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-06 09:48:25 +00:00
Tobias Hunger
6829e33dc2 CMake: Move headers into their own folder in server-mode
Move all project headers into one folder. This reduces the time it
takes to generate the project tree, since the headers will only show up
once now (instead of once per target), severly reducing the number of
nodes in the tree.

Change-Id: Ibcfa7c02c1aec4a98054f4f8a97b69dfb4c25ae4
Reviewed-by: hjk <hjk@qt.io>
2017-03-29 11:53:11 +00:00
Tobias Hunger
17b89cd422 CMake: Speed up server-mode reader
This patch reduces the time to generate a project tree by 15% in
my test project.

Change-Id: Ie5956cdd2108873118654857dc299bdb0b6d3636
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-27 11:53:35 +00:00
Tobias Hunger
e8498acde0 ProjectNodes: Be less enthusiastic about compression opportunities
Do not compress foldernodes that differ on their type. This makes it
possible to use FolderNode::compress() in one more place in CMake.

Change-Id: I4721d5d12e3032ee70a1c3d9e87df49d59751f04
Reviewed-by: hjk <hjk@qt.io>
2017-03-24 17:41:07 +00:00
Tobias Hunger
55a4a62797 CMake: Speed up server-mode
Use a QSet to avoid having to search in a QList.

Change-Id: I2261a83acd3924a8483495e1f03322c7574a78a8
Reviewed-by: hjk <hjk@qt.io>
2017-03-24 15:55:10 +00:00
Tobias Hunger
572ea47e97 CMake: Fix project tree getting lost during reparsing
Fix the project tree getting lost after changing a cmake file. This is
due to the old set of files being used for deduplication, so no CMakeLists.txt
files got added to the tree, and then nothing could be added to those later.

Change-Id: I46989e0b802ab2a030d1922282361359837c41a4
Reviewed-by: hjk <hjk@qt.io>
2017-03-23 15:09:55 +00:00
Tobias Hunger
802eff3485 CppTools: Add target information to ProjectPart
This is important to be able to map sources to actual things that are
going to be built.

Change-Id: I1aef940767d60192642ed79a1703cff8dfdad9e1
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-03-15 11:03:45 +00:00
Tobias Hunger
1621aaa26e CMake: Fix some more SOFT-ASSERTS in CMake server-mode
Fix two more SOFT-ASSERTs in CMake server-mode that could be triggered
by complex projects.

Move and simplify search functionality into FolderNode and use that instead
of hand-crafting a custom tree search in CMake.

Change-Id: If4bde5c4a7ff84c7d5dba4f595e99b39f54ac8aa
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-15 10:23:14 +00:00
Tobias Hunger
6e91fe5046 CMake: Use a CMakeProjectNode as top level cmake node
Change-Id: I6e68b971cf490b9b064a2866bd99865a7f4a7bd9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-15 10:23:09 +00:00
Tobias Hunger
b8417e0f0c CMake: Fix projects with complex CMakeLists.txt layouts
This fixes soft assserts in e.g. Musescore.

Change-Id: I860c8c184161e53918fb901d66b89cffb0c09e23
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-15 10:22:24 +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
98505427d3 CMake: forward dirty signal in server-mode
This fixes auto-running cmake on changes to the project files.

Change-Id: I652b48b243b5decb6927b1619c47527af83d7f03
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-13 16:27:01 +00:00
Tobias Hunger
86fde306d1 CMake: Get better FileType in servermode reader
Change-Id: I8713043a625b17532ab33a72867aa0a20aa4cb3c
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:44:35 +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
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
568130da70 ProjectExplorer: Add FolderNode::compress
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>
2017-02-14 15:39:36 +00:00
hjk
cbe30a1cca CMakeProjectManager: Add some soft asserts
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>
2017-02-13 08:47:51 +00:00
Konstantin Podsvirov
1f540c6c9d CMakeProjectManager: Fix findCMakeNode function
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>
2017-02-10 14:50:41 +00:00
hjk
04a525877b ProjectExplorer: Merge FolderNode's m_{file,folder}Node fields
One step closer to direct use of Utils::TreeNode.

Change-Id: Icd0dfd2fa4d12c2572a68f61ae43c5e906956a0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-09 12:15:23 +00:00