Commit Graph

3443 Commits

Author SHA1 Message Date
Eike Ziller
d64e17ad55 Move mimetype definitions to plugin specs
- Avoids the hassle of QRC files and manually registering mime types
- Avoids performance regressions because of mime types that are
  registered after mime database has been used
- Makes it technically possible to detect that a disabled plugin could
  handle a mime type if it was enabled

Change-Id: I373008b1b56e9c6b4853055f20b3eeb112a6eff9
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-02-27 13:54:59 +00:00
hjk
6d723dfa6f ProjectExplorer: Remove arguments from node change signals
This discourages storing the pointers needlessly. The items
are still easy accessible by the static ProjectTree::currentNode()

Change-Id: I3c0cd019e9fdc382afacbc9d9de3b97d5f58ae1e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-24 13:17:46 +00:00
Tobias Hunger
021ea165dd CMake: Export CMakeParser
Task-number: QTCREATORBUG-17731
Change-Id: Iae2fdb0fd06489c558a58c698553edeaec9924ce
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-23 12:00:16 +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
Montel Laurent
f3c8a2db1e Use isEmpty() vs "count() == 0"
Change-Id: I9b3103fbc4e881693039c1a5e81f0d2b97803978
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-02-22 10:27:14 +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
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
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
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
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
Tobias Hunger
0e25c08942 CMake server-mode: Use more robust logic
Use a more robust logic to find existing CMakeListsNodes again.

Change-Id: Id26031c1164eb6271b74ccf39071219938b285fc
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-09 10:08:13 +00:00
Tobias Hunger
c20ae42e20 CMake: Show all headers below an included directory in server-mode
Change-Id: I2ff0018a3c92ccb55eca957624cc44f941ec866c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-09 10:08:07 +00:00
Tobias Hunger
bc598ec480 CMake: Fix project name selection
Change-Id: I03740045d817762ef91cf6399ac449c5af67b278
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-09 10:07:57 +00:00
Tobias Hunger
4bbac74a9d CMakeBuildConfiguration: Add helpers to deal with CMakeBuildTypes
Add helpers to deal with CMakeBuildTypes and to map them to
BuildConfiguration::BuildTypes.

Change-Id: I03ce9e83b5d044c3d94d29c44cc0a28560b206f6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-09 09:54:57 +00:00
Tobias Hunger
9ac96339ff CMake: Keep project configuration table visible at all times
Keep the project configuration visible at all times. This way users can actually
add settings, even when the configuration fails.

Task-number: QTCREATORBUG-17628
Change-Id: I0a342e0cba1dd720661a171818e0d91415ef5703
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-03 10:39:06 +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
Tobias Hunger
e8b4e180cd RunConfiguration: Introduce buildSystemTarget()
Introduce a method that maps a RunConfiguration to the build system target
that created the executable.

Implement the method in all RunConfigurations where that makes sense (e.g.
no CustomExecutables).

Change-Id: Ifaac859c2cd9b2806a0d7c185b2239312a67752a
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-30 13:27:16 +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
1ce6cfd809 CMakeProjectManager: Simplify creation of virtual folders
Change-Id: I781c0f6551ca01feaf1cc0fc1148a151777f91bf
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-27 08:40:50 +00:00
hjk
87304b3ce0 ProjectExplorer: Introduce some FolderNode convenience functions
... and use them.

Change-Id: I9f5237e5eac30715c2effbd3301dd2a70516d2a9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-27 08:40:20 +00:00
hjk
19c1161e5d CMakeProject: Remove a few unneded declarations
Change-Id: Ida5afcfb502756c45b58ab6600b2ff98329139dc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-26 15:39:59 +00:00
hjk
f12fb1496f CMakeProject: Simplify tree generation helper function
The sets of used nodes are not needed anymore.

Change-Id: I308fa140779f8a108fa23907f0959cf35100d67f
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-26 15:25:55 +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
Tobias Hunger
588211e2e8 CMake: Use shorter names for local sockets in server-mode
Apparently there is a limit to about 100 characters or so on some
versions of Unix (e.g. Darwin), and there is also the tendency to
point TMPDIR into places very far from '/' (e.g. Darwin), which
can result in the local socket path getting trunkated.

So make sure to put the local socket into /tmp on Unix. That works
on Linux and on Darwin.

Change-Id: I40bfaf932c5013cf72addb5621360e97c9583daa
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2017-01-24 16:12:26 +00:00
Tobias Hunger
26878aacaa CMake: Cancel running tasks on crash of cmake server
Change-Id: I5bf36a5ebb9d6a80278b9b83a14788a171f9c14f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-23 15:38:25 +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
087d6d7472 CMake: Mark changes to CMake configuration that contradicts a kit
Mark changes in the project that override configuration settings from the kit.

Task-number: QTCREATORBUG-17244
Change-Id: I3452116ad5f4626ffcd85dfcc86715b6946d6572
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:48:22 +00:00
Tobias Hunger
fb55efd9e2 CMake: Make the project override the kit, not the other way around
Change-Id: I26fbe90f9c5f9f46bf7a3be2e4a23c6e02a6eead
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-20 12:47:34 +00:00
Tobias Hunger
01e80b264b CMake: Put cmake server-mode socket into a temporary directory
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>
2017-01-20 12:21:20 +00:00
Tobias Hunger
c6f90e575e Utils: Introduce a TemporaryDirectory and TemporaryFile class
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>
2017-01-20 12:17:10 +00:00
Christian Kandeler
c05a3fdb3d Give the values of BuildStep::OutputFormat better names
The old ones did not convey their meaning very well. In particular,
NormalOutput and MessageOutput were easily confused.

Change-Id: Ia0a8c1b1c366ab3f5c59f751b37b8b1f68f6831d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-19 16:08:57 +00:00
Tobias Hunger
df62701801 CMake: Mark configuration items that were taken from the CMakeCache.txt file
Change-Id: Id9e707d7b07d35ade44959955db61810e34f7b30
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-19 16:05:11 +00:00
Tobias Hunger
0f7d75ccf5 CMake server-mode: Keep settings
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>
2017-01-19 16:04:19 +00:00
Alexander Drozdov
3ff3a19207 CMake: fix definition composing in ServerModeReader
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>
2017-01-16 11:31:36 +00:00
Eike Ziller
b1f1ccb32e Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/plugins/android/androidbuildapkstep.cpp
	src/plugins/genericprojectmanager/genericproject.cpp

Change-Id: I3484b668f9323ed0c05de99f8dfed07c9e65ab98
2017-01-11 09:29:37 +01:00
Konstantin Podsvirov
ec6587ceb6 CMake: Allow CodeBlocks for NMake Makefiles JOM
Change-Id: I280deb2131959cc538c4af4b7e9b9e07b4f41b80
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Konstantin Podsvirov <konstantin@podsvirov.pro>
2017-01-04 10:09:57 +00:00
Ulf Hermann
018ba5a834 Rename the "ERROR" icon to "CRITICAL"
We mostly use this icon in terms of showing messages which might be
informational, warnings, or errors. We cannot call the icon "ERROR" as
that clashes with some macro on windows. To be more inline with Qt's
predefined messaging macros (qDebug(), qInfo(), qWarning(),
qCritical(), qFatal()), we rename the icon to "CRITICAL" and regroup
the entries in the header to suggest this usage.

Change-Id: I89880919d7ca54ea9c86de384eb29f375bf3075f
Reviewed-by: Maurice Kalinowski <maurice.kalinowski@qt.io>
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-01-02 12:27:54 +00:00
Tobias Hunger
f27b332f9c CMake: Always put in a CMakeLists.txt file
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>
2016-12-21 15:25:30 +00:00
Tobias Hunger
8f885a5b2e CMake: Fix WS in servermode reader
Change-Id: I797d3c7025ee43f722ed137d911c58acb4b8e1f0
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2016-12-21 15:25:23 +00:00
Tobias Hunger
b11726bf05 CMake: Do not list <Build Directory> twice
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>
2016-12-21 15:25:19 +00:00
Tobias Hunger
5698736284 CMake: CMakeConfigurationKitInformation::setup fix
CMakeConfigurationKitInformation::setup did override the existing value
when it was called. That is not intended, the setup method should only
set a value if none exists.

Change-Id: I86d386982311020dc3dbb3a705e1ff87ad02e09c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-12-21 14:24:28 +00:00
Tobias Hunger
c41404728a CMake: Always list CMakeLists.txt files
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>
2016-12-21 14:21:06 +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
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
Tim Jenssen
6bf4157491 CMake: fix not disconnected build action
The old code was disconnecting all signals from CMakeProjectPlugin
to m_buildTargetContextAction. The result was more and more triggered
actions.

Change-Id: I8d7db5852c03d5388870a7460efb3a8a28fd0749
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Alexander Drozdov <adrozdoff@gmail.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-12 10:20:54 +00:00