use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.
the class AbstractSettingsSynchroniser method setArtifactName.
private void setArtifactName(ICConfigurationDescription cfg, NarBuildArtifact artifactSettings) {
final String artifactName = artifactSettings.getArtifactName();
if (artifactName != null) {
BuildConfigurationData confData = (BuildConfigurationData) cfg.getConfigurationData();
IConfiguration managedConf = confData.getConfiguration();
managedConf.setArtifactName(artifactName);
}
}
use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.
the class CProjectConfigurator method getCfgs.
protected List<IConfiguration> getCfgs(IToolChain tc, String artefactType) {
List<IConfiguration> out = new ArrayList<IConfiguration>();
IConfiguration[] cfgs = ManagedBuildManager.getExtensionConfigurations(tc, ManagedBuildManager.BUILD_ARTEFACT_TYPE_PROPERTY_ID, artefactType);
if (cfgs != null) {
for (IConfiguration cfg : cfgs) {
if (isValid(cfg)) {
out.add(cfg);
}
}
}
return out;
}
use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.
the class CProjectConfigurator method createConfiguration.
private IConfiguration createConfiguration(IConfiguration cfg, IManagedProject proj, ICProjectDescription des) throws WriteAccessException, CoreException {
String id = ManagedBuildManager.calculateChildId(cfg.getId(), null);
// CProjectDescriptionManager.getInstance();
Configuration config = new Configuration((ManagedProject) proj, (Configuration) cfg, id, false, true);
CConfigurationData data = config.getConfigurationData();
ICConfigurationDescription cfgDes = des.createConfiguration(ManagedBuildManager.CFG_DATA_PROVIDER_ID, data);
config.setConfigurationDescription(cfgDes);
config.exportArtifactInfo();
// Force internal builder
IBuilder internalBuilder = ManagedBuildManager.getInternalBuilder();
config.changeBuilder(internalBuilder, internalBuilder.getId(), internalBuilder.getName());
// IBuilder bld = config.getEditableBuilder();
// if (bld != null) { bld.setManagedBuildOn(true); }
config.setName(cfg.getName());
config.setArtifactName(proj.getDefaultArtifactName());
return config;
}
use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.
the class AbstractTestBuild method buildAllConfigurations.
protected void buildAllConfigurations(final IProject project) {
final ICProjectDescription prjd = CoreModel.getDefault().getProjectDescription(project, false);
if (prjd != null) {
final ICConfigurationDescription[] cfgDescriptions = prjd.getConfigurations();
if (cfgDescriptions != null && cfgDescriptions.length > 0) {
final IConfiguration[] cfgs = new IConfiguration[cfgDescriptions.length];
for (int i = 0; i < cfgDescriptions.length; ++i) {
cfgs[i] = ManagedBuildManager.getConfigurationForDescription(cfgDescriptions[i]);
}
final Job job = new Job("Building all configurations") {
@Override
protected IStatus run(IProgressMonitor monitor) {
try {
ManagedBuildManager.buildConfigurations(cfgs, monitor);
} catch (CoreException e) {
return e.getStatus();
}
return Status.OK_STATUS;
}
};
job.schedule();
waitForJobs();
}
}
}
use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project linuxtools by eclipse.
the class CProjectBuildHelpers method setOptionInCDTTool.
/**
* <h1>Set Option in CDT</h1>
* Same as {@link #setOptionInCDT(IProject project, String optionIDString, boolean value) setOption_in } <br>
* except you can specify the parent tool manually (in case current implementation does not support what yon need.
*
* @param project an IProject
* @param optionIDString ID of option as defined in plugin.xml. e.g gnu.cpp.compiler.option.debugging.gprof
* @param value true/false
* @param toolSuperClassId
* Name of the tool where the option resides. E.g 'GCC C Compiler' or 'GCC C++ Compiler'. <br>
* To find out, check/uncheck an option, inspect the .cproject file, look for the option,<br>
* then see what tool it's under. See the name property
* @return true if all went well, false otherwise
*/
private static boolean setOptionInCDTTool(IProject project, String optionIDString, boolean value, String toolSuperClassId) {
// Get configuration
IConfiguration activeConf = helperGetActiveConfiguration(project);
// Get the ITool the option.
ITool gccCompileriTool = helperGetGccCompilerToolBySuperClass(toolSuperClassId, activeConf);
// Get Template Opiton.
// Get Option ~Immutable. This is like a 'templete' that we will base the actual option on.
IOption optionTemplate = gccCompileriTool.getOptionById(optionIDString);
// Check that we got a good option template.
if (optionTemplate == null) {
// This could fail if the specified option doesn't exist or is miss-spelled.
MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionTemplate);
return false;
}
// Get Actual Option
//
// Now we acquire an option that can be 'set' to something.
// In contrast to the immutable option above, if the user never checked/unchecked the option by hand,
// then the first time 'set' of this option will work correctly. Whereas
// the immutable option would only work if the user checked/unchecked the option by hand before.
IOption mutableOptionToSet = null;
try {
mutableOptionToSet = gccCompileriTool.getOptionToSet(optionTemplate, false);
mutableOptionToSet.setValue(value);
} catch (BuildException e) {
// This is reached if the template that was provided was bad.
MessageDialogSyncedRunnable.openErrorSyncedRunnable(ProfilingMessages.errorTitle, ProfilingMessages.errorGetOptionForWriting);
}
// get resource info. (where things are saved to).
IResourceInfo resourceInfo = activeConf.getResourceInfos()[0];
// Mark the option as enabled in the build manager.
ManagedBuildManager.setOption(resourceInfo, gccCompileriTool, mutableOptionToSet, true);
// Save this business to disk.
ManagedBuildManager.saveBuildInfo(project, true);
return true;
}
Aggregations