| RE: [cdt-dev] Programatically create CDT project |
Hi Stephen,
From: cdt-dev-bounces@xxxxxxxxxxx [mailto:cdt-dev-bounces@xxxxxxxxxxx] On Behalf Of Andrew Gvozdev
On Fri, Dec 19, 2008 at 1:19 PM, Kennedy, Stephen M (Steve) <stevekennedy@xxxxxxxxxxxxxxxxxx> wrote:
We have a plug-in that relies on the code-browsing capabilities of CDT. Currently we have a perl script that pre-creates/populates a directory in the workspace and we tell the users to go to the C++ Project wizard, type the project, select our project type and hit Finish. The users, of course, would like the project creation to be part of the magic script also.
Our project type/tool chain is a stripped down version of the gcc toolchain and simply provides an alternative implementation of the scannerInfoCollector (reads the settings from a file created by the magic script). We currently don't support "building" with our toolchain.
I can create a CDT project but have had no luck in figuring out how to set the project type/toolchain/configuration to our custom one. I think I need to do what MBSWizardHandler.createProject() does but there seems to be several internal classes used in that method.
Any ideas or pointers would be welcome.
I just posted a few days ago an example of creating Standard Make http://www.eclipse.org/newsportal/article.php?id=17773&group=eclipse.tools.cdt#17773Here is an example for Managed project.import org.eclipse.cdt.managedbuilder.testplugin.BuildSystemTestHelper;import org.eclipse.cdt.managedbuilder.testplugin.CTestPlugin;import org.eclipse.cdt.managedbuilder.testplugin.ManagedBuildTestHelper;CoreModel coreModel = CoreModel.getDefault();ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();String pluginProjectTypeId = "cdt.managedbuild.target.gnu.cygwin.exe";String projectName = "testExecutableCygwinGcc";{// Create model project and accompanied descriptionsIProject project = BuildSystemTestHelper.createProject(projectName);// Create project descriptionICProjectDescription des = coreModel.createProjectDescription(project, false);Assert.assertNotNull("createDescription returned null!", des);{// Create one configuration descriptionManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);IProjectType type = ManagedBuildManager.getProjectType(pluginProjectTypeId);Assert.assertNotNull("project type not found", type);ManagedProject mProj = new ManagedProject(project, type);info.setManagedProject(mProj);IConfiguration cfgs[] = type.getConfigurations();Assert.assertNotNull("configurations not found", cfgs);Assert.assertTrue("no configurations found in the project type",cfgs.length>0);for (IConfiguration configuration : cfgs) {String id = ManagedBuildManager.calculateChildId(configuration.getId(), null);Configuration config = new Configuration(mProj, (Configuration)configuration, id, false, true, false);CConfigurationData data = "">Assert.assertNotNull("data is null for created configuration", data);ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);}Assert.assertEquals(2, des.getConfigurations().length);}// Persist project description.coreModel.setProjectDescription(project, des);project.close(null);}I hope you'll find that instructive.Thanks,AndrewThanks,
Steve Kennedy
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev
- References:
- [cdt-dev] Programatically create CDT project
- From: Kennedy, Stephen M \(Steve\)
- Re: [cdt-dev] Programatically create CDT project
- From: Andrew Gvozdev
- Prev by Date: Re: [cdt-dev] Programatically create CDT project
- Next by Date: RE: [cdt-dev] CVS cdt-home
- Previous by thread: Re: [cdt-dev] Programatically create CDT project
- Index(es):