Commit Graph

203 Commits

Author SHA1 Message Date
Tobias Hunger
eb2f49c398 CMake: Fix race/crash on project open
When the filesystem scan takes longer than the cmake parsing, then
resetData() was called on BuildDirManager by the CMakeBuildConfiguration
before the CMakeProject had requested its data.

Move some code back into CMakeProject to resolve this issue.

Change-Id: Ib21bdd63fdca79c2ad39a7e060df438b456700b4
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 13:08:11 +00:00
Tobias Hunger
200b04f9ca CMake: Simplify setting up a new reader
There is no need to reset a reader when e.g. the build directory changes
when the server-mode reader is *not* used. So the one case where having
separate reparse-options for the case where the reader changes and the
case where it stays the same is bogus.

So unify the flags into one set and simplify the code accordingly.

Change-Id: I9bcfcc6333d574d49513ef1256a9a8597bda4ec7
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 12:43:14 +00:00
Tobias Hunger
87f496d091 CMake: More logging of cmake parsing flags
Add more logging of cmake parsing flags as cmake runs are requested
in the plugin.

Change-Id: I5231bd29dfeb6521218dc28c26a5b658ccb4059b
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 11:52:26 +00:00
hjk
c6f00e1dd2 Unification of desktop run configurations, step 6
Move special CMake environment modification to CMakeBuildConfiguration.

Change-Id: I27f886db48d8c036f2f77f5ae8f239b405cb5721
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-08 15:20:21 +00:00
Tobias Hunger
70b8fa352a CMake: Remove legacy code from before version 3.7
Change-Id: I8f8c0136548230e755a939d8c1bdfa78f5a644bc
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-06 12:48:27 +00:00
Tobias Hunger
ac091622e4 CMake: Move code from CMakeProject into CMakeBuildConfiguration
Move code closer to the BuildDirManager that was moved into the
CMakeBuildConfiguration.

Change-Id: I21d7188e4a3b03a02b12b01c7dd3e46754d653f8
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:49:06 +00:00
Tobias Hunger
338a7184a5 CMake: Move builddirmanager into CMakeBuildConfiguration
Change-Id: I1854b6021e7d573abd4ac9d64c8d5dbd0618ed71
Reviewed-by: hjk <hjk@qt.io>
2019-08-05 15:48:57 +00:00
Tobias Hunger
8c34d653be CMake: Fix WS
Change-Id: I2558ae2f69c67a039aea96200878b056ed391ed7
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-08-05 15:44:08 +00:00
hjk
5dbfd46bcf ProjectExplorer: Merge BuildConfigurationFactory::availableBuilds
... and availableSetups as far as mechanically possible.

Change-Id: Ia1d7babe943eea25da97cef7838187c234378673
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-27 14:19:53 +00:00
hjk
f94e55b807 ProjectExplorer: Align signatures of BuildConfiguration
... availableBuilds() and availableSetups().

Goal is to merge them and inline all the local createBuildInfo()
functions.

Change-Id: I9f19093163808b6da6dc83977894420e08a1edd9
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-27 13:59:39 +00:00
hjk
e7c6169d70 ProjectExplorer etc: More FilePath usage
Mostly for project files.

Change-Id: Icb6059f80758865e42cc9f9c092ec6782770dfd7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-26 16:02:23 +00:00
hjk
f878486fcb Use build step ids for construction in more cases
Change-Id: If2deb7c02c082e29cc6b1f0408c0d0e06d1c584b
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-06-26 15:00:30 +00:00
Tobias Hunger
5bcd59c94f CMake: Simplify buildkey generation
Just use the target name as buildkey. This is unique in cmake projects, so
there is no need to mangle the source directory into the whole thing.

This is a problem since different readers might report different source
directories. That will then result in RunConfigurations getting duplicated
after switching the reader types.

Task-number: QTCREATORBUG-22129
Change-Id: I849ab68f221d732341e98faa9a4e757d3a495b2a
Reviewed-by: hjk <hjk@qt.io>
2019-06-20 14:41:04 +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
0e4df97f90 Some more FileName::appendPath -> pathAppended() changes
Change-Id: Ia05b54f157b08353d5a9efccee48dfc212d3a489
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-05-15 13:19:58 +00: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
ce449e4219 ProjectExplorer: Remove BuildTargetInfoList wrapper class
Change-Id: I1a2ae06ec8c5b7278abca2386834d7edd31597d7
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-05-14 13:30:34 +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
Christian Kandeler
fc4e202821 CMakeProjectManager: Fix deployment data setup
In 73b1a765f3, we did not consider that the order of the code mattered,
so we overwrote user-provided deployment information with guessed
locations.

Fixes: QTCREATORBUG-22184
Change-Id: Ied3a7436829e8b857c32e9364508a33414927c99
Reviewed-by: hjk <hjk@qt.io>
2019-04-24 11:56:13 +00:00
Christian Kandeler
261d7752b0 RemoteLinux: Retrieve deployment info from local install root
This provides correct deployment information as seen by the build system
when Qt Creator cannot retrieve it directly.
It's most useful for autotools and cmake projects, but can also help
with qmake in certain edge cases.

[ChangeLog] It is no longer necessary to provide a
QtCreatorDeployment.txt file when using CMake projects with remote Linux
devices.

Fixes: QTCREATORBUG-21855
Change-Id: I27e07a45dd1565e489f4b573cc3fff8191c57d9b
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-04-23 15:52:05 +00:00
BogDan Vatra
26463a2219 Say hello to Android CMake support
Requirements:
 - NDKr19 or newer
 - Qt 5.12.1 or newer

QtCreator supports the following variables:
 - ANDROID_PACKAGE_SOURCE_DIR
 - ANDROID_EXTRA_LIBS

Be aware, that there is a lot of magic done on QtCreator side, and you
can't use only cmake to build an Android APK.

[ChangeLog][Android][CMake] Add Android support for CMake projects.

Change-Id: I1d351976ed56f424c2bc972f4ff7b5968147a2ed
Reviewed-by: hjk <hjk@qt.io>
2019-03-06 14:47:27 +00:00
Cristian Adam
f45da77738 CMake: Remove the "Default" built type from the list of build types
Fixes: QTCREATORBUG-22013
Change-Id: I578078b4e2e1fee89e8b7d1f619eda742d43bf60
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-27 13:03:23 +00:00
Christian Kandeler
83dd031960 ProjectExplorer: Rename KitInformation to KitAspect
The name "KitInformation" does not properly convey the fact that it
represents a certain *aspect* of a kit. The same goes for
"KitConfigWidget", which in addition was inconsistent with
"KitInformation".
We now use "KitAspect" and "KitAspectWidget".

Change-Id: I9804ee4cedc4d61fad533ea1dd4e4720e67fde97
Reviewed-by: hjk <hjk@qt.io>
2019-02-11 11:55:01 +00:00
hjk
54437cafc6 CMakeBuildConfiguration: Remove some casts
Not needed anymore.

Change-Id: I7cc6ad8af7e0598a66bd5e87c3a51288eb5f0d80
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-31 14:00:42 +00:00
hjk
9bb936499d ProjectExplorer: Collapse BuildInfo hierarchy
... to pass it around as real values, avoiding, among others,
the need of occasional explicit deletion.

The formerly extra members of the derived stuff are handled via
an extra variant (for data) and via a functor in the build
configuration factory.

The change is mechanical.

Change-Id: I19ca4e0c5f0a5b196fc16dfb98bb005dc679f855
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-30 16:51:05 +00:00
Ivan Donchevskii
ce0b671d0a ProjectExplorer: Fix Clang toolchain setup on Windows
Clang toolchain in gcc mode requires mingw sysroot and target
in order to be used properly on Windows.
Requires Qt >= 5.12 to work properly (it has the required mkspec).

Change-Id: I4e5a734c699ac98740c0d50560aa7b69751ae58c
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-01-21 11:51:30 +00:00
hjk
ce43f6fbb4 Cmake: Move some code from project to build configuration
Less use of activeBuildConfiguration and activeTarget.

Change-Id: I9fa77a0084c5701e86530e4f9845c47baddaed4e
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-09 12:08:05 +00:00
Alessandro Portale
17f169c291 CMakeProjectManager: Modernize
modernize-use-auto
modernize-use-nullptr
modernize-use-override
modernize-use-using

Change-Id: I6a272bc3b75835840b3d6cbe83be6f50f94bbedb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
2018-11-25 07:50:15 +00:00
Cristian Adam
b8c5f918bd CMake: Do not generate build directories with spaces
Fixes: QTCREATORBUG-18442
Change-Id: I35aea2322801086d1ae11d123f53973dff7847be
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-10-29 14:14:50 +00:00
Tobias Hunger
a43331ba67 Move "builddirectory" template from Core to ProjectExplorer
Move Core::DocumentManager::buildDirectory to
ProjectExplorerPlugin::buildDirectoryTemplate.

Move the setter along.

Change-Id: I3f1739723e800d04d2934149369b8881208305b4
Reviewed-by: hjk <hjk@qt.io>
2018-10-10 08:31:16 +00:00
hjk
ce20bde99c ProjectExplorer: Pass id directly to BuildConfigurations
It's what the base class wants, and follows run and deploy precedence.

Change-Id: I26eff43337851702417e7e4284fc390b904060f6
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-05-08 08:13:00 +00:00
hjk
a0753d7c34 ProjectExplorer: Simplify BuildManager::buildList() calls
The build list names are always the ones determined from the
build list id. No need to do that on the caller side.

Change-Id: Icc21ef355de535af21215819fe04daa76fed0d9c
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2018-01-11 10:49:56 +00:00
hjk
53a151074a ProjectExplorer/all: Re-organize BuildSteps/{Deploy,Build}Config setup
This follow the rough pattern of recent *RunConfigurationFactory changes
for build and deploy configurations.

- Collapse the two lines of constructors similar to what
  890c1906e6 did for RunConfigurations
  * Deploy* was purely mechanical
  * Build* ctors are split in connects() in the ctor body
    to create "empty shell for clone" etc
    and build step additions in initialize() functions which
    are only used in the create() case.
  -- Allows to collapse the shared 'ctor()' functions, too.

- Move FooBuildConfigurationFactory::create() implementations
  to FooBuildConfiguration() constructor. That was a strange
  and unneeded ping-pong between factories and objects, and
  furthermore allows one level less of indirection (and for a
  later, left out here, some reduction of the
  FooBuildConfiguration interfaces that were only used to
  accommodate the *Factory::create() functions.

- Most {Build,Deploy}Configuration{,Factory} classes had a canHandle(),
  but there wasn't one in the base classses. Have one there.

- Most canHandle() functions were checking simple restrictions on
  e.g. project or target types, specify those by setters in the
  constructors instead and check them in the base canHandle()

- clone() is generally replaced by a creation of a "shell object"
  and a fromMap(source->toMap()), implemented in the base, there
  are two cases left for Android and Qbs that needed(?) some extra
  polish

- generally use canHandle() in base implementation, instead
  of doing that in all Derived::canFoo()

- as a result, canCreate/create/canClone/clone reimplementations
  are not needed anymore, keep the base implementation for
  now (could be inlined into their only users later), but
  de-virtualize them.

- Combine Ios{Preset,DSym}BuildStepFactory. There was only one
  'dsym' build step they could create.

- Split the 'mangled' id into the ProjectConfiguration subtype
  specific constant identifier, and a QString extraId() bit.
  Only maintain the mangled id in saved settings.

- Make ProjectConfiguration::m_id a constant member, adapt
  all constructors of derived classe.

Not done in this patch:

- Finish possible cosmetic changes on top

- Add a way to specify restrictions to supported Qt versions
  (used in Android/Ios), as the base implementation does not
  depend on the qtsupport plugin

- Combine the QList<X> availableFoo() + createFoo(X) function
  pairs to somthing like a direct
   QList<struct { X; std::function<X()>; }> fooCreators()
  to avoid e.g. the baseId.withSuffix() <-> id.suffixAfter(base)
  pingpong

- Remove the *Factories from the global object pool

- Do something about priority(). Falling back to plain
  qmake in android+qmake setup is not helpful.

Change-Id: I2be7d88d554c5aa8b7db8edf5b93278e1ae0112a
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-12-08 11:17:55 +00:00
Tobias Hunger
b1157e4e63 CMake: Allow to unset configuration values
Change-Id: I649323e3c2cc51ea69dd7e216f30eeb653f3873b
Reviewed-by: hjk <hjk@qt.io>
2017-10-17 08:21:07 +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
Tobias Hunger
7c94750d70 CMake: Modernize CMakeBuildConfiguration
Change-Id: Ie09ae7b765d6c2f72eb62b9db2937fbd68e232f5
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-04 09:53:03 +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
Ulf Hermann
47886969cc Drop unused variables and lambda captures
Also, add context to connect() expressions where we are or were
capturing "this".

Change-Id: I6e006ba6f83d532478018550d148ee93eca59605
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2017-09-08 09:06:53 +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
Claus Steuer
9916c0a759 CMake: Do not check for changes if config was changed by the user
When the cmake configuration changes, BuildDirManager checks whether
the new configuration differs from the current configuration.
In case of differences a dialog is opened and the user must decide if
the changes shall be applied or rejected.
When the user changes the cmake configuration in the projects page the
dialog will open as well. This is unencessary since the user already
decided to apply the changes.

Let BuildDirManager not check for changes if the configuration was
changed by the user via the projects page.

Change-Id: I736ee7f4dee99fe707f2931c73b287231b1daa1d
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-19 04:30:51 +00:00
Tobias Hunger
64c5f960e8 CMake: Return an empty project tree if parsing failed
This triggers the logic in Project to show the top level project
file in the project tree.

Remove similar logic in CMake.

Change-Id: I2bfdd3f5e3d4126910a3feb480cec5ef689954ed
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
2017-06-23 09:56:07 +00:00
Tobias Hunger
7e81d330d9 CMake: Hide INTERNAL and STATIC configuration entries in Project UI
Task-number: QTCREATORBUG-18403
Change-Id: I6b69305ff0dc337da1d8b20e0321be5ce1b1f595
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-06-20 12:03:15 +00:00
Tobias Hunger
11c87bd918 CMake: Unify setup of default build target in CMakeBuildStep
Change-Id: I3d087356a4dd5a3b8ab07d5b64cd5aeb93ae0f47
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-27 09:51:16 +00:00
Tobias Hunger
7a388e7b4b CMake: Improve emission of enabledChanged signals of build configurations
Change-Id: I542b93512466727ac4ee66a8ca41e503106ebdcb
Reviewed-by: Orgad Shaneh <orgads@gmail.com>
Reviewed-by: hjk <hjk@qt.io>
2017-04-25 09:20:16 +00:00
Tobias Hunger
598100c765 CMake: Do not try to update project data when an error occurred
Do not try to update project data when an error occurred in server-mode.

Change-Id: I6a1cf4b6e79fd6ddf5329195861f34cd7f1ca44d
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2017-04-11 14:46:14 +00:00
Tobias Hunger
6e91fe5046 CMake: Use a CMakeProjectNode as top level cmake node
Change-Id: I6e68b971cf490b9b064a2866bd99865a7f4a7bd9
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-15 10:23:09 +00:00
Tobias Hunger
b8417e0f0c CMake: Fix projects with complex CMakeLists.txt layouts
This fixes soft assserts in e.g. Musescore.

Change-Id: I860c8c184161e53918fb901d66b89cffb0c09e23
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-15 10:22:24 +00:00
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
hjk
3f5caf4cdc Utils: Wrap MimeDatabase into static functions
To avoid repeating the 'MimeDatabase mdb; mdb.something(); ' mantra
all over the place.

Change-Id: I4bfef62e73275a991455141671d6071162788e9d
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-03-03 07:57:54 +00:00