Skip to content

Commit

Permalink
Bug 552070 - Build not configured correctly error while building a pr…
Browse files Browse the repository at this point in the history
…oject

https://bugs.eclipse.org/bugs/show_bug.cgi?id=552070

After closing and opening a Core Build project (Make, CMake,
Autotools, and Meson), the project could not be built for Debug
anymore. Error: "Build not configured correctly".

Restoration of the debug build configurations failed, because the
settings had been removed during closure of the project.
CBuildConfiguration(IBuildConfiguration config, String name)
failed with a CoreException. The CBuildConfigurationManager
silently catched the exception and put the IBuildConfiguration for
debug in the noConfigs list.
  • Loading branch information
ewaterlander authored and jonahgraham committed Jan 25, 2023
1 parent 7bcef26 commit 7911ac8
Show file tree
Hide file tree
Showing 2 changed files with 20 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@
import org.eclipse.cdt.core.resources.IConsole;
import org.eclipse.cdt.internal.core.BuildRunnerHelper;
import org.eclipse.cdt.internal.core.ConsoleOutputSniffer;
import org.eclipse.cdt.internal.core.build.CBuildConfigurationManager;
import org.eclipse.cdt.internal.core.build.Messages;
import org.eclipse.cdt.internal.core.model.BinaryRunner;
import org.eclipse.cdt.internal.core.model.CModelManager;
Expand Down Expand Up @@ -95,6 +96,19 @@
* Root class for CDT build configurations. Provides access to the build
* settings for subclasses.
*
* Each Eclipse project has one or more build configurations ({@link IBuildConfiguration}).
* A CDT Core Build project pairs each build configuration with a Core Build configuration
* ({@link ICBuildConfiguration}). A Core Build configuration has variable config pointing to
* the IBuildConfiguration. The link from IBuildConfiguration to ICBuildConfiguration
* goes via getAdapter(ICBuildConfiguration.class) which gets the ICBuildConfiguration
* from Map configs in the {@link CBuildConfigurationManager}.
*
* In a new project the initial Core Build configurations creation is triggered by the
* {@link CoreBuildLaunchBarTracker}. The initial configuration for Debug will only be
* created if the user selects the Debug launch mode. Restoration of Core Build configurations,
* after an Eclipse restart or close and open of the project, uses the settings which are
* persistently stored in the backing store. @see org.osgi.service.prefs.Preferences
*
* @since 6.0
*/
public abstract class CBuildConfiguration extends PlatformObject implements ICBuildConfiguration, ICBuildConfiguration2,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,12 @@ public void resourceChanged(IResourceChangeEvent event) {
Preferences projectNode = parentNode.node(project.getName());
if (projectNode != null) {
try {
projectNode.removeNode();
if (event.getType() == IResourceChangeEvent.PRE_DELETE) {
// We need to keep the settings when the project is closed. They are used by
// CBuildConfiguration.CBuildConfiguration(IBuildConfiguration config, String name)
// to restore Debug core build configurations when the project is reopened.
projectNode.removeNode();
}
parentNode.flush();
} catch (BackingStoreException e) {
CCorePlugin.log(e);
Expand Down

0 comments on commit 7911ac8

Please sign in to comment.