-
Notifications
You must be signed in to change notification settings - Fork 207
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Improve CMake build option handling and API #1046
base: main
Are you sure you want to change the base?
Conversation
Hi @jonahgraham , WRT our discussion on the yaml file yesterday, as far as I can tell the org.eclipse.cdt.cmake.core.internal.CMakePropertiesController.save(ICMakeProperties) method is never called by CDT code, which means the yaml file will not exist for regular (non-ISV extended) CDT products. You'll see that I've added an API for setting the cmake generator. |
Test Results 600 files - 35 600 suites - 35 13m 25s ⏱️ - 22m 25s Results for commit a023407. ± Comparison against base commit 11dfaa4. This pull request removes 1220 and adds 9 tests. Note that renamed tests count towards both.
♻️ This comment has been updated with latest results. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
WRT our discussion on the yaml file yesterday, as far as I can tell the org.eclipse.cdt.cmake.core.internal.CMakePropertiesController.save(ICMakeProperties) method is never called by CDT code, which means the yaml file will not exist for regular (non-ISV extended) CDT products.
Let me know if you think I should still consider the yaml file questions for an ISV modified CDT product.
I don't think you need to consider the yaml file - thank you for pointing out that save
was never called. I guess this was incomplete work once upon a time.
I guess that you will start calling save now though (in a subsequent commit)? Perhaps after migrating from yaml to something else?
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hi @jonahgraham ,
thanks for taking the time to review this.
I like all your suggestions here and think the structure is better the way you have suggested.
However, it removes a key requirement. Each time the build is performed with this patch, it uses the default values. If the user changes the generator value in the UI, that change is ignored. Hence the need for the CMAKE_PROPERTIES_INITIALSED.
I'm struggling to come up with a better way of doing things at the moment, so if you have any ideas I'd be grateful of them please.
Maybe using CMakePropertiesController.save(ICMakeProperties) will help with the issue I mentioned in my previous comment about CMAKE_PROPERTIES_INITIALSED. But as well as saving the props, I'd need to do some other stuff in the load, like: setProperty(CMAKE_GENERATOR, getPlatformOsOverrides(properties).getGenerator().getCMakeName()); |
@betamaxbandit I think if the load/save are matched then the problem is resolved - right now it seems a bit mismatched between the incomplete yaml and the launch config properties. Can we get it down to only one place that user information is stored? |
c8d0797
to
9ec634a
Compare
Hi @jonahgraham , I have implemented all your suggestions AFAIK. These are some notes about the status of this PS. Sorry it's taking so long to do this, but I'm facing a number of issues with this. I wonder if it would be easier to split into smaller tickets?
Q) Should run and debug launch configurations share the same or different names? Q) Why does the CMakeBuildTab use properties and not LC attrs to save values?
|
@betamaxbandit let's have a chat about this in a call and then we'll record any outcomes here. |
Hi @jonahgraham and @betamaxbandit , This issue was raised first in the discussion in #814 Then my conclusion was that CMakePropertiesController could be deprecated, but I restored it, because it would break usage by betamaxbandit. The Core Build System Build Settings tab stores values in the preferences and not in the Launch Configuration, because then it can store different CMake arguments for Run and Debug. In Managed Build projects you can also set different Make arguments for the Run and the Debug build configuration. I think this is a good feature. When you change launch mode you keep seeing the same launch configuration. This is always. The tabs change, but it is all stored in the same .launch file. CMakePropertiesController made no difference for launch mode. |
CBS projects still have separate build configurations for Run and Debug like MBS projects, only they are hidden for the user. Instead of explicitly setting an active build configuration in MBS projects, the build configuration is implicitly selected by changing the launch mode in CBS projects. Build configurations store their settings in the preferences. The methods are there. I see no reason to do it differently. CMake settings are build settings, not launch settings. I think we should not make separate launch configurations for different build settings. Same is true for Make settings in the CBS Makefile projects. We don't need the YAML file. We can use the preferences. The infrastructure is there. |
9ec634a
to
50f36a3
Compare
Hi @ewaterlander ,
I'll update that when I complete this change. I'm not planning changing the way the build settings are stored. I was just thinking aloud. I plan to deprecate CMakePropertiesController. Cheers John |
Hi @jonahgraham , |
@betamaxbandit , @Kummallinen and I had a meeting/review on this today. In short this is progressing in the correct direction. Along with the review, a part of the outcome of this review is we decided having a fully fleshed out example of an ISV CMake customized project is a useful to both demonstrate for other ISVs and to ensure that the API we create has a workable use case. I have provided that in #1052 |
50f36a3
to
ac04d3b
Compare
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
...clipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/internal/CMakePropertiesController.java
Outdated
Show resolved
Hide resolved
...pse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/properties/ICMakePropertiesController.java
Outdated
Show resolved
Hide resolved
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Show resolved
Hide resolved
ac04d3b
to
6a77bf8
Compare
...pse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/ExtendedCMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
cmake/org.eclipse.cdt.cmake.core/src/org/eclipse/cdt/cmake/core/CMakeBuildConfiguration.java
Outdated
Show resolved
Hide resolved
...clipse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/CMakeBuildConfigurationTests.java
Outdated
Show resolved
Hide resolved
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The TODO in the example project needs to be completed as well. I have merged the required commits.
TODO:
Line 37 in 5e62200
// TODO: Here goes the example extending that is being developed in #1046 https://github.com/eclipse-cdt/cdt/pull/1046 |
6a77bf8
to
afb8c41
Compare
@jonahgraham jonahgraham force-pushed the IDE-82683-REQ-012 branch from 6a77bf8 to afb8c41 ^^^ was rebase onto main. |
c1f0857
to
1218066
Compare
As discussed on a call today between @betamaxbandit, @Kummallinen and myself we have decided to remove the incomplete work related to IOsOverrides. This code was worked on to support use cases like building in docker containers and automatically switching cmake commands, but that work was never completed. For now that extra API is a lot of overhead in complication. Therefore I have removed it as a new commit on this PR, it will be squashed later, but I have kept it as an independent commit so that @betamaxbandit can review what I have done. @betamaxbandit have a look at 1218066 (pull link) when you get a chance. |
As discussed on a call today between @betamaxbandit, @Kummallinen and myself I added some additional refactoring which I have again left as an extra commit (link to commit in pull request). Please see the commit message for a summary of all the changes. @betamaxbandit can you have a look. If this is all ok then I will squash the commits and update the description as this has grown to more than just the API change, but now includes the user visible changes that naturally flow out of the API changes. |
50cd03a
to
c1cdf82
Compare
a21e0f5
to
517ffab
Compare
Summary: - Add some new API to make it easier for ISVs to provide defaults. - Fully connect UI elements to CMake build process - Add some missing UI elements (such as customizing generator) - CMake generator default within CDT changed to Ninja Details: Add API to set CMake generator default (eg Ninja) ISV can set their desired CMake generator by overriding `CMakeBuildConfiguration.getDefaultProperties`. ISVs can also further fine tune the build process by overriding `CMakeBuildConfiguration.getDefaultProperties` Remove API `IOsOverrides` and related code. `IOsOverrides` was a partial implementation to achieve builds in Docker containers, however the work was not complete and it the extra code was complicating some basic use cases of setting defaults Add support for all generators to CMake build settings UI page by using a Combo instead of radio buttons. The non-deprecated generators that are built-in to CDT populate the Combo, but additional generators can be manually entered in the Combo. Rename clean command to clean target to better reflect its use as the argument passed to cmake's --target command line. Add all target for the argument passed to cmake's --target command line when doing a normal build. Clarify usage of UI overrides and change the UI to be "use defaults" (i.e. invert the checkbox). This is a **breaking** change as it means user projects that were using UI overrides will revert to using defaults. This is done on purpose as so many little things have changed in CMake settings, that reverting to defaults on upgrade seems like a logical decision. In addition *use defaults* matches the other GUIs in Eclipse, for example the MBS build command settings. Populate all defaults in getDefaultProperties() so that all CMake build settings are displayed as used (greyed out) and can be used as a starting point when editing settings. Simplify some of the code in CMakeBuildTab. Fix parsing of extra args so that quoted strings work. Refactored manual tests document and brought it up to date. Correct command line option for CMake's --warn-unused-vars Correct command line option for CMake's --warn-uninitialized Overall this is an API breaking change and the CHANGELOG-API.md has been updated with all the API changes in and around ICMakeProperties, including fixing typos in WarnUninitialized methods. Fixes eclipse-cdt#1055 Fixes eclipse-cdt#818 Part of eclipse-cdt#1000 Co-authored-by: John Moule <[email protected]> Co-authored-by: Jonah Graham <[email protected]>
517ffab
to
a023407
Compare
There have been many discussions about how to handle CMake preferences. I cross reference some of those key points here. AFAICT this PR now resolves all these questions in the generally agreed upon way. From #1046 (comment)
From #814 (comment)
From #818 (comment)
From #818 (comment)
|
@betamaxbandit I have done what I hope is the final cleanup and squash on this work. |
PS I updated the title and description in #1046 (comment) of the PR to reflect where the PR ended up. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
LGTM.
I like the move of constants into ICMakeBuildConfiguration interface
I tried your latest commit (a02340) on Windows 10 and all looks good.
Summary:
Details:
Add API to set CMake generator default (eg Ninja) ISV can set their desired CMake generator by overriding
CMakeBuildConfiguration.getDefaultProperties
. ISVs can also further fine tune the build process by overridingCMakeBuildConfiguration.getDefaultProperties
Remove API
IOsOverrides
and related code.IOsOverrides
was a partial implementation to achieve builds in Docker containers, however the work was not complete and it the extra code was complicating some basic use cases of setting defaultsAdd support for all generators to CMake build settings UI page by using a Combo instead of radio buttons. The non-deprecated generators that are built-in to CDT populate the Combo, but additional generators can be manually entered in the Combo.
Rename clean command to clean target to better reflect its use as the argument passed to cmake's --target command line.
Add all target for the argument passed to cmake's --target command line when doing a normal build.
Clarify usage of UI overrides and change the UI to be "use defaults" (i.e. invert the checkbox). This is a breaking change as it means user projects that were using UI overrides will revert to using defaults. This is done on purpose as so many little things have changed in CMake settings, that reverting to defaults on upgrade seems like a logical decision. In addition use defaults matches the other GUIs in Eclipse, for example the MBS build command settings.
Populate all defaults in getDefaultProperties() so that all CMake build settings are displayed as used (greyed out) and can be used as a starting point when editing settings.
Simplify some of the code in CMakeBuildTab.
Fix parsing of extra args so that quoted strings work.
Refactored manual tests document and brought it up to date.
Correct command line option for CMake's --warn-unused-vars
Correct command line option for CMake's --warn-uninitialized
Overall this is an API breaking change and the CHANGELOG-API.md has been updated with all the API changes in and around ICMakeProperties, including fixing typos in WarnUninitialized methods.
Fixes #1055
Fixes #818
Part of #1000