use of org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo in project usbdm-eclipse-plugins by podonoghue.
the class ProjectUtilities method createIncludeFolder.
public static void createIncludeFolder(IProject project, String targetPath, IProgressMonitor progressMonitor) throws CoreException, BuildException {
// createSourceFolder(project, targetPath, progressMonitor);
createFolder(project, targetPath, progressMonitor);
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
// Add to Include search paths
IConfiguration[] configs = info.getManagedProject().getConfigurations();
for (IConfiguration config : configs) {
// Creates include folder path that is portable (e.g. rename project doesn't break paths)
String path = "\"${ProjDirPath}/" + project.getFolder(targetPath).getProjectRelativePath().toOSString() + "\"";
IToolChain toolChain = config.getToolChain();
setIncludePathOptionForConfig(path, config, toolChain.getOptions(), toolChain);
ITool[] tools = config.getTools();
for (ITool tool : tools) {
setIncludePathOptionForConfig(path, config, tool.getOptions(), tool);
}
}
ManagedBuildManager.saveBuildInfo(project, true);
}
use of org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo in project usbdm-eclipse-plugins by podonoghue.
the class UsbdmGCCSpecsRunSIProvider method getToolPrefix.
/**
* @param project The project to look in for options
* @return The prefix for the build tools
*/
private String getToolPrefix(IProject project) {
IManagedBuildInfo info = ManagedBuildManager.getBuildInfo(project);
if (info == null) {
return "";
}
IConfiguration cfg = info.getDefaultConfiguration();
// System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found IConfiguration = " + cfg.getName());
IToolChain toolChain = cfg.getToolChain();
// System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found toolChain = " + toolChain.getName());
// Find selected build tool (either ARM or Coldfire)
IOption buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.ARM_BUILDTOOLS_OPTIONS);
if (buildToolOption == null) {
buildToolOption = toolChain.getOptionBySuperClassId(UsbdmConstants.COLDFIRE_BUILDTOOLS_OPTIONS);
}
if (buildToolOption == null) {
return "";
}
// Get build path variable
ToolInformationData toolData = ToolInformationData.getToolInformationTable().get(buildToolOption.getValue().toString());
if (toolData == null) {
return "";
}
String toolPrefixVariableId = toolData.getPrefixVariableName();
if (toolPrefixVariableId == null) {
return "";
}
UsbdmSharedSettings settings = UsbdmSharedSettings.getSharedSettings();
String toolPrefix = null;
if (settings != null) {
toolPrefix = settings.get(toolPrefixVariableId);
}
if (toolPrefix == null) {
toolPrefix = "Tool Prefix not set";
return "";
}
// System.err.println("UsbdmGCCSpecsRunSIProvider.initialize() Found tool prefix = " + toolPrefix);
return toolPrefix;
}
use of org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo in project m2e-nar by maven-nar.
the class CProjectConfigurator method getCdtProject.
private ICProjectDescription getCdtProject(IProject project, IToolChain tc, String artefactType, IProgressMonitor monitor) throws CoreException {
try {
ICProjectDescriptionManager mngr = CoreModel.getDefault().getProjectDescriptionManager();
if (!project.hasNature(CCProjectNature.CC_NATURE_ID)) {
MavenNarPlugin.getDefault().log("Configuring project with " + tc.getUniqueRealName() + " tool chain");
// Add the C++ Nature
CCorePlugin.getDefault().convertProjectToNewCC(project, ManagedBuildManager.CFG_DATA_PROVIDER_ID, monitor);
ICProjectDescription des = mngr.createProjectDescription(project, false, false);
IManagedBuildInfo info = ManagedBuildManager.createBuildInfo(project);
List<IConfiguration> cfgs = getCfgs(tc, artefactType);
if (cfgs.isEmpty()) {
throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
}
IConfiguration cf = cfgs.get(0);
IManagedProject mProj = ManagedBuildManager.createManagedProject(project, cf.getProjectType());
info.setManagedProject(mProj);
return des;
} else {
ICProjectDescription des = mngr.getProjectDescription(project, true);
return des;
}
} catch (BuildException e) {
throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot create CDT managed project", e));
}
}
Aggregations