Search in sources :

Example 11 with IConfiguration

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);
    }
}
Also used : BuildConfigurationData(org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 12 with IConfiguration

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;
}
Also used : ArrayList(java.util.ArrayList) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 13 with IConfiguration

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;
}
Also used : IBuilder(org.eclipse.cdt.managedbuilder.core.IBuilder) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) Configuration(org.eclipse.cdt.managedbuilder.internal.core.Configuration) CConfigurationData(org.eclipse.cdt.core.settings.model.extension.CConfigurationData) ICConfigurationDescription(org.eclipse.cdt.core.settings.model.ICConfigurationDescription)

Example 14 with IConfiguration

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();
        }
    }
}
Also used : ICProjectDescription(org.eclipse.cdt.core.settings.model.ICProjectDescription) IProgressMonitor(org.eclipse.core.runtime.IProgressMonitor) CoreException(org.eclipse.core.runtime.CoreException) ICConfigurationDescription(org.eclipse.cdt.core.settings.model.ICConfigurationDescription) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) Job(org.eclipse.core.runtime.jobs.Job)

Example 15 with IConfiguration

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;
}
Also used : IOption(org.eclipse.cdt.managedbuilder.core.IOption) BuildException(org.eclipse.cdt.managedbuilder.core.BuildException) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) ITool(org.eclipse.cdt.managedbuilder.core.ITool) IResourceInfo(org.eclipse.cdt.managedbuilder.core.IResourceInfo)

Aggregations

IConfiguration (org.eclipse.cdt.managedbuilder.core.IConfiguration)27 ITool (org.eclipse.cdt.managedbuilder.core.ITool)11 IOption (org.eclipse.cdt.managedbuilder.core.IOption)9 IToolChain (org.eclipse.cdt.managedbuilder.core.IToolChain)9 IManagedBuildInfo (org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo)6 BuildException (org.eclipse.cdt.managedbuilder.core.BuildException)5 CoreException (org.eclipse.core.runtime.CoreException)5 ICConfigurationDescription (org.eclipse.cdt.core.settings.model.ICConfigurationDescription)4 ICProjectDescription (org.eclipse.cdt.core.settings.model.ICProjectDescription)4 IFolderInfo (org.eclipse.cdt.managedbuilder.core.IFolderInfo)4 BuildConfigurationData (org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData)4 ArrayList (java.util.ArrayList)3 ToolInformationData (net.sourceforge.usbdm.constants.ToolInformationData)3 IPath (org.eclipse.core.runtime.IPath)3 UsbdmSharedSettings (net.sourceforge.usbdm.constants.UsbdmSharedSettings)2 CoreModel (org.eclipse.cdt.core.model.CoreModel)2 CConfigurationData (org.eclipse.cdt.core.settings.model.extension.CConfigurationData)2 IBuilder (org.eclipse.cdt.managedbuilder.core.IBuilder)2 IManagedProject (org.eclipse.cdt.managedbuilder.core.IManagedProject)2 Configuration (org.eclipse.cdt.managedbuilder.internal.core.Configuration)2