Commit Graph

137 Commits

Author SHA1 Message Date
Tobias Hunger
a8b96a8240 CMake: More logging of parsing starting/stopped
Change-Id: I52dad9260c21e03add513f7229148635ae76236a
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-12-10 09:16:22 +00:00
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
Tobias Hunger
196b0da08a CMake: Write creators settings into build directory
Write a file qtcsettings.cmake into the build directory. This
file contains all applicable CMake configuration settings that
creator wants to set.

Use "cmake -C qtcsettings.cmake .." to reconfigure on the command
line to make use of this file.

Change-Id: I4a69d082c50bb66e60b4eec1b3155df53e00734d
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-10-18 14:11:13 +00:00
Tobias Hunger
28e4ed61af CMake: Polish configuration check dialog
Polish "CMakeCache.txt is different from Project" dialog based on suggestions
by Cornelis Bockemühlmade on the Qt Creator mailing list.

Task-number: QTCREATORBUG-17555
Change-Id: I22e616bfef1ffd79590a93335a5e34364e1a4f3f
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
2019-10-10 10:06:54 +00:00
Tobias Hunger
4d2211aa46 CMake: Make BuildDirManager a bit more robust
Handle error situations better.

Change-Id: I1376e2ef72f6e599779a0bf692e2c0dfee85724b
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-10-10 08:13:28 +00:00
Tobias Hunger
fc4459a585 CMake: Do not clear the reader needlessly
If the reader is not of the expected type or incompatible with
the new parameters, then it will get changed anyway. So do not
force a reset of the reader.

Change-Id: I5ab8770797d39488e6a530e93431e344b1c7f7e6
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-10-10 08:13:08 +00:00
Tobias Hunger
3dcf14ea3f CMake: Wire up the readers only once
They can not get disconnected anymore, so just wire them up once.

Change-Id: I46af563e6aebe7bee00c813648bcbfab9967e766
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-08 14:20:34 +00:00
Tobias Hunger
7f2f112a24 CMake: Add some more categorized logging
Change-Id: I150c63853025539563ef2245e0336e95fda3fdca
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-10-08 14:20:18 +00:00
hjk
4a55d995e1 Cmake: Replace connect/disconnect of builddirmanager
... by a permanent connection, and only evaluate output for the
active build configuration.

Task-number: QTCREATORBUG-21235
Change-Id: I06f87f7ea680f8f25687a0c5ffc936c801ab7de0
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-09-16 13:06:10 +00:00
Eike Ziller
9cc45fe1fb CppTools: Move RawProjectPart to ProjectExplorer
Doesn't have any dependencies into CppTools anymore, therefore moving it
reduces the dependencies of the project managers to CppTools as well.

Change-Id: Ibe728abe59eb88a8877943dca1f48a85163e27ac
Reviewed-by: hjk <hjk@qt.io>
2019-09-11 06:22:12 +00:00
Tobias Hunger
b7e4046a17 ProjectExplorer: Add BuildSystem class
Add a class to abstract out the BuildSystem from the Project.

Thie idea is to make a Project have-a BuildSystem, so that
it can stop being one.

The Projects in the different ProjectManagers will get much
simpler that way (and many will only consist of a constructor
with some setter calls) and handles all the interactions
between the rest of Qt Creator and the project.

The complex code to interact with the build systems is then
separate from that.

Change-Id: I3bbb000bb1aed91f0b547ac493f743ede8afb8cd
Reviewed-by: Christian Kandeler <christian.kandeler@qt.io>
2019-08-29 07:28:04 +00:00
Tobias Hunger
b8be7da158 CMake: Simplify based on Project::projectFileIsDirty signal
Delegate all the necessary file watching to Project and connect
to the relevant signal.

Server-mode insists on watching files itself, so that may not
report extra project files.

Change-Id: If821c54a7b0f8b72beed53dd1c83f255973faf3e
Reviewed-by: hjk <hjk@qt.io>
2019-08-16 12:43:39 +00:00
Tobias Hunger
8868989d5c CMake: Fix CMakeCache.txt file detection
QFileInfo::exists(QString) is a static method, so the code was
looking for "CMakeCache.txt":-/

Change-Id: Ib0f9711a159fca9437ffb15c26af246ec69489ca
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-08-09 12:43:23 +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
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
f9c246b26e CMake: Request filesystem scan when cmake files change
The typical use case is to add header/source file and then update
the CMakeLists.txt file to add the source.

Request a filesystem scan when a cmakefile changes to pick up the
header file when the source file is added.

Task-number: QTCREATORBUG-22674
Change-Id: Ifbb1ba37dd46967215f51db2c6ad92af669df585
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:38:04 +00:00
Tobias Hunger
16fe5fe109 CMake: Simplify reparsing logic
Do not overload the "new reader" logic with the logic for "no CMakeCache.txt"
file.

This makes it a bit simpler to reason about the different conditions when the
options are applied.

Note that "no CMakeCache.txt" is handled later anyway by adding the
"REPARSE_FORCE_CMAKE_RUN" flag.

Change-Id: Icc9455152053911cc839a19c76d3c0e44fc76fcf
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-30 15:37:53 +00:00
Tobias Hunger
4aee38e04c CMake: Extract and show more CMake location information for targets
Report more cmake file locations that are relevant to a target in
the "Open..." menu entry in the target's context menu.

This information is extracted from the backtrace information that
is provided by fileapi.

Change-Id: I01659a6cc7254cd0ef6b533a0785d2f15d31c3c6
Reviewed-by: Alexandru Croitor <alexandru.croitor@qt.io>
Reviewed-by: hjk <hjk@qt.io>
2019-07-29 08:46:53 +00:00
Tobias Hunger
69b3d90683 CMake: Remember file location of CMake target definitions
Make fileapi remember where CMake targets were defined in the
CMakeBuildTarget struct. The other readers will just guess at
the location based on the source directory of the target.

Change-Id: Ia8fa226c548800992ccea64b1d5981d2f3013408
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-07-24 14:57:47 +00:00
Tobias Hunger
700c88418c CMake: Fix inverted logic bug
This was introduced by d5383c92a8

Change-Id: I88736c14d4dc811b2b375ee2a9b97d3114524d01
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
2019-07-22 11:52:29 +00:00
Tobias Hunger
a95eb53d3b CMake: Add initial fileapireader class
Change-Id: I620cba7cc1c2a5ac56789fa9770dce573c6b19cd
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-20 12:25:36 +00:00
Tobias Hunger
65658f411b CMake: Unify error reporting for builddirmanager's information retrieval
Use a dedicated errrorMessage out parameter for error reporting in
the builddirmanager methods related to information retrieval. Those are
called after the parsing has finished.

This frees the errrorOccured signal of the builddirmanager to be used only
when the parsing itself has failed.

Change-Id: Ieefc32c0386769479177a6bd4bc4a0e77df5db7b
Reviewed-by: Cristian Adam <cristian.adam@qt.io>
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-13 12:36:44 +00:00
Tobias Hunger
202506ce16 CMake: Make sure to run cmake when that is requested
Pass on the request to run cmake on to the builddirreaders.

Task-number: QTCREATORBUG-19704
Change-Id: Iafeba61f46d6bb6783fc62d0504bb07dde2c4612
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-06-12 13:48:07 +00:00
Tobias Hunger
d5383c92a8 CMake: Run cmake with all arguments when no CMakeCache.txt file is found
Always run cmake with all arguments when no CMakeCache.txt file is
found. This allows for the builddirreaders to become a bit simpler.

Change-Id: I67839fd560fb77f6832b1cefc3ff016baa6bae89
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2019-06-12 11:55:47 +00:00
Tobias Hunger
08d905ae3d CMake: Store pointer to CMakeProject in BuildDirManager
Use this back-pointer to validate the buildconfiguration.

Use the validated buildconfiguration consistently. In theory
the buildconfiguration is valid at all times (since deleting
a buildconfiguration will trigger an update to the parameters
in BuildDirManager), but better be safe.

Change-Id: I614d9ce16e4974a9437a2f44756f01c71a5ede13
Reviewed-by: hjk <hjk@qt.io>
2019-06-07 11:07:16 +00:00
Tobias Hunger
c961d9fc9e CMake: Make all readers use isReadyNow() signal
The tealeafreader used to not ever use this signal and used
the isReady() method to short-circuit the whole mechanism.

Change-Id: I2f7caedeedf977c70a5d7807e3a92775757a6fef
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-06-07 11:01:26 +00:00
Tobias Hunger
9e50d47b5c CMake: Use unique_ptr to manage builddirreader
Change-Id: I1acac29bdfa4dfaaf79835636c3e3a4484e8183c
Reviewed-by: Alessandro Portale <alessandro.portale@qt.io>
2019-06-06 14:34:18 +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
Cristian Adam
48d2fd6ded CMake: Clear up confusion in "Configuration has changed" message box
Fixes: QTCREATORBUG-22059
Change-Id: I74642993f9171f8777901ba85c36d3e6cce7d739
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-02-27 16:10:05 +00:00
Bernhard Beschow
693e2649a4 CMakeProject: Prefer assignment to out parameter
Also change method names from update...() to create...() and mark as
const. This communicates that the objects the methods are called on are
neither altered nor updated.

Change-Id: I29e84dc398ded3ffcbf90741227362c6b4be2bf9
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2019-01-27 12:13:45 +00:00
Eike Ziller
c8c6b28e22 Merge remote-tracking branch 'origin/4.7'
Conflicts:
	src/plugins/qmlprojectmanager/qmlprojectrunconfiguration.h

Change-Id: I192b9e88f967182f3275b4b98abed1220c26daac
2018-05-28 16:10:23 +02:00
Tobias Hunger
88b065db3f CMake: Do not crash when deleting cmake tools
Do not crash when the cmake tool that was used to parse the project
gets removed.

Change-Id: Ieda3ae2025dbcfb1f90d9bd01c5f0ed960756c6a
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-28 12:36:33 +00:00
Tobias Hunger
fdccc54275 server-mode: Always try to read CMakeCache, even after error
Change-Id: Ib3d4fb5ac14340a7f706e4a1d8a0cbdc420d01d1
Reviewed-by: Ulf Hermann <ulf.hermann@qt.io>
2018-05-22 15:21:54 +00:00
Tobias Hunger
10005e35b9 CMake: Report an error when project can not get parsed
Report an error when a project can not get parsed.

Change-Id: I659a5ffb465b4a2de39910b05e7eef2481b9ad70
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
2018-05-18 09:11:30 +00:00
Tobias Hunger
4acb16272d CMake: Enable switching between different temporary CMake configurations
This got broken when moving the BuildDirManager from the BuildConfiguration
into the Project itself.

As a side-effect this patch also fixes the persisting of cmake state.

Task-number: QTCREATORBUG-19075
Change-Id: I1fc696097b09f5285e67f20885eb1fa27504990b
Reviewed-by: hjk <hjk@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:13:42 +00:00
Tobias Hunger
3f73f3a4f4 CMake: Fix "CMake settings have changed on disk"
* Improve the UI by showing settings in CMake and the project
* Fix setting CMake configuration to project

Change-Id: I6e127344551fa00f3f7e6170465cb3dda2e4a634
Task-number: QTCREATORBUG-17555
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-10-24 11:10:30 +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
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
Tobias Hunger
8fb3105e25 CMake: Add option to auto-create build directories
Add an option to CMakeTools to force auto-creation of build directories.
This does lead to cmake cluttering up the file system with directories, but
does not force users to go through the oftentimes long configuration process
twice (once in a temporary directory and once in the real location).

Task-number: QTCREATORBUG-16794
Change-Id: I68d92fc58638ad0a0a7622b7ef1621e055c9f2a7
Reviewed-by: Leena Miettinen <riitta-leena.miettinen@qt.io>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-09-20 12:39:18 +00:00
Claus Steuer
d105ac8255 CMake: Fix "CMake configuration changed on disk" dialog
The dialog is shown when the cmake configuration changes.
The user can either apply the changes or reject them. To determine the
decision of the user the return value of the dialog is evaluated.
This is wrong because the dialog uses custom buttons (see documentation
of QMessageBox::exec). As a consequence the configuration is never
applied.

Use QMessageBox::clickedButton to determine the user decision.
Additionally change the role of the apply button from AcceptRole to
ApplyRole as this better matches its intention.

Change-Id: I1d2d1fb7186dcc8d789c192c51bb34111eb84ee5
Task-number: QTCREATORBUG-18292
Reviewed-by: Tobias Hunger <tobias.hunger@qt.io>
2017-07-19 04:31:02 +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
8ede32677e CMake: Fix logic for target filtering
Broken by e42f3db9f0 from today:-/ Sorry.

Change-Id: I4803039939de5aae893a701e2bd6399d3fbfae1f
Reviewed-by: Florian Apolloner <florian@apolloner.eu>
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-21 13:59:17 +00:00
Tobias Hunger
e42f3db9f0 CMake: Avoid duplicate build targets
Make sure that build targets that get added explicitly are never reported
by any of the readers, too. This makes sure entries will not show up twice
in the UI.

Task-number: QTCREATORBUG-18409
Change-Id: Id5039add262211fd87cd5c2884df2af0fcf24577
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-06-20 13:39:40 +00:00
Tobias Hunger
460e1d7e93 CMake: Add "test" target to cmake builds
Always show a test target for cmake projects. This will show even
if there are no tests in the project. But I think it is more annoying
*not* to be able to run tests via the locator when tests are available
than getting an error message when attempting that with a project that
does not have tests.

Task-number: QTCREATORBUG-18323
Change-Id: Iba85aa868cb9bfe6c3f44a7ffff620d081d3082f
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
Reviewed-by: Eike Ziller <eike.ziller@qt.io>
2017-06-13 12:47:44 +00:00
Tobias Hunger
d8d2dc6adb CMake: Report special utility targets in BuildDirManager::buildTargets
Report special utility targets like "all", "clean" and "install" from
the BuildDirManager and update UI accordingly.

Change-Id: I01d0dcfa23d5bddc124c8f9ee1040475184c9c1e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-04-27 09:51:01 +00:00
Tobias Hunger
3a20cec60a CMake: Break loop in error handling
Block access to the BuildDirManager while one of its errors is
processed. This prevents more errors being raised as part of
error handling, which can trigger a loop.

Task-number: QTCREATORBUG-17869
Change-Id: Ic6f8d9a3c3b4e63f27260c40f27ab09d20b62b3e
Reviewed-by: Tim Jenssen <tim.jenssen@qt.io>
2017-03-27 11:53:43 +00:00