mirror of
https://github.com/eclipse-cdt/cdt
synced 2025-08-09 17:25:38 +02:00
Bug 289834: Converting an C autotools based project into a C++ lost
changes such as build configurations Change-Id: Ibec7802fb3fb9e6ea8d9a7060fed5fe511cf3f72 Reviewed-on: https://git.eclipse.org/r/12471 Reviewed-by: Jeff Johnston <jjohnstn@redhat.com> IP-Clean: Jeff Johnston <jjohnstn@redhat.com> Tested-by: Jeff Johnston <jjohnstn@redhat.com>
This commit is contained in:
parent
f40788aa92
commit
7ff04d5d8d
1 changed files with 22 additions and 13 deletions
|
@ -111,8 +111,15 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
|
||||||
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
|
public void convertProject(IProject project, IProgressMonitor monitor, String projectID) throws CoreException {
|
||||||
monitor.beginTask(AutotoolsUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
|
monitor.beginTask(AutotoolsUIPlugin.getResourceString("WizardMakeProjectConversion.monitor.convertingToMakeProject"), 7); //$NON-NLS-1$
|
||||||
IConfiguration defaultCfg = null;
|
IConfiguration defaultCfg = null;
|
||||||
|
Boolean convertingNewAutotoolsProject = false;
|
||||||
try {
|
try {
|
||||||
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
super.convertProject(project, new SubProgressMonitor(monitor, 1), projectID);
|
||||||
|
// Bug 289834 - Converting C Autotools project to C++ loses configurations
|
||||||
|
if (project.hasNature(AutotoolsNewProjectNature.AUTOTOOLS_NATURE_ID)) {
|
||||||
|
convertingNewAutotoolsProject = true; // set this for finally clause
|
||||||
|
return; // We have converted C to C++ or vice-versa for an existing Autotools project and are done
|
||||||
|
}
|
||||||
|
// Otherwise, we must scrap existing configurations as they will have tool settings we cannot use
|
||||||
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
monitor.subTask(AutotoolsUIPlugin.getResourceString(MSG_ADD_NATURE));
|
||||||
ManagedCProjectNature.addManagedNature(project, new SubProgressMonitor(monitor, 1));
|
ManagedCProjectNature.addManagedNature(project, new SubProgressMonitor(monitor, 1));
|
||||||
AutotoolsNewProjectNature.addAutotoolsNature(project, new SubProgressMonitor(monitor, 1));
|
AutotoolsNewProjectNature.addAutotoolsNature(project, new SubProgressMonitor(monitor, 1));
|
||||||
|
@ -196,19 +203,21 @@ public class ConvertToAutotoolsProjectWizardPage extends ConvertProjectWizardPag
|
||||||
ManagedBuildManager.saveBuildInfo(project, true);
|
ManagedBuildManager.saveBuildInfo(project, true);
|
||||||
}
|
}
|
||||||
} finally {
|
} finally {
|
||||||
// Create a default Autotools configuration and save it.
|
if (!convertingNewAutotoolsProject) { // Bug 289834 - don't create new config if switching between C and C++
|
||||||
// We must do this after the ManagedBuildManager does a save because
|
// Create a default Autotools configuration and save it.
|
||||||
// we might not yet have a Configuration Description set up for the
|
// We must do this after the ManagedBuildManager does a save because
|
||||||
// default configuration and we need the id to create our own form
|
// we might not yet have a Configuration Description set up for the
|
||||||
// of configuration.
|
// default configuration and we need the id to create our own form
|
||||||
ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(defaultCfg);
|
// of configuration.
|
||||||
String id = cfgd.getId();
|
ICConfigurationDescription cfgd = ManagedBuildManager.getDescriptionForConfiguration(defaultCfg);
|
||||||
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id, true);
|
String id = cfgd.getId();
|
||||||
AutotoolsConfigurationManager.getInstance().saveConfigs(project);
|
AutotoolsConfigurationManager.getInstance().getConfiguration(project, id, true);
|
||||||
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
|
AutotoolsConfigurationManager.getInstance().saveConfigs(project);
|
||||||
if (initResult.getCode() != IStatus.OK) {
|
IStatus initResult = ManagedBuildManager.initBuildInfoContainer(project);
|
||||||
// At this point, I can live with a failure
|
if (initResult.getCode() != IStatus.OK) {
|
||||||
AutotoolsUIPlugin.log(initResult);
|
// At this point, I can live with a failure
|
||||||
|
AutotoolsUIPlugin.log(initResult);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
monitor.done();
|
monitor.done();
|
||||||
}
|
}
|
||||||
|
|
Loading…
Add table
Reference in a new issue