Skip to content

Commit 1218066

Browse files
committed
Remove 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 This is an API breaking change and the changelog has been updated with all the API changes in and around ICMakeProperties, including fixing typos in WarnUninitialized methods. This commit should be squashed into the parent commit, it is kept temporarily separate for review reasons.
1 parent afb8c41 commit 1218066

File tree

16 files changed

+178
-731
lines changed

16 files changed

+178
-731
lines changed

NewAndNoteworthy/CDT-12.0.md

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@ The minimum version of GLIBC required is now 2.31.
1212
This version can be found in Ubuntu 20.04 and later, RHEL 9.0 and later and other distros as well.
1313
CDT's native components will likely work with older versions of glibc too, assuming they provide the required APIs for Eclipse CDT.
1414

15+
# Core Build
16+
17+
## Default build system generator for CMake changed to Ninja on all platforms
18+
19+
The default for CMake's build system generator is now Ninja on all platforms.
20+
Users who want to use other build system generators can select their desired generator in the build settings.
21+
22+
TODO: Before release add the final screenshot for the build settings here. I am not including it now because the UI keeps changing.
23+
1524
# Managed Build
1625

1726
## New *C Project* and new *C++ Project* available via *New C/C++ Project* wizard

NewAndNoteworthy/CHANGELOG-API.md

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,20 @@ This section describes API removals that occurred in past releases, and upcoming
99
Below is the detailed descriptions of API changes and mitigation efforts API consumers need to take.
1010

1111
## API Changes in CDT 12.0.
12-
### org.eclipse.cdt.cmake.core.properties.ICMakePropertiesController removed
1312

14-
The interface ICMakePropertiesController provided load and save methods; only the load method was called in CDT and not the save method, because of a partially implemented feature.
13+
### org.eclipse.cdt.cmake.core.properties refactored
14+
15+
A significant simplification to the CMake build properties was completed, this included removing some API that was not used.
16+
The following classes have been removed or modified in API breaking ways:
17+
18+
- org.eclipse.cdt.cmake.core.properties.ICMakePropertiesController removed
19+
- org.eclipse.cdt.cmake.core.properties.IGeneralProperties removed
20+
- org.eclipse.cdt.cmake.core.properties.IOsOverrides removed
21+
- org.eclipse.cdt.cmake.core.properties.ICMakeProperties:
22+
- new methods added to compensate for removal of IOsOverrides
23+
- reset method removed
24+
- spelling corrected for methods with Uninitialized in the name
25+
1526

1627
## API Changes in CDT 11.5.
1728

cmake/org.eclipse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/CMakeBuildConfigurationTests.java

Lines changed: 27 additions & 95 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,12 @@
1717
import static org.mockito.Mockito.when;
1818

1919
import java.util.ArrayList;
20+
import java.util.HashMap;
2021
import java.util.List;
22+
import java.util.Map;
2123

2224
import org.eclipse.cdt.cmake.core.properties.CMakeGenerator;
2325
import org.eclipse.cdt.cmake.core.properties.ICMakeProperties;
24-
import org.eclipse.cdt.cmake.core.properties.IOsOverrides;
2526
import org.eclipse.cdt.core.CCProjectNature;
2627
import org.eclipse.cdt.core.CProjectNature;
2728
import org.eclipse.cdt.core.build.IToolChain;
@@ -57,86 +58,38 @@ public void setup() throws Exception {
5758
}
5859

5960
/**
60-
* Test for {@link IOsOverrides#setGenerator()}.
61+
* Test for {@link ICMakeProperties#setGenerator()}.
62+
*
63+
* This test also verifies that what the ISV overrides in getCMakeProperties is what takes effect.
6164
*/
6265
@Test
6366
public void getCMakePropertiesTestSetGenerator() throws Exception {
64-
CMakeBuildConfigurationExtended cmBuildConfig = new CMakeBuildConfigurationExtended(buildConfig,
65-
"cmBuildConfigName", mockToolchain) {
67+
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName",
68+
mockToolchain) {
6669

6770
@Override
6871
public ICMakeProperties getCMakeProperties() {
6972
ICMakeProperties properties = super.getCMakeProperties();
70-
71-
IOsOverrides windowsOverrides = properties.getWindowsOverrides();
72-
windowsOverrides.setGenerator(CMakeGenerator.NMakeMakefiles);
73-
IOsOverrides linuxOverrides = properties.getLinuxOverrides();
74-
linuxOverrides.setGenerator(CMakeGenerator.UnixMakefiles);
75-
return properties;
76-
}
77-
};
78-
79-
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties.
80-
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties();
81-
82-
// Get overrides for Windows host and check the default value for getGenerator.
83-
IOsOverrides windowsOverrides = cMakeProperties.getWindowsOverrides();
84-
CMakeGenerator winGenerator = windowsOverrides.getGenerator();
85-
assertThat(winGenerator, is(CMakeGenerator.NMakeMakefiles));
86-
87-
// Get overrides for Linux host and check the default value for getGenerator.
88-
IOsOverrides linuxOverrides = cMakeProperties.getLinuxOverrides();
89-
CMakeGenerator linuxGenerator = linuxOverrides.getGenerator();
90-
assertThat(linuxGenerator, is(CMakeGenerator.UnixMakefiles));
91-
}
92-
93-
/**
94-
* Test for {@link IOsOverrides#setDefaultGenerator()}. Also tests that {@link ICMakeProperties#reset(boolean)} works as expected.
95-
*/
96-
@Test
97-
public void getCMakePropertiesTestSetDefaultGenerator() throws Exception {
98-
CMakeBuildConfigurationExtended cmBuildConfig = new CMakeBuildConfigurationExtended(buildConfig,
99-
"cmBuildConfigName", mockToolchain) {
100-
101-
@Override
102-
public ICMakeProperties getCMakeProperties() {
103-
ICMakeProperties properties = super.getCMakeProperties();
104-
105-
IOsOverrides windowsOverrides = properties.getWindowsOverrides();
106-
windowsOverrides.setDefaultGenerator(CMakeGenerator.NMakeMakefiles);
107-
IOsOverrides linuxOverrides = properties.getLinuxOverrides();
108-
linuxOverrides.setDefaultGenerator(CMakeGenerator.UnixMakefiles);
109-
// reset(true) causes the CMake generator to be reset to it's default value.
110-
properties.reset(true);
73+
properties.setGenerator(CMakeGenerator.WatcomWMake);
11174
return properties;
11275
}
11376
};
11477

11578
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties.
11679
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties();
117-
118-
// Get overrides for Windows host and check the default value for getGenerator.
119-
IOsOverrides windowsOverrides = cMakeProperties.getWindowsOverrides();
120-
CMakeGenerator winGenerator = windowsOverrides.getGenerator();
121-
assertThat(winGenerator, is(CMakeGenerator.NMakeMakefiles));
122-
123-
// Get overrides for Linux host and check the default value for getGenerator.
124-
IOsOverrides linuxOverrides = cMakeProperties.getLinuxOverrides();
125-
CMakeGenerator linuxGenerator = linuxOverrides.getGenerator();
126-
assertThat(linuxGenerator, is(CMakeGenerator.UnixMakefiles));
80+
assertThat(cMakeProperties.getGenerator(), is(CMakeGenerator.WatcomWMake));
12781
}
12882

12983
/**
13084
* Test for {@link ICMakeProperties#setExtraArguments()}
131-
* This is a different extraArguments to IOsOverrides#setExtraArguments().
132-
* Presumably ICMakeProperties#setExtraArguments() are platform agnostic extra arguments, where as
133-
* IOsOverrides#setExtraArguments() can be set different for Linux and Windows.
85+
*
86+
* This test also verifies that what the ISV overrides in getCMakeProperties is what takes effect.
13487
*/
13588
@Test
13689
public void getCMakePropertiesTestSetExtraArguments() throws Exception {
13790
// Create a C Build Configuration using the default build config and an arbitrary name
138-
CMakeBuildConfigurationExtended cmBuildConfig = new CMakeBuildConfigurationExtended(buildConfig,
139-
"cmBuildConfigName", mockToolchain) {
91+
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName",
92+
mockToolchain) {
14093

14194
@Override
14295
public ICMakeProperties getCMakeProperties() {
@@ -153,46 +106,25 @@ public ICMakeProperties getCMakeProperties() {
153106
}
154107

155108
/**
156-
* Test for {@link IOsOverrides#setExtraArguments()}
109+
* Test for {@link CMakeBuildConfiguration#getDefaultProperties()}
157110
*/
158111
@Test
159-
public void getCMakePropertiesTestIOsOverridesSetExtraArguments() throws Exception {
112+
public void getDefaultProperties() throws Exception {
160113
// Create a C Build Configuration using the default build config and an arbitrary name
161-
CMakeBuildConfigurationExtended cmBuildConfig = new CMakeBuildConfigurationExtended(buildConfig,
162-
"cmBuildConfigName", mockToolchain);
114+
CMakeBuildConfiguration cmBuildConfig = new CMakeBuildConfiguration(buildConfig, "cmBuildConfigName",
115+
mockToolchain) {
116+
117+
@Override
118+
public Map<String, String> getDefaultProperties() {
119+
var defs = new HashMap<>(super.getDefaultProperties());
120+
defs.put(CMAKE_GENERATOR, CMakeGenerator.WatcomWMake.getCMakeName());
121+
defs.put(CMAKE_USE_UI_OVERRIDES, "true");
122+
return defs;
123+
}
124+
};
163125
// Call the new method on ICMakeBuildConfiguration to get the default CMake properties.
164126
ICMakeProperties cMakeProperties = cmBuildConfig.getCMakeProperties();
165-
166-
// Get overrides for Windows host and check the default value for getExtraArguments.
167-
IOsOverrides windowsOverrides = cMakeProperties.getWindowsOverrides();
168-
List<String> winExtraArguments = windowsOverrides.getExtraArguments();
169-
assertThat(winExtraArguments, contains("-Dtest0=0", "-Dtest1=1"));
170-
171-
// Get overrides for Linux host and check the default value for getExtraArguments.
172-
IOsOverrides linuxOverrides = cMakeProperties.getLinuxOverrides();
173-
List<String> linuxExtraArguments = linuxOverrides.getExtraArguments();
174-
assertThat(linuxExtraArguments, contains("-DLinuxtest0=0", "-DLinuxtest1=1"));
175-
}
176-
177-
private class CMakeBuildConfigurationExtended extends CMakeBuildConfiguration {
178-
179-
public CMakeBuildConfigurationExtended(IBuildConfiguration config, String name, IToolChain toolChain) {
180-
super(config, name, toolChain);
181-
}
182-
183-
@Override
184-
public ICMakeProperties getCMakeProperties() {
185-
// get the built-in CDT defaults
186-
ICMakeProperties properties = super.getCMakeProperties();
187-
188-
IOsOverrides windowsOverrides = properties.getWindowsOverrides();
189-
windowsOverrides.setExtraArguments(new ArrayList<>((List.of("-Dtest0=0", "-Dtest1=1"))));
190-
191-
IOsOverrides linuxOverrides = properties.getLinuxOverrides();
192-
linuxOverrides.setExtraArguments(new ArrayList<>((List.of("-DLinuxtest0=0", "-DLinuxtest1=1"))));
193-
194-
return properties;
195-
}
127+
assertThat(cMakeProperties.getGenerator(), is(CMakeGenerator.WatcomWMake));
196128
}
197129

198130
private IProject createCMakeProject() throws Exception {

cmake/org.eclipse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/ExtendedCMakeBuildConfiguration.java

Lines changed: 0 additions & 39 deletions
This file was deleted.

cmake/org.eclipse.cdt.cmake.core.tests/src/org/eclipse/cdt/cmake/core/internal/CMakePropertiesEvolutionTest.java

Lines changed: 0 additions & 98 deletions
This file was deleted.

0 commit comments

Comments
 (0)