1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-29 19:45:01 +02:00

Bug 552070 - Build not configured correctly error while building a project

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.
This commit is contained in:
Erwin Waterlander 2022-12-05 13:07:48 +00:00 committed by Jonah Graham
parent 7bcef26f65
commit 7911ac8a2b
2 changed files with 20 additions and 1 deletions

View file

@ -59,6 +59,7 @@ import org.eclipse.cdt.core.parser.IScannerInfoChangeListener;
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;
@ -95,6 +96,19 @@ import com.google.gson.GsonBuilder;
* 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,

View file

@ -367,7 +367,12 @@ public class CBuildConfigurationManager
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);