Commit Graph

90 Commits

Author SHA1 Message Date
hjk
2758682723 ProjectExplorer: Move BuildSystem owership to BuildConfiguration
... or Target.

This patch moves build system from conceptually "one per project"
to "one per target (i.e. per project-and-kit)" or "per
BuildConfigurations" for targets where the builds differ
significantly.

Building requires usually items from the kit (Qt version, compiler,
...) so a target-agnostic build is practically almost always wrong.

Moving the build system to the target also has the potential
to solve issues caused by switching targets while parsing, that
used Project::activeTarget() regularly, with potentially different
results before and after the switch.

This patch might create performance/size regressions when several
targets are set up per project as the build system implementation's
internal data are duplicated in this case.

The idea is to fix that by sharing per-project pieces again in
the project implementation once these problems occur.

Change-Id: I87f640ce418b93175b5029124eaa55f3b8721dca
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-11-19 11:05:52 +00:00
Christian Kandeler
03a52b9c87 QmakeProjectManager: Improve renaming functionality
This was implemented rather sloppily: The file was removed from all
variables, but only added to one. Also, no care was taken to insert the
new file name into the same block the old one was removed from.

Fixes: QTCREATORBUG-19257
Change-Id: Ib309389ba7647189112d5c7dd7b3e784f921d2c3
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-11-04 13:37:17 +00:00
Christian Kandeler
ac37c5c950 QmakeProjectManager: Mark disabled source files in project tree
We show all source files in the project tree, including those which are
listed in scopes that evaluate to false in the current configuration.
This is intended, as we want users to be able to navigate to all files,
not just the ones that are part of the build for the current target.
However, it'd be nice for users to be able to tell which files are
"active" and which ones are not. Therefore, we now mark the non-active
ones as "disabled" in the project tree, just like the QbsProjectManager
does.

Task-number: QTCREATORBUG-22855
Change-Id: Icfb48d4f6a247de76fc109acb84b34f03866e754
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-22 11:57:45 +00:00
Christian Kandeler
6e63a0757b QmakeProjectManager: Fix possible assertion
Amends 6c40fec9b0.

Change-Id: I11426f17a7e7a81bf4adcba742c6298f224b7ef1
Reviewed-by: hjk <hjk@qt.io>
2019-08-14 11:42:58 +00:00
Christian Kandeler
6c40fec9b0 QmakeProjectManager: Try harder to find include paths in sysroot
As opposed to qmake itself, Qt Creator tries to resolve the value of
INCLUDEPATH against the sysroot. Therefore we should not reject Unix-
type absolute paths as candidates for sysrootification on Windows hosts.

Fixes: QTCREATORBUG-21164
Change-Id: If4be103061ad3edc64f8d1f5cfeb7c6b48e961c8
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-08-13 13:54:02 +00:00
Christian Kandeler
a666be04f2 QmakeProjectManager: List .ts files in the project tree
...without the user having to add them to DISTFILES or OTHER_FILES in
addition to TRANSLATIONS.

Task-number: QTCREATORBUG-7453
Change-Id: Ic9621e66079a52f22272c945b92d183eec852f68
Reviewed-by: hjk <hjk@qt.io>
2019-07-31 15:23:02 +00:00
Christian Kandeler
ead8aea35b QmakeProjectManager: Preserve line endings
... when adding and removing files via the project tree.

Fixes: QTCREATORBUG-2196
Change-Id: Ie4ee3a244c9089953cf414d9777fc65b6a8b9689
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-07-25 08:34:10 +00:00
Tim Jenssen
333b33edbe Merge remote-tracking branch 'origin/4.10'
Change-Id: Iaf27911e4e9fb762c1a24c84c458462bafe95728
2019-07-12 15:53:56 +02:00
hjk
9ae2794114 Remove more deprecation warnings
Change-Id: Ie50e41737a4bf7bea41f550df7cc765267e8a144
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-05 12:51:17 +00:00
hjk
c77cef5706 Avoid more deprecation warnings
Change-Id: Icc7bb7a4ccf7fc9f89f6f668c194ccd440e5231c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2019-07-05 07:49:48 +00:00
Tim Jenssen
1df6443d4a Merge remote-tracking branch 'origin/4.10'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator_ide_branding.pri
	src/libs/utils/synchronousprocess.cpp
	src/plugins/baremetal/iarewtoolchain.cpp
	src/plugins/cmakeprojectmanager/cmakeproject.cpp
	tests/unit/unittest/CMakeLists.txt

Change-Id: I124ad492df403286751e175d27fe36487ddf6d07
2019-07-04 15:17:55 +02:00
Christian Kandeler
599b03179e QmakeProjectManager: Take "executable" CONFIG value into account
... when setting up deployment data.

Fixes: QTCREATORBUG-22663
Change-Id: I88c428177b76a7bb59fc884c0b727fd0f26a780f
Reviewed-by: Jörg Bornemann <joerg.bornemann@qt.io>
2019-07-04 10:49:43 +00:00
Ville Nummela
63e4180242 ProjectExplorer: Add special handling for removing files
... from a project which are pulled in via wildcards.
Such files cannot be removed from a project file, because they are
not listed verbatim. This kind of failure should not be reported to the
user if the file is also deleted, as the file list will have the correct
state after the next reparse.

Fixes: QTCREATORBUG-22586
Done-with: Christian Kandeler <christian.kandeler@qt.io>
Change-Id: I3dc66fe9a6594be7d0b86f46d830cd099ee49fd7
Reviewed-by: hjk <hjk@qt.io>
2019-06-25 11:53:58 +00:00
Christian Kandeler
019447c535 New class wizard: Add Qt module dependencies, if necessary
Provide general infrastrucure and implementation for qmake.

Fixes: QTCREATORBUG-16067
Change-Id: I8c6368fe2724c9450dcbc3410b6ca459bbbdc043
Reviewed-by: hjk <hjk@qt.io>
2019-06-19 14:06:49 +00:00
Christian Kandeler
cd8ebb21e3 QmakeProjectManager: Make sure OBJECTIVE_HEADERS appear in project tree
We do not introduce another category, but list them under "Headers", as
we do with PRECOMPILED_HEADER entries.

Fixes: QTCREATORBUG-17569
Change-Id: Ie0e6efdd09715daf2802b126a4ecbdc20b25d008
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-14 11:18:31 +00:00
hjk
42d7d3123a QmakeProjectManager: Remove dead code
Change-Id: Ib0cf30c9aa9dce6e55fbdb914cf0bfd4a539496f
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 16:04:20 +00:00
hjk
473a741c9f Utils: Rename FileName to FilePath
More in line with QFileInfo terminonlogy which appears to be
best-of-breed within Qt.

Change-Id: I1d051ff1c8363ebd4ee56376451df45216c4c9ab
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-28 12:23:26 +00:00
hjk
f4c9e5e5c4 More FileName::appendPath() -> .pathAppended()
Change-Id: I403d34e4f52f758339c158efc7a11fd329e3e043
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-17 11:55:04 +00:00
Eike Ziller
829a08047f Merge remote-tracking branch 'origin/4.9'
Conflicts:
	src/plugins/qbsprojectmanager/qbsrunconfiguration.cpp

Change-Id: I473084232ab99c18e2316154656de0035af02628
2019-05-17 12:47:24 +02:00
hjk
f99d69ee43 Utils: Replace mutating FileName::appendString
... by a non-mutating .stringAppended, doing the same.

Change-Id: I7adb6cae3415942cc9a80088bd75cda9d577d4a5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-15 07:42:59 +00:00
hjk
8b532c2cc5 Utils: Replace FileName::FileName(QFileInfo) by a named constructor
More consistent with the fromString case and avoiding false
conversions QString -> QFileInfo -> FileName in case the
inheritance of QString suddenly disappears.

Change-Id: Ib14646ab1a660fd45dd1ea6862a0b5faa52ad0e3
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-13 11:33:33 +00:00
Christian Kandeler
b1b52ac674 QmakeProjectManager: Do not ignore files from included .pri files
... when setting up extra compilers.
For example, the code model was not able to resolve included ui_*.h
files in a project that wasn't built yet, if the respective FORMS
declaration came from a .pri file.

Fixes: QTCREATORBUG-22395
Change-Id: I75c4b2b38fec209519adb563d579ecd3a17fe042
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-05-08 13:07:31 +00:00
Eike Ziller
4545c81e57 Merge remote-tracking branch 'origin/4.9'
Conflicts:
	doc/src/howto/creator-sidebar-views.qdoc
	doc/src/howto/creator-ui.qdoc
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri
	src/plugins/autotest/testresultmodel.cpp
	src/plugins/autotest/testresultmodel.h

Change-Id: I24cc585ca7782cb1d9cb0b8b73b46892b41937fd
2019-05-08 12:41:25 +02:00
Ville Nummela
ecd386c67b QmakePM: Only schedule update when files are added/removed
When a file is saved, the directory is also touched. If files are not
added or removed, it is not necessary to reparse the project.

Change-Id: I718db68362d41ba936629be880f739ad79b8cb6f
Fixes: QTCREATORBUG-22361
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-04-26 05:41:07 +00:00
Christian Kandeler
f30d27b10f QmakePM: Find prf files for CONFIG values
... in the pro file editor.
When the user selects "Jump to file under cursor" (e.g. via F2), and the
string under the cursor is not resolvable as a local file path, we
assume it is a CONFIG value and try to locate a corresponding prf file.
To this end, we expose the "feature roots" information of the qmake
evaluator in the QmakeProFile class.

Fixes: QTCREATORBUG-15753
Change-Id: Ibdc6e194a40f07030a5d21f2ddc7b92b63d1765b
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-04-02 08:23:57 +00:00
Christian Kandeler
47d159273e Qmake: Fix infinite reparsing loop
Under certain circumstances, the file system watcher in the qmake
project parser keeps emitting the directoryChanged() signal even though
there seem to be no changes on the file system. Make sure we reparse
only if the directory timestamp has really changed.
This amends 76262814b6.

Change-Id: Ibdcd1e8405a49e78528bf5903e7caafc371cad1b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-03-25 17:38:56 +00:00
Christian Kandeler
86e16c9e14 Qmake: Add special CONFIG variable "qtc_run" when parsing project files
The idea is that some of the more intrusive prf files in Qt can skip
themselves when they encounter this condition.

Task-number: QTCREATORBUG-17521
Change-Id: I09a33b2d3c5dee1232803d46c521cc9fd29e1898
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-02-27 12:01:52 +00:00
Christian Kandeler
69565d6c88 QmakePM: Respect editor settings when adding files to project
If the user wants to indent with tabs, then consider that when adding
source files via the UI. But try not to mix: If the respective variable
already uses a different indentation consistently, then keep using that
one.

Fixes: QTCREATORBUG-8016
Change-Id: I037c9ac4d4e7fbbe5753a846e57d938bbb440d6a
Reviewed-by: David Schulz <david.schulz@qt.io>
2019-02-05 11:31:52 +00:00
Christian Kandeler
a420374976 QmakePM: Do a "sorted insert" when adding files
Don't blindly append to the end of the list, but try to put files into
the right place with regards to lexicographical order.
We do not re-sort existing file lists, nor do we attempt to be fancy
with strangely formatted project files. But lists conforming to our own
style will stay sorted, in particular lists that have only ever been
touched by Qt Creator.

Fixes: QTCREATORBUG-553
Fixes: QTCREATORBUG-21807
Change-Id: I15db0e867a2d477fcf95e008f98ba468dcd83e45
Reviewed-by: Joerg Bornemann <joerg.bornemann@qt.io>
2019-01-24 15:31:53 +00:00
Nikolai Kosjar
820e4f8177 ClangTools/QMake: Stop analyzing files not part of build configuration
...for the qmake project manager.

When parsing the project files, remember whether a file was discovered
by the exact or cumulative parse. Only files that were discovered by the
exact parse are considered "active" and thus part of the build
configuration. The others are not offered for selection.

Fixes: QTCREATORBUG-16016
Started-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Change-Id: I7a28b4de15e048975d7f0cd737dd8c11f744315b
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@gmx.de>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-08 14:09:52 +00:00
Ville Nummela
76262814b6 QmakeProjectManager: Watch wildcard directories for changes
If e.g. DISTFILES contains wildcards, watch the directory for changes.

Fixes: QTCREATORBUG-21603
Change-Id: Ia6e8c94ab7b74e0404776ba1d7d9b10eb3b643de
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-12-12 05:09:22 +00:00
hjk
54efabd6e9 Qmake: Move some data accessors from QmakeProFile to QmakeProFileNode
These are not used during parsing but when operating on the items
in the project tree.

This loosens the ties between the qmake related parser and project
nodes.

Change-Id: I077356fcde240df56b466c71c902c821c4885f6d
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2018-11-14 10:04:25 +00:00
Orgad Shaneh
bdc2b4b59f Remove hard-coded disabling of debug logs
Instead, set the default level of all logs to QtWarningMsg.

The call to setFilterRules overrides the user preferences in qtlogging.ini.

Change-Id: Id5f6cd550d14ff7f45ae04c5d3110e0bafb0f072
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Kai Koehne <kai.koehne@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-10-13 16:36:58 +00:00
Alessandro Portale
cd5066d86b QmakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using
modernize-use-equals-default

Change-Id: I7642992eee6838bb2566921de87390c1771ebcbe
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-13 09:25:21 +00:00
Eike Ziller
9bbb085718 QMake parsing: Improve behavior in case of empty build directory
The build directory can be "empty" if there is no build configuration,
or if the build configuration's build directory is empty.

Handle both cases in the same way.
This avoids passing an actually empty build directory to the parser,
which the parser does no longer handles gracefully on Windows.

If the build directory is empty, use the project's source path (instead
of QDir(QString()) which is the current working directory), which makes
it consistent with the behavior when actually building in that case.
The parser does not actually write files to disk, so there is no issue
with temporarily using that directory and later switching to a shadow
build directory.

Task-number: QTCREATORBUG-20121
Change-Id: Ia454085edae6b55b445cc5cf0ec3ae1c85464b0c
Reviewed-by: Ivan Donchevskii <ivan.donchevskii@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-07-04 15:17:04 +00:00
Eike Ziller
6e66b2a078 Remove some lambdas from Utils::transform calls
It is often possible to user (member) functions or members directly.
That improves readablility and potentially reduces the total number of
symbols.
Also use qobject_container_cast at places where it is appropriate.

Change-Id: Ia2591bca356591e001e2c53eeebcf753e5bc3c37
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-05-28 13:45:20 +00:00
Antonio Di Monaco
bf5ba08435 Fix coding style
This patch fixes the incorrect brace symmetry contained in the patch
916bc59cfb .

Change-Id: I003c89f5f2170190d1ae2f52f186862fe06a2135
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-04-11 14:47:18 +00:00
Antonio Di Monaco
916bc59cfb Add support for system include directories in qmake project files
When system include paths are added via QMAKE_CXXFLAGS in a .pro file,
in order to use the -isystem parameter, they are not taken into account
by Qt Creator.

This patch adds support for -isystem parameter in QMAKE_CXXFLAGS
parsing.

Change-Id: Ibd25734ec9f3a18258c445804c4a17269d7522ed
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-04-10 14:57:20 +00:00
Orgad Shaneh
7d3a79c696 Utils: Purge asConst
Replace by qAsConst.

Change-Id: I3301366f73c066c86f08df7188d70dc3b613c55c
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2018-04-09 09:04:00 +00:00
Eike Ziller
278a5f1e33 Merge "Merge remote-tracking branch 'origin/4.6'" 2018-03-16 10:29:37 +00:00
hjk
e20d620043 ProjectExplorer: Let RunConfiguration declare what nodes it belongs to
This feature in question is the availability of the "Run" button in the
context menu of certain project nodes in the project tree to run
something presumably related to/build from that (sub)project.

Previously, the decision was made for certain qmake based projects
(those targeting Desktop, iOS and VxWorks) by some indirection
through the corresponding RunConfigurationFactories.

The patch lets the RunConfigurations decide themselves directly
and removes the indirection, potentially opening the feature for
other qmake based RCs, as well as other combinations (e.g.
PythonRunConfiguration could be associated with its .py file,
without the need to have a dummy project)

Change-Id: Ic489bd1dfa25fcd9102ffa4fa30125565dd2e40e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-16 09:55:03 +00:00
Oswald Buddenhagen
60245e55d7 qmake: Change source identifier type in ProString
The strings remember in which file they were created/assigned.

However, this used a non-counting reference to a ProFile, which could
become dangling. If a subsequent ProFile re-used the exact same address,
a string's source would be mis-identified, which would be fatal in
conjunction with discard_from().

Since we actually need only a unique id for comparison, let's use an
integer for that.

comment on cherry-pick: this is actually a lot more than a cherry-pick,
because the file ids need to be aware of the dual VFS which was
concurrently introduced on the qtc side.

Started-by: Simon Hausmann <simon.hausmann@qt.io>
Change-Id: I395153afaf7c835d0119690ee7f4b915e6f90d4a
(cherry picked from qtbase/190aa94be7f5e146bef44862b974d733755cec85)
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-03-14 15:34:01 +00:00
Eike Ziller
8e1fefd8de Merge remote-tracking branch 'origin/4.5'
Conflicts:
	qbs/modules/qtc/qtc.qbs
	qtcreator.pri

Change-Id: I29979e76cb01bc94ddcd7868ca1cbc34afb14c5d
2017-11-27 12:46:56 +01:00
Tobias Hunger
dfcd573427 Qmake: Do not crash when closing a project while it is parsing
* Fix crashes and resource leaks in qmake project.

Task-number: QTCREATORBUG-19358
Change-Id: I3b383640cdf994b4014ccbfc4278be48f9e5fd3f
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2017-11-27 09:16:54 +00:00
Orgad Shaneh
a6cda6dbe0 Merge remote-tracking branch 'origin/4.5'
Change-Id: I16e3bb9ee3a1e6dc6edf7a65f8a137a25cda4fe3
2017-11-05 16:49:17 +02:00
Tobias Hunger
19e125ce5f Qmake: Pass on QMAKE_CFLAGS to the code model
Change-Id: I87c07177adcfd72c7852f84266feb9baf1f87e5b
Reviewed-by: Nikolai Kosjar <nikolai.kosjar@qt.io>
2017-11-03 14:07:30 +00:00
Tobias Hunger
1094fe5abf Qmake: Fix detection of successful parsing run
Do not report success of a qmake parsing run based on every .pro-file
having reported success. Take the top-level .pro-file's success value
instead.

This fixes e.g. Creator, which has some .pro-files that error out in
some conditions.

Task-number: QTCREATORBUG-18992
Change-Id: I888141e723da84fb780ccd84c86acc25d03f5f28
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-03 10:12:59 +00:00
Tobias Hunger
af572c546f Qmake: Speed up QmakePriFile::findPriFile
Avoid needless detaching in that method: The method is used less since
the Nodes no longer need to go through it. All the runconfigurations
still use it, so this change is still noticeable.

Change-Id: I9f5e238ab1ef7165fd4fef1b0f80d4e5daa9a7e8
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Christian Stenger <christian.stenger@qt.io>
2017-11-03 10:12:49 +00:00
Christian Stenger
aab634ff15 Revert "Qmake: Make finding pro-files fast"
The patch broke defining the correct executable for qmake based
projects. Loading more complex projects (like QC itself) did
end up failing to run any executable out of the box as the
executable name was always wrong.
This reverts commit 21b0e7c37e.

Change-Id: I471c9963bd739b74e48286e1bde00f7222b90c8b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-02 09:45:25 +00:00
Tobias Hunger
21b0e7c37e Qmake: Make finding pro-files fast
Finding the right pro-file was surprisingly slow. Make that fast again.

Task-number: QTCREATORBUG-19131
Change-Id: I4b5a8887cb13c36273a553f935a00d87cee4a7b5
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-11-01 12:54:25 +00:00