Commit Graph

186 Commits

Author SHA1 Message Date
Tobias Hunger
835d4e92f3 Project: Improve default implementation of Project::needsConfiguration
Change-Id: Ic4d227334d818658f179c0589462551509274c17
Reviewed-by: hjk <hjk@qt.io>
2018-03-09 12:57:59 +00:00
Tobias Hunger
997ece4361 Project: Remove unused Project::requiresTargetPanel(...)
Change-Id: I7a5298edefd7e26841c4070be23534dd33d093cb
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 13:22:21 +00:00
Tobias Hunger
8059bf6204 Project: Make setRequiredKitPredicate private
Make calling Project::supportsKit(...) the default implementation.

Change-Id: I0e47972097e760e2ff3be229afb85eff839146b8
Reviewed-by: hjk <hjk@qt.io>
2018-02-19 09:28:02 +00:00
Tobias Hunger
4acb16272d CMake: Enable switching between different temporary CMake configurations
This got broken when moving the BuildDirManager from the BuildConfiguration
into the Project itself.

As a side-effect this patch also fixes the persisting of cmake state.

Task-number: QTCREATORBUG-19075
Change-Id: I1fc696097b09f5285e67f20885eb1fa27504990b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:13:42 +00:00
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
Laurent Montel
7dafb822ed CMakeProjectManager: Clean forward declaration
Change-Id: I47cb6fbac276554e548383fe6945fd5cd38386c6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-27 07:46:06 +00:00
Tobias Hunger
08677c0b01 CMake: Quieten soft-assert on small project loads
The directory tree scanner and the project parsing work independently of
each other. Add logic to combine these two sets of results into one
parsing state.

Change-Id: I46e94f0e866b40ee7225235c536c742cecf11b45
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-26 14:31:25 +00:00
Claus Steuer
100cd10d6e CMake: Set CMakeRunConfiguration executable and working directory
Since 131c7a1 the executable and base working directory property of
CMakeRunConfiguration objects is no longer set when the project data
is updated. At least the executable is required in the AutoTest plugin.

Change-Id: I31c4cb37983d3983664d178c0f8c08d491f719ad
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-09-24 12:23:45 +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
131c7a1c4e ProjectExplorer: Introduce base class for enabled/disabled project configuration
... and use this as a base for all RunConfigurations.

Clean out code in the individual run configurations dealing with their
enabled/disabled state.

Change-Id: Icc2ea136b056f7aea7ce96480b4402459d7ac0ce
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-28 17:26:03 +00:00
Tobias Hunger
f5beeb4c7e ProjectTree: Show parsing state of projects
Show which projects are currently parsing in the project tree.

Change-Id: Ie69907a73ec7c3cf2ef40c37db620a0144178f95
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-28 08:33:50 +00:00
Tobias Hunger
46f39f5601 CMake: Simplify signaling
Change-Id: I50fdaed0d813b5004c1756e9c5a6efd3ce7a3318
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-26 09:29:47 +00:00
Tobias Hunger
09b127f9f1 Project: Move signalling of parsing state into Project
Get rid of duplicated code to do such signaling in derived Project types.

Change-Id: I26914a1d751d72ee65c15a7943e0e7f34978f042
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-07-26 09:29:21 +00:00
Tobias Hunger
0951589420 Project: Unify handling of displayName
Unify the handling of displayName with a proper changed signal across
all projects.

Change-Id: I7e503528854b85f6f38de4b0943775f82a0d6123
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2017-04-07 14:49:51 +00:00
Tobias Hunger
fc5ce1e710 ProjectExplorer: Handle project file list globally
Handle the generation of the list of files in a project globally, based
on the project tree.

Creator now has the concept of TreeManagers which can enrich the project
tree with additional data (e.g. the files found in a resource file), which
the project does not necessarily know about. So use that tree to find
the files that belong to a project instead of implementing similar features
in each project.

Change-Id: Ia375a914a1f2c0adaa427f9eda834eec2db07f68
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Marco Benelli <marco.benelli@qt.io>
2017-03-27 15:32:13 +00:00
hjk
4d3d2d0dfb ProjectExplorer: Remove Project manager parameter from some constructors
Can be done generically when creating projects. The only wart is
the use from BaseQmakeProjectWizardDialog::writeUserFile.

Change-Id: Ie98c9f88ec142e82443e204a0075e3ae9e163752
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-28 14:56:21 +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
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
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
Tobias Hunger
45ad669a88 CMake: Return empty tree on errors in server-mode
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>
2016-12-05 16:21:30 +00:00
Tobias Hunger
53d45de8a0 CMake: Allow to build target from context menu of CMakeTargetNodes
Change-Id: I0457abd6dabea1699272482eb5f7fbb3ca097310
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-15 09:30:59 +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
Tobias Hunger
9ff2bd16d3 CMake: Use Utils::FileName where appropriate
Change-Id: I3ab0a68920e27ebcf4e1dd58180a72ded58b892e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-10-17 11:41:51 +00:00
Tobias Hunger
d9d752cf13 CMake: Clean up cmake project
Change-Id: Icfa2e1af8ff53c06954cb0b3b5b4b2ad974d6585
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-17 10:03:13 +00:00
Tobias Hunger
9e67dfbe17 CMake: Move more code into BuildDirManager
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>
2016-10-10 14:45:51 +00:00
Tobias Hunger
01149ad955 CMake: Remove unnecessary members from CMakeTargets
Change-Id: I6428496f4eab0d42f44525477c716f74714f8824
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:31 +00:00
Tobias Hunger
d41e10a595 CMake: Keep buildTargets private
Nobody needs those, so do not export them.

Change-Id: Ia8866ea2a514855c029974645d9b3f3dbcaa14ed
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:22 +00:00
Tobias Hunger
9b40c1fc04 CMake: Move code from CMakeProject into BuildDirManager
This is in preparation for having support for cmake's server
mode.

Change-Id: I6cc04fe7c5132c491c3f3c0f46560b8ad88808e8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-10-06 10:03:16 +00:00
Tobias Hunger
69627e494b Add helper code to generate trees of project nodes
Add helper code to FolderNode that enables the creation of a tree
of File- and FolderNodes from a FolderNode and a list of FileNodes.

Change-Id: Iba4b6a768fc3d0501851f141372e7e34913ba518
Reviewed-by: hjk <hjk@qt.io>
2016-10-05 15:42:47 +00:00
Tobias Hunger
87f7ec4ec9 CMake: Clean up CMakeProject
Some polish for the CMakeProject. Remove unnecessary includes, etc.

Change-Id: I3a73aac79b2177adc613f31865074f778ef21360
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-30 17:59:15 +00:00
Tobias Hunger
bb8cd10a04 CMake: Rename method
Change-Id: I6d30bdd7cf6d290f33601c766049e48c3def393a
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-09-30 10:54:09 +00:00
Tobias Hunger
bda9bf6755 CMake: Do not map all unknown build target types to "ExecutableType"
There is UtilityType now, so use that if there is no executable being
generated.

Change-Id: I9e8d512077b8352ec056b49c8db03644482b8fbc
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-08-25 11:35:37 +00:00
Tobias Hunger
703c410085 CMake: Only start parsing when creator gets focus again
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>
2016-06-28 09:10:02 +00:00
Wolfgang Bremer
2f301bc45b CMake: Update qmljs codemodel
With this patch it is possible to specify QML_IMPORT_PATH in
CMake projects and QtCreator will scan those paths.
One only has to make sure that the variable which is set in the
CMakeLists.txt is also added to the CMakeCache.txt

Task-number: QTCREATORBUG-11328
Change-Id: I11c7694806664d3203d855983e7db4a89fac267d
Reviewed-by: Thomas Hartmann <Thomas.Hartmann@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-04-29 09:08:05 +00:00
Tobias Hunger
83ae0cb934 CMake: Mark cmake as imperfect and disable RunConfigurations as necessary
CMake does not know whether a build target was configured out of the
current build or removed entirely, so implement the relevant marker.

Mark all of the "vanished" RunConfigurations as disabled.

Also remove one unnecessary level of indirection when setting up
RunConfigurations.

Change-Id: I30a21581823b4bff5a5be29480e64423b9379983
Task-number: QTCREATORBUG-15950
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-04-07 09:57:20 +00:00
Tobias Hunger
76a050cb83 CMake: Move BuildDirManager from the project into the buildconfiguration
Change-Id: I90126ff22dd394eba4145db142b3914d211af476
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-26 12:17:31 +00:00
Ulf Hermann
2e3e060520 Generalize support for extra compilers
Allow for different extra compilers which may get called to generate
additional code for the code model. The build system is expected to
know what files are generated from which source file and the extra
compilers know how to generate the content of those files, without
touching the build directory. the uic adapter is refactored to be
the first such extra compiler.

The extra compiler is run when an editor for its source document
loses focus, or after a timeout of 1s when the source document has
been changed.

Change-Id: I13c110c61120c812f02639a3684144daf8979b37
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-16 12:53:05 +00:00
Tobias Hunger
181f62c84a Make: Speed up reading compiler flags from build.ninja
Scan through the build.ninja file once for all targets instead once
for each target. This improves CMake project loading speed for
projects with many targets and a large build.ninja considerably.

Change-Id: I857c48a714dbb39a469f81c1f951a77f2f57578e
Reviewed-by: James Legg <jlegg@feralinteractive.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-16 09:41:26 +00:00
Tobias Hunger
a8c2abeaa5 CMake: Register files with the locator again
Change-Id: Ib3a42c22bfac18630b968cfd78744c7827ef7fad
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-15 15:58:57 +00:00
Tobias Hunger
28e4306865 CMake: Add UI to display and edit cmake configuration
Change-Id: I95944dcd58dc86023c2757068979f92b8989011b
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-02-15 11:57:11 +00:00
Tobias Hunger
859bf2c5ce CMake: Do not run a cmake wizard all the time
Do not push the cmake running straight into the face of the user. Do it
in the background instead.

This needs some follow-up patches to become really useful.

Change-Id: I3457178b33e3f14bdeac25005a773d17abb73b65
Reviewed-by: Tim Jenssen <tim.jenssen@theqtcompany.com>
2016-02-15 11:04:45 +00:00
Tobias Hunger
b2d537c878 CMake: Cleanup files
Change-Id: I22a20e598389bf27417bcb230dd469f8f9dfce0e
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-02-12 10:37:13 +00:00
Tobias Hunger
cfa9dd4c03 CMake: Use pragma once consistently
Change-Id: Id164dea5e7047b87c3d11c53ebd044d567129e9c
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-27 09:15:45 +00:00
Tobias Hunger
397e7f4843 Update License according to agreement with Free Qt Foundation
* Update files in src/plugins

Change-Id: Ia5d77fad7d19d4bb3498e78661982f68729adb22
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-19 15:57:01 +00:00
Tobias Hunger
d144ea58e0 Project: Add setRootProjectNode method
Add setRootProjectNode method and a default implementation of
rootProjectNode to Project. Use that in all derived classes.

Change-Id: Id28cde04457a20a8963d43020785ef9d77fea57c
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-11 15:33:26 +00:00
Tobias Hunger
219b2d9c16 Project: Do not save filenames in derived classes
Change-Id: I23960c61676e96c429b59ad8f8247e1b88606b1a
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-11 15:33:11 +00:00
Tobias Hunger
21d204ad5c Project: Add setProjectManager method
Implement default projectManager method in Project and use
these two everywhere.

Change-Id: I27e011e6fdc17b36aff1b8b931527307320e347c
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
2016-01-11 15:31:04 +00:00
Tobias Hunger
b386dd0e99 Project: Add setDocument method
Add setDocument method, implement document method, use this in all
projects.

Change-Id: I5018bf7c2739665c13eee340184ce7c41fd319bb
Reviewed-by: Niels Weber <niels.weber@theqtcompany.com>
2016-01-11 12:18:11 +00:00
Tobias Hunger
8146402e05 CMake: Use Qt5-style connects
Change-Id: I5ec451b55237fcceca86f0134ae081b435dab5c5
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
2016-01-08 13:33:44 +00:00