1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-09-10 03:53:21 +02:00

Bug 309126: Build before launch does too much building with project references (handle invalid build config ID)

This commit is contained in:
John Cortell 2010-05-26 15:57:45 +00:00
parent d1de985681
commit 23c2595561

View file

@ -249,6 +249,19 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
buildConfigID = null;
}
// There's no guarantee the ID stored in the launch config is valid.
// The user may have deleted the build configuration.
if (buildConfigID != null) {
boolean idIsGood = false;
ICProjectDescription desc = CCorePlugin.getDefault().getProjectDescription(project, false);
if (desc != null) {
idIsGood = desc.getConfigurationById(buildConfigID) != null;
}
if (!idIsGood) {
buildConfigID = null; // use active configuration
}
}
buildProject(project, buildConfigID, submon.newChild(1));
return false;
}
@ -269,7 +282,8 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
* the project to build
* @param buildConfigID
* the specific build configuration to build, or null to build
* the active one
* the active one. Caller must guarantee validity of ID (that
* [project] actually contains such a configuration)
* @param monitor
* progress monitor
* @throws CoreException
@ -405,15 +419,13 @@ public abstract class AbstractCLaunchDelegate2 extends LaunchConfigurationDelega
if (desc != null) {
ICConfigurationDescription cfgDescActive = desc.getActiveConfiguration();
ICConfigurationDescription cfgDesc = desc.getConfigurationById(buildConfigId);
if (cfgDesc != cfgDescActive) {
if (cfgDesc != null) {
args[2] = cfgDesc.getName();
}
else {
// TODO: not sure if and when this could ever happen, but just in case...
args[2] = "???"; //$NON-NLS-1$
}
if ((cfgDesc != null) && (cfgDesc != cfgDescActive)) {
args[2] = cfgDesc.getName();
}
// Note that we use the active build configuration if the ID in
// the launch config is no longer valid. This is consistent with
// the logic in buildForLaunch()
}
}