Commit Graph

381 Commits

Author SHA1 Message Date
Tobias Hunger
2fde3fffa9 Make all projects generate a fresh project tree
Do not update the existing project tree anymore: Start a fresh one
and throw the old one away.

Change-Id: Ifabe293b6ca668b0672516a6d81acd5346d98fe5
Reviewed-by: hjk <hjk@qt.io>
2017-03-10 16:22:26 +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
Tobias Hunger
546df41853 ProjectPart: Add callGroupId
Do not rely on the projectfile being unique anymore.

Change-Id: I52e63b3ac8aeca43ef70af1d59d1d8612bd3540e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-03-09 13:50:08 +00:00
Tobias Hunger
cee92463f7 ProjectPart: Allow for line/column information in project file
Keep this information separate so that plugins using the information
do not need to start parsing the project file.

Change-Id: Ibecf431de1b12bbe820c6f8f9c986cffeb4972d2
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-03-09 13:49:36 +00:00
hjk
c1bfc5d8ec ProjectExplorer: Follow up on too-much-magic in IProjectManager
Use a ProjectManager::registerProjectType<Project>(MimeType) function,
removing cryptic IProjectManager object ownership.

Change-Id: I212cd25bd4ee757022a8cb0decb4b8de3a112d12
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-03-09 10:41:33 +00:00
Tobias Hunger
45ffa75054 Qbs: Move root project setup into QbsNodeTreeBuilder
Change-Id: If8ba7fc6e4edf1346e0636d0bbc78efb27cb433e
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-03-02 15:07:21 +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
hjk
8fd17a84b5 ProjectManagers: Cleanup
Remove unused class members, declarations, includes, unneeded
::projectManager overloads etc.

Change-Id: I0f4ae87414faca226554722e2a9147cb5512495d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-02-28 16:15:03 +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
Tobias Hunger
68b1859f58 qbs: Simplify add/remove file code
There is no need to call setupFiles on the QbsGroupNode before calling
update() on the root node. That will just redo the work anyway.

Change-Id: I54048395f87dd6fb5436f5d9d47b97e82460b568
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-28 14:24:59 +00:00
Eike Ziller
dbb2288f1a Merge remote-tracking branch 'origin/4.2'
Conflicts:
	src/shared/qbs

Change-Id: I05c4945d238b7724ca73477fc3b21554564951c0
2017-02-20 15:20:14 +01:00
Nikolai Kosjar
6ba90cd06a QbsProjectManager: Set proper Qt version for C++ Code Model
Change-Id: I04b5524e971e5617a9bae88c1fcab087d62d7a73
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-02-20 13:54:36 +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
Christian Kandeler
a7ed20faaa QbsProjectManager: Do not interpret Project::GeneratedFiles literally
The files retrieved by calling Project::files() with this flag show up
in the locator, in search results etc. So only consider files that we
know to be human-readable.

Task-number: QTCREATORBUG-17382
Change-Id: I7a66159e67207a09adb57b0c5584b0b067fd1fca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-02-16 12:24:15 +00:00
Nikolai Kosjar
e2e78c6a5d CppTools: Distinguish between ProjectFile::{unclassified,unsupported}
There was no way to determine whether ProjectFile::classify() was run or
not. Now, ProjectFile::classify() returns ProjectFile::Unsupported
instead of ProjectFile::Unclassified.

Change-Id: I660d0e42044bdefcac38058c6f4a3425983a6d93
Reviewed-by: David Schulz <david.schulz@qt.io>
2017-02-02 14:46:13 +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
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
Christian Kandeler
5b67e4de94 QbsProjectManager: Profile some operations
We want to know how much time the various update functions take that run
after a qbs job has finished.

Change-Id: I1bc6d1287108e5d70d15b41f2b544b22e2315a88
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-27 12:03:54 +00:00
Christian Kandeler
1b67f9eafd QbsProjectManager: Fix false positives when classifying files
... for the C++ code model. In particular, a file ending in ".h" must
not be unconditionally classified as an "ambiguous header", but only if
it has the "hpp" tag.

Change-Id: I33a463de78525fb965e781b4b75d1e088c055c3d
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-01-24 14:53:25 +00:00
Eike Ziller
b1e2d5b693 Merge remote-tracking branch 'origin/4.2'
Change-Id: Ib3073a0a3d80c99cf97b9839480dbf9583fa10de
2017-01-23 13:13:14 +01:00
Christian Kandeler
014167c8e8 QbsProjectManager: Remove duplicate include paths for the code model
Task-number: QTCREATORBUG-17381
Change-Id: Iabf1cdfe7988181e0e20396c5a5ec02e51e27f44
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-01-20 16:48:38 +00:00
Eike Ziller
8d08c601d5 Merge remote-tracking branch 'origin/4.2'
Change-Id: If9b3a860d7efb561bb710d49396d6bbe13809aa1
2017-01-12 10:54:48 +01:00
Tobias Hunger
a0125a6e6d Qbs: Fix warning about unused variables
Change-Id: If0659e83a188b4b76d3ae80bcbd4319c02b655da
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2017-01-11 10:15:34 +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
a80273edf0 QbsProject: Adapt assert
It fails now because with

    commit 521423b433
    CppTools: Call ProjectInfo::finish when we get it

the ProjectInfo is always changed.

Change-Id: I2c57cca330f42326d068e5077fc303d172b1be62
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-12-07 13:33: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
Christian Kandeler
c7e6054601 QbsProjectManager: Fix potential crash
Iterators 101: Make sure begin() and end() are called on the same
object.

Task-number: QTCREATORBUG-17339
Change-Id: Id757918e20a0a5017dc2135757f96f446abe0f48
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-24 09:47:55 +00:00
Christian Kandeler
0516f776cc QbsProjectManager: Fix precompiled header collection
Precompiled headers are designated via file tags since qbs 1.6, whereas
the code here still assumed the earlier, property-based approach.

Task-number: QTCREATORBUG-17195
Change-Id: If379fab5fbe63c7e3128d2ab1c53d08737cdcff1
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-11-23 13:44:06 +00:00
Christian Kandeler
0dc87382e9 QbsProjectManager: Translate qbs module properties to compiler flags
Workaround for this not being available via dedicated qbs properties
right now.

Task-number: QTCREATORBUG-17207
Change-Id: Id06a41edf0308e5b20dd6bc7aa390c18d75acb19
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2016-11-07 11:04:35 +00:00
Jarek Kobus
05747d7d33 Don't shout in text messages
Change-Id: Ie8d2c6761c87b358f0bc8691e529ba8144e267a4
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2016-11-04 09:51:29 +00:00
Nikolai Kosjar
6e6d5b5309 ClangStaticAnalyzer: Tests: Rely on projects telling when they finished parsing
We relied on the CppModelManager to tell us whether a project was reparsed
after a kit change. While this worked, it was not guaranteed that the project
is really finished (and ready for e.g. building) after pushing new ProjectInfos
to the CppModelManager.

Rely on the projects telling when they are finished with parsing. This is more
accurate and future-proof.

The introduced signals in Project and SessionManager are (at the moment)
only for tests.

Change-Id: I1b368ec4585ffa8755eb28fac6d187cce31243ee
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2016-10-31 15:09:01 +00:00
Christian Kandeler
313c0b1b3b QbsProjectManager: Fix displaying generated files
We did not update the project tree after building, so newly generated
files would not appear there right away.

Change-Id: I76ebc213ef43833203013186b0f0b38597cb1834
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-07 07:30:47 +00:00
Christian Kandeler
8281e55804 QbsProjectManager: Remove dead code
Change-Id: I71a740d5a97a7d5e493bb6fa6afe124b73753e52
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-10-07 07:30:17 +00:00
Eike Ziller
90cf4487a5 Merge remote-tracking branch 'origin/4.1'
Conflicts:
	src/plugins/autotest/qtest/qttestoutputreader.cpp

Change-Id: I4b323f2f3041d015fa04b9a25ec925f3b3e2411f
2016-10-05 15:28:04 +02:00
Christian Kandeler
47379011ea QbsProjectManager: Take Project::FilesMode into account
Change-Id: Ia3b56392c6334beb0e892adf952c0f752920d704
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2016-09-29 13:53:27 +00:00
Christian Kandeler
9e6d470c3a QbsProjectManager: Do not execute rules on initial project loading
The "rule execution only" type of build can lead to nasty bugs due to
scanners getting called for files that don't exist yet.
This effectively reverts a57e75884e.

Task-number: QBS-1021
Change-Id: I85e7559060112428f8cd5872b95619ac26979743
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-09-29 05:33:45 +00:00
Eike Ziller
72991fe9f8 Merge remote-tracking branch 'origin/4.1'
Conflicts:
	src/tools/clangbackend/ipcsource/projectpart.cpp

Change-Id: I2975328ae0398f70ef4403bd6cebdc80d24379c9
2016-08-25 12:18:57 +02:00
Christian Kandeler
f4b8ec1efc QbsProjectManager: Fix target change
We must not reset the project data directly; that is done when re-
resolving has finished. If we do it before, then we won't notice later
that the project data has changed and code models etc are not updated.

Change-Id: Ib0c030b46510c0241167e3beb261a08a0353db02
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-08-23 11:01:20 +00:00
Christian Kandeler
bfd0827811 QbsProjectManager: Make generated files available in project tree
Task-number: QTCREATORBUG-15978
Change-Id: Ia1890f1c4f8d1fa76568e42e15741281acb7dbb0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-08-17 08:25:24 +00:00
Christian Kandeler
0b3abfcf6a Update qbs submodule
To HEAD of master branch. Also do the necessary API adaptations in
QbsProjectManager.

Change-Id: I4709b7a0f35537f5b6f9fd04f4d95be16aef2c8d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-08-11 09:06:54 +00:00
Christian Kandeler
2b3d4685db QbsProjectManager: Have one qbs::Project per target
The class qbs::Project corresponds to a Qt Creator target, not to a Qt
Creator project. It represents a project set up for a particular
configuration.

Task-number: QTCREATORBUG-16545
Change-Id: I9e4fa6a4bf763e49335f294609d7465545df4559
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2016-07-15 12:32:34 +00:00
Orgad Shaneh
a22d8bcaa3 QbsPM: Use Qt5-style connects
The heavy lifting was done by clazy.

Change-Id: I841454b0815bc697ae2372dbc6d2caa59d7dc3e8
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-06-29 13:03:03 +00:00
Nikolai Kosjar
1cbb4cc954 QbsProjectManager: Fix SOFT ASSERT: "future.isFinished()"
...in file qbsproject.cpp, line 940.

The assert can be triggered with e.g.:
 1. Load a bigger qbs project, e.g. qtcreator.qbs.
 2. Trigger project build as soon as possible.
 3. Cancel the "Parsing C/C++" operation.
 4. Wait until the build finished and the assert occurs.

This happens because CppModelManager::updateProjectInfo() since

  commit  536ccc8a87
  CppTools: Fix incompletely indexed project

will check whether the previous indexer run was canceled or not. If it
was canceled, it will trigger a full-reindexing of the project.

Updating the compiler call data is a special case and it should never
trigger an indexing operation, so introduce a dedicated update function
for this case.

Change-Id: I456945ccf2bf697aaeada572ed87f3acb21a5eaf
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2016-05-03 08:03:24 +00:00
Christian Kandeler
7d9222970d QbsProjectManager: Re-parse project when build system files change.
This was accidentally broken in fdc552bda6 so that only changes to the
top-level project file would trigger re-parsing.

Change-Id: Iab2d6b0d3187f5875fec916fe4dccbef08b54669
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
2016-04-25 15:18:09 +00:00
Nikolai Kosjar
0dc1cec7bf CppTools: Include "group id" in CompilerCallData
We will need the id in a follow-up change to match the corresponding project
part.

Change-Id: Id7686503f96fb238c9fa9857e7fde5cf94b0bcc7
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-04-12 12:37:45 +00:00
Christian Kandeler
0bb8d52269 QbsProjectManager: Rework parsing/rule execution logic again.
It does not seem to be safe to update CPP data etc and then continue
with rule execution. So now we do it like this: We execute rules if and
only if no target artifact data is present, and updates are only done
afterwards.

Change-Id: I580918a8ec434b2c59bd044506c3a8e961c6b674
Reviewed-by: Christian Stenger <christian.stenger@theqtcompany.com>
2016-03-14 09:48:34 +00:00
Christian Kandeler
fdc552bda6 QbsProjectManager: Fine-tune project parse result handling.
And add some log output to help with debugging.

Change-Id: I806aee8b34ee8d90bdd40fa8d9ac2cd313485c28
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-11 12:36:43 +00:00
Christian Kandeler
83e3d954f9 QbsProjectManager: Make project structure available faster.
So that users can navigate the project already while rule execution is
going on.

Change-Id: I88a6f0cf80bf208c418671e3b862e1defe8d86ab
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
2016-03-08 14:05:00 +00:00
Ulf Hermann
c0b9565de7 QbsProject: updateCppCodeModel() after building for extra compilers
We don't know the target files of extra compiler until we build the
project. So, if we detect that situation when generating the code model,
regenerate it after building the project the next time.

Change-Id: I5dab9be2fcc14a11b01ecbc0d67f2d8e895c1b91
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-03-02 12:37:30 +00:00
Ulf Hermann
77b1063d8c QbsProject: Implement filesGeneratedFrom()
Unfortunately we cannot use it for updating the code model after all,
as the same file might be used in different products to generate
different files. However, with the new "recursive" parameter to
qbs::Project::generatedFiles() we can use that function directly there.

Change-Id: Iec8e1a1366c6f4d94198b38bcb464d05106dbbff
Reviewed-by: Tobias Hunger <tobias.hunger@theqtcompany.com>
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
2016-03-02 12:37:26 +00:00