Commit Graph

237 Commits

Author SHA1 Message Date
Tobias Hunger
270f863254 Qmake: Use QmakeProFile, not QmakeProFileNode
Change-Id: Ic156e25bcb797f8643639fb0606f2713830e83f6
Reviewed-by: hjk <hjk@qt.io>
2017-03-08 10:42:16 +00:00
hjk
d6df4492d0 ProjectExplorer: Use visitor-by-lambda for project tree
And inline it into user code. Less code in total and no intermediate
node lists.

Change-Id: I3724883408bfaa868266110aee27bbffd4d96bd8
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-08 09:05:29 +00:00
Nikolai Kosjar
45b7c5ac29 Revert "CppTools: Do not put configuration document into global snapshot and working copy"
This reverts commit 05942b63f8 because it
breaks refactoring, e.g. Q_PROPERTY generators.

Change-Id: I9a14b912ba72663f08ea99e7e066d824b18da4b0
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-03-07 11:54:16 +00:00
hjk
be204a125e ProjectManager: Cut ties between Project and IProjectManager
Not needed, less code.

Change-Id: Ie0d5c3a60f0392f30ed2ee9d2c5a32156b4e67e1
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-01 17:07:05 +00:00
Tobias Hunger
1ca7c150d0 Qmake: Clean up createProFileReader method of QmakeProject
Change-Id: I62c55afb8a3ea4dcbe3a8a1b4387d087bb71cdea
Reviewed-by: hjk <hjk@qt.io>
2017-03-01 14:47:41 +00:00
hjk
6fc03ac621 QMake: Simplify QmakeProject::creationIds use further
We always operate on specific types of proFiles, knowing the types
suffices as interface.

Change-Id: I5ffe8862ae31234843a71bdae537825b37ccd311
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-28 16:14:50 +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
hjk
b45c709dff QMake: Centralize determination of available creationIds
No need for each target to do essentially the same.

Change-Id: I76b6a0f2d064d7721f4ebe676f6efe12d3b5f87c
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Vikas Pachdha <vikas.pachdha@qt.io>
2017-02-28 12:19:11 +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
Tobias Hunger
f9eab73dad qmake: move over from QmakeProjectNodes to QmakeParserNodes
Change-Id: Iab87e0c248b0f651a1774336c3bddf83baa9d057
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-22 16:00:49 +00:00
Tobias Hunger
8f0697e33d qmake: Unify TargetInformation and TargetParserInformation again
Change-Id: I00fc6e99e55684e67e5240c539002b13f4541286
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-22 13:19:20 +00:00
Tobias Hunger
bc390a8e99 qmake: Do not use out-parameters for QmakeProject::findProFile
Change-Id: I9eec5138ebe0d3c02dadb91c66146e4419fc9cd3
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-22 13:07: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
2513116406 qmake: Fix WS
Change-Id: Ied361023444e21575504d2175c36fefd02e43752
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-17 12:51:38 +00:00
Tobias Hunger
69684d9f9c qmake: Rename QmakeParser*FileNode to Qmake*File
Change-Id: I7598ccf93ed21a6d6650db76b17d745a2739b18c
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-15 11:02:04 +00:00
Tobias Hunger
528b5f2298 qmake: Use enums from Qmake*File over those in Qmake*FileNode
Use QmakeParserProFileNode::AsyncUpdateDelay instead of
QmakeParserProFileNode::AsyncUpdateDelay.

Change-Id: I6628e566ce0f289778d61d146df58ca31345cdd7
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-15 09:02:52 +00:00
Tobias Hunger
b697fd0db4 qmake: Use Variable enum consistently
Change-Id: I89588f12600f0698de764c05c1930b13b53a2588
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-14 15:40:16 +00:00
Tobias Hunger
086733a2c9 qmake: Use ProjectType enum consistently
Change-Id: I633a7150202fcbf420a33b4173d2b4451f46eb11
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-14 15:40:11 +00:00
Tobias Hunger
0b6eb21388 QmakeProject: Fix CentralFolderWatcher
Make the loop actually iterate over something:-)

Change-Id: I9e7ff40c3e5c3860a99bca15e381c1e12eed4d51
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-14 15:39:29 +00:00
Tobias Hunger
bfa456072c qmakeProject: Use nullptr
Change-Id: Idad0ace2ae264beff29864cb20cb1a7b67d16ac6
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-14 14:39:43 +00:00
Tobias Hunger
e98f5ae226 QmakeProject: Remove some debugging code
Change-Id: Ia4266d568074023edfe40177e1e6a35186d935dd
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-02-14 14:33:13 +00:00
hjk
95e2d7f545 ProjectExplorer: Remove ProjectNode::m_projectNodes
They are duplicated in m_folderNodes, use them.

Change-Id: I4571720f1ef3daf098870a3cf05fa28a1002bb3f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-02-08 11:15:55 +00:00
Tobias Hunger
b139b057a1 QmakeProject: Polish class
Use final, get rid of some useless headers and debug code

Change-Id: Icb1110f6eda4e17d143d8bdf17167d6c3046b884
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-01-31 15:28:17 +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
Oswald Buddenhagen
8288ca1251 make more use of BaseQtVersion::qmakeProperty()
... instead of peeking into versionInfo().
in fact, make versionInfo() private, to avoid subsequent deterioration
as happened before (after 5e596e89d).
some other functions that use it in its interface also become private.

this fixes several breakages related to working with non-installed
prefix builds of qt.

Change-Id: Ib67de79323c9e38f3de48a09854b155de9eef5b2
Reviewed-by: James McDonnell <jmcdonnell@blackberry.com>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: BogDan Vatra <bogdan@kdab.com>
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2017-01-24 14:01:06 +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
25fbcca96b KitManager: Get rid of KitMatcher class
Use std::function instead. Clean up API while at it.

Change-Id: I6e401ab57f5375e36710c30508c596af3f4b3385
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-01-18 10:39:16 +00:00
Tobias Hunger
6553c3c99e BaseQtVersion: Allow for a predicate when retrieving Qt versions
Make methods used to retrieve Qt versions from the Qt versions manager
take a predicate to select the interesting version.

Change-Id: I9218c57bae6d5033d49d618dfc0da41fe578444d
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-01-17 13:13:48 +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
Orgad Shaneh
ffabc5dff1 QmakePM: Fix false positive warning for incompatible compiler
Some users set 'QMAKE_CXX = @echo $< && $$QMAKE_CXX' to prettify the
compiler output.

Another useful case for "incompatible" compiler is ccache, or other
compiler wrappers.

To eliminate warnings for these cases, pick the last value of QMAKE_CC/
QMAKE_CXX, excluding flags, and compare it against the configured toolchain.

Change-Id: Idc3b9377e6f7c39c09c50f36ec89460756510b97
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-01-04 09:26:29 +00:00
Nikolai Kosjar
0265442c93 QMakeProjectManager: Use ProjectPartBuilder
...as the other project managers.

This removes extra code paths, duplication and improves classification
of source files (ambiguous headers).

Change-Id: Iae05cbbc61ab2e5dd841ae617bec994e0a1e52d5
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-13 14:55:36 +00:00
Nikolai Kosjar
602ad72d42 CppTools: Refactor ProjectPartBuilder
...and add some basic tests.

Introduce the abstractions ProjectInterface and ToolChainInterface in
order to break the dependency to the ProjectExplorer. Also, some simple
logic can go there to simplify the (Base)ProjectPartBuilder.

Change-Id: I6c50a1804ce62098b87109931eb171f5c2542937
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-13 08:33:04 +00:00
Nikolai Kosjar
3a369552c6 CppTools: Classify ambiguous headers depending on other files
This applies for all project managers, except qmake. The qmake project
manager will make use of this in follow up changes.

Before, "foo.h" was always recognized as a CXXHeader. Now, it depends on
the other files. E.g. in a file list {"foo.h", "foo.c"} foo.h is now a
CHeader. In {"foo.h", "foo.c", "bar.cpp"} the file "foo.h" is ambiguous
and we will create two project parts, one where it is a CHeader, the
other where it is a CXXHeader.

Change-Id: I50505163368742584b1380c284d42cbe07cb4fc9
Reviewed-by: David Schulz <david.schulz@qt.io>
2016-12-12 13:49:09 +00:00
Nikolai Kosjar
05942b63f8 CppTools: Do not put configuration document into global snapshot and working copy
These are remnants of the time when we had only one snapshot.

Change-Id: I6ff4db645d1065a0ef195834890e0774e2e2c60e
Reviewed-by: David Schulz <david.schulz@qt.io>
Reviewed-by: Erik Verbruggen <erik.verbruggen@qt.io>
2016-12-08 08:52:17 +00:00
Nikolai Kosjar
521423b433 CppTools: Call ProjectInfo::finish when we get it
No need to require the project managers to do this. Also, it is easy to
forget.

Change-Id: I96f7a5e5547418678af9653e5753c372f0880e5a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-06 14:34:39 +00:00
Nikolai Kosjar
d006fc4149 QMakeProjectManager: Clean up updateCppCodeModel()
Change-Id: I083a6ed91d78ee278977128ec0f19ed28d0eeae4
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-06 14:34:33 +00:00
Nikolai Kosjar
458e775f88 QMakeProjectManager: Remove unused function
Change-Id: I47f598f5de364f8039de910894747b2d66ceba0e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-12-06 13:55:18 +00:00
Francois Ferrand
38ae5aec10 C++: Fix handling of Objective-C/C++
- Objective C/C++ was not enabled in highlighter.
- QMake project part for Objective C/C++ did not have ObjectiveC extension enabled.
- As languageFeatures.objCEnabled is a bitfield, it was actually always set to 0.
- Highlight ObjC class & protocol declarations.
- Highlight ObjC message passing.

Change-Id: I64d12c9509058d05f7adce94598cb7ce91727ac8
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-12-05 10:27:58 +00:00
Alessandro Portale
15148d8e44 ProParser: Use the "Default Codec" when reading qmake files
This change adds a QTextCodec* member to QMakeVfs. It is used to decode
the qmake file contents in QMakeVfs::readFile. The QMakeProjectManager
sets it to the current "Default Codec".

This is necessary only in Qt Creator, where the parser would actually
use Local8Bit (unlike qmake's Latin1), which would sometimes lead to
misinterpreted multi-byte chars in comments swallowing newlines and thus
falsifying the actual code.

Bootstrapped qmake is not affected by this addition.

Task-number: QTCREATORBUG-17309
Change-Id: I34b42bd19e0de973deb2291e91f306d1ca7c630e
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
2016-12-01 17:06:41 +00:00
Tobias Hunger
16bb89fee9 Qmake: Remove useless nullptr check
Change-Id: I6fe9ca620d6bac9e3cab44fb90623fa984229416
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-30 13:39:21 +00:00
Tobias Hunger
6e17882bfc ProjectExplorer: Use Utils::FileName in ProjectImporter API
Change-Id: I60e05f1bd892b508db90bc48837e29e2725bf333
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-16 13:36:29 +00:00
Orgad Shaneh
9c09ca9e42 Merge remote-tracking branch 'origin/4.2'
Change-Id: Ia98031eb87f1859c3736faa0cdd8b655e8a50689
2016-11-14 11:17:13 +02:00
Tobias Hunger
67e011ba5f ProjectExplorer: Make naming of methods on Nodes more consistent
Change-Id: I5050a020f0fc0ef4556db1d2020afeadfcd51585
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2016-11-10 15:24:02 +00:00
Tobias Hunger
0f1f595a12 QmakeProjectManager: Improve signalling of parser state
Correctly signal when parsing of a qmake project starts and stops via
the build- and runconfigurations.

The buildconfigurations are in the picture since they disable the run buttons
when the user has selected to build before deploy and deploy before run.

Task-number: QTCREATORBUG-16172
Task-number: QTCREATORBUG-15583
Change-Id: I44b5f5ce8e145cb93dc0022f66e1edcc202875e4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-09 10:15:05 +00:00
Tobias Hunger
ce3e586198 ProjectExplorer: Shorten space needed to store a FileType
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>
2016-11-03 15:55:39 +00:00
Oswald Buddenhagen
5f17c280ec de-duplicate INSTALLS resolution
don't resolve the source files once for deployment and once for the
project tree.

Change-Id: Ifddf8fc7883bf025d3640de0d6676b5930991088
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-01 17:37:17 +00:00
Oswald Buddenhagen
7e86b98836 unify {,obj}c++{source,header} handling in qmake project manager
consistently with Xcode, qmake nowadays knows only one SOURCES list,
which is automatically classified by extension.
to replicate that, we actually copy the objective_c.prf file from qt
5.6.3 and use it to override whatever comes with qt, so we can treat all
qt versions uniformly.

also, the code model throws away the information which files were listed
as sources and which as headers. this is technically incorrect, as a
source may be only included rather than compiled, but there is no point
in extracting information which is not used.

conclusion: lump all c-like sources into one variable as far as project
processing is concerned.

and as far as configuration goes, our code model doesn't differentiate
anyway, so the duplicated setup paths can be eliminated as well.

Change-Id: I24b1bc056f8d9eb579c9378817f602912ab49971
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-01 17:35:59 +00:00
Oswald Buddenhagen
a8010b0fff make VFS aware of exact vs. cumulative evaluation
the cumulative evaluation has a good chance to make a mess of the
virtual file contents created by the exact parsing, so better contain it
to its own namespace.

the ProFile cache also needs to keep the files separate. this
specifically addresses the side issue discussed in QTCREATORBUG-10779.
it also fixes attempts to deploy the wrong build when the variant is
selected through a cache file, as in QTCREATORBUG-15815.

in the project explorer, we don't track from which evaluation pass
particular files came from, so we try the cumulative first to get the
most contents, and fall back to the exact one if the former file is
empty (or does not exist at all).

Task-number: QTCREATORBUG-15815
Change-Id: I2c1eb16c97526fa275a1c6a2eae9266d385859ac
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-01 17:35:22 +00:00
Oswald Buddenhagen
424639ecac make resource file handling able to deal with QMakeProject's VFS
resources.prf may create virtual qrc files when RESOURCES contains
non-qrc files.

Change-Id: If591de9b32b775059d67e94bc3cb06d23ee44b08
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-11-01 17:34:55 +00:00