Here is an example for Managed project.
CoreModel coreModel = CoreModel.getDefault();
ICProjectDescriptionManager mngr = coreModel.getProjectDescriptionManager();
String pluginProjectTypeId = "cdt.managedbuild.target.gnu.cygwin.exe";
String projectName = "testExecutableCygwinGcc";
{
// Create model project and accompanied descriptions
IProject project = BuildSystemTestHelper.createProject(projectName);
// Create project description
ICProjectDescription des = coreModel.createProjectDescription(project, false);
Assert.assertNotNull("createDescription returned null!", des);
{
// Create one configuration description
ManagedBuildInfo 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,
Andrew
_______________________________________________
cdt-dev mailing list
cdt-dev@xxxxxxxxxxx
https://dev.eclipse.org/mailman/listinfo/cdt-dev