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>
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>
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>
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>
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>
${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>
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>
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>
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>
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>
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>
... 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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
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>
To HEAD of master branch. Also do the necessary API adaptations in
QbsProjectManager.
Change-Id: I4709b7a0f35537f5b6f9fd04f4d95be16aef2c8d
Reviewed-by: Jake Petroules <jake.petroules@qt.io>
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>
The heavy lifting was done by clazy.
Change-Id: I841454b0815bc697ae2372dbc6d2caa59d7dc3e8
Reviewed-by: Christian Kandeler <christian.kandeler@theqtcompany.com>
...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>
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>
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>
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>
And add some log output to help with debugging.
Change-Id: I806aee8b34ee8d90bdd40fa8d9ac2cd313485c28
Reviewed-by: Joerg Bornemann <joerg.bornemann@theqtcompany.com>
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>
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>
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>