1
0
Fork 0
mirror of https://github.com/eclipse-cdt/cdt synced 2025-04-23 14:42:11 +02:00

autotools: Improve import wizard to generate missing files.

Calling AutotoolsNewMakeGenerator.reconfigure in the wizard ensures that
autogen.sh/configure etc. will be called at import time to make build
work after that without further intervention.

Change-Id: I3f89f84e2f698ebe1c26cb4427de421b29225030
Signed-off-by: Alexander Kurtakov <akurtako@redhat.com>
This commit is contained in:
Alexander Kurtakov 2015-10-26 22:29:51 +02:00
parent 3098d1679b
commit e0516f3084

View file

@ -13,6 +13,7 @@ package org.eclipse.cdt.internal.autotools.ui.wizards;
import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature; import org.eclipse.cdt.autotools.core.AutotoolsNewProjectNature;
import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin; import org.eclipse.cdt.autotools.ui.AutotoolsUIPlugin;
import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.CCorePlugin;
import org.eclipse.cdt.internal.autotools.core.AutotoolsNewMakeGenerator;
import org.eclipse.cdt.internal.autotools.core.AutotoolsPropertyConstants; import org.eclipse.cdt.internal.autotools.core.AutotoolsPropertyConstants;
import org.eclipse.cdt.internal.ui.CUIMessages; import org.eclipse.cdt.internal.ui.CUIMessages;
import org.eclipse.cdt.managedbuilder.core.BuildException; import org.eclipse.cdt.managedbuilder.core.BuildException;
@ -24,11 +25,12 @@ import org.eclipse.cdt.managedbuilder.core.IToolChain;
import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager; import org.eclipse.cdt.managedbuilder.core.ManagedBuildManager;
import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature; import org.eclipse.cdt.managedbuilder.core.ManagedCProjectNature;
import org.eclipse.cdt.managedbuilder.ui.wizards.NewMakeProjFromExistingPage; import org.eclipse.cdt.managedbuilder.ui.wizards.NewMakeProjFromExistingPage;
import org.eclipse.cdt.ui.CUIPlugin;
import org.eclipse.cdt.utils.ui.controls.ControlFactory; import org.eclipse.cdt.utils.ui.controls.ControlFactory;
import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.IProject;
import org.eclipse.core.runtime.CoreException; import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IProgressMonitor; import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.SubProgressMonitor; import org.eclipse.core.runtime.SubMonitor;
import org.eclipse.swt.SWT; import org.eclipse.swt.SWT;
import org.eclipse.swt.events.SelectionAdapter; import org.eclipse.swt.events.SelectionAdapter;
import org.eclipse.swt.events.SelectionEvent; import org.eclipse.swt.events.SelectionEvent;
@ -115,14 +117,11 @@ public class AutotoolsProjectImportWizardPage extends
try { try {
monitor.subTask(AutotoolsUIPlugin monitor.subTask(AutotoolsUIPlugin
.getResourceString("adding project nature")); .getResourceString("adding project nature"));
ManagedCProjectNature.addManagedNature(project, ManagedCProjectNature.addManagedNature(project, SubMonitor.convert(monitor, 1));
new SubProgressMonitor(monitor, 1)); AutotoolsNewProjectNature.addAutotoolsNature(project, SubMonitor.convert(monitor, 1));
AutotoolsNewProjectNature.addAutotoolsNature(project,
new SubProgressMonitor(monitor, 1));
monitor.subTask(AutotoolsUIPlugin monitor.subTask(AutotoolsUIPlugin
.getResourceString("adding builder")); .getResourceString("adding builder"));
AutotoolsNewProjectNature.addAutotoolsBuilder(project, AutotoolsNewProjectNature.addAutotoolsBuilder(project, SubMonitor.convert(monitor, 1));
new SubProgressMonitor(monitor, 1));
project.setPersistentProperty( project.setPersistentProperty(
AutotoolsPropertyConstants.SCANNER_USE_MAKE_W, AutotoolsPropertyConstants.SCANNER_USE_MAKE_W,
AutotoolsPropertyConstants.TRUE); AutotoolsPropertyConstants.TRUE);
@ -169,6 +168,14 @@ public class AutotoolsProjectImportWizardPage extends
defaultCfg); defaultCfg);
} }
ManagedBuildManager.setNewProjectVersion(project); ManagedBuildManager.setNewProjectVersion(project);
AutotoolsNewMakeGenerator m = new AutotoolsNewMakeGenerator();
CUIPlugin.getDefault().startGlobalConsole();
m.initialize(project, info, SubMonitor.convert(monitor));
try {
m.reconfigure();
} catch (CoreException e) {
// do nothing for now
}
} }
} catch (BuildException e) { } catch (BuildException e) {
AutotoolsUIPlugin.log(e); AutotoolsUIPlugin.log(e);