Search in sources :

Example 21 with IConfiguration

use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project usbdm-eclipse-plugins by podonoghue.

the class ToolchainValueHandler method listConfigs.

void listConfigs(IBuildObject configuration) {
    String configTypeID = "net.sourceforge.usbdm.cdt.toolchain.processor.mcpu";
    System.err.println("ToolchainValueHandler.isEnumValueAppropriate()");
    // first we check the preference for this project, if it exists
    IConfiguration config = null;
    if (configuration instanceof IConfiguration) {
        config = (IConfiguration) configuration;
    } else if (configuration instanceof IFolderInfo) {
        IFolderInfo folderInfo = (IFolderInfo) configuration;
        config = folderInfo.getParent();
    }
    if (config == null) {
        System.err.println("ToolchainValueHandler.isEnumValueAppropriate() config not found");
    }
    IToolChain toolChain = config.getToolChain();
    ITool[] tools = toolChain.getTools();
    IOption CPUListOption = null;
    for (int i = 0; i < tools.length; i++) {
        System.err.println("ToolchainValueHandler.isEnumValueAppropriate() Checking tool: " + tools[i].getId());
        if (tools[i].getOptionBySuperClassId(configTypeID) != null) {
            CPUListOption = tools[i].getOptionBySuperClassId(configTypeID);
        }
    }
    if (CPUListOption == null) {
        System.err.println("ToolchainValueHandler.isEnumValueAppropriate() CPUListOption not found");
    }
}
Also used : IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) IFolderInfo(org.eclipse.cdt.managedbuilder.core.IFolderInfo) ITool(org.eclipse.cdt.managedbuilder.core.ITool)

Example 22 with IConfiguration

use of org.eclipse.cdt.managedbuilder.core.IConfiguration 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;
}
Also used : UsbdmSharedSettings(net.sourceforge.usbdm.constants.UsbdmSharedSettings) IManagedBuildInfo(org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo) ToolInformationData(net.sourceforge.usbdm.constants.ToolInformationData) IToolChain(org.eclipse.cdt.managedbuilder.core.IToolChain) IOption(org.eclipse.cdt.managedbuilder.core.IOption) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 23 with IConfiguration

use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.

the class CProjectConfigurator method getCdtMavenConfig.

private ICConfigurationDescription getCdtMavenConfig(IProject project, ICProjectDescription des, IToolChain tc, String artefactType, String name, boolean setActive, IProgressMonitor monitor) throws CoreException {
    IManagedProject mProj = ManagedBuildManager.getBuildInfo(project).getManagedProject();
    ICConfigurationDescription mavenCfg = des.getConfigurationByName(name);
    if (mavenCfg == null) {
        List<IConfiguration> cfgs = getCfgs(tc, artefactType);
        if (cfgs.isEmpty()) {
            throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
        }
        monitor.worked(10);
        monitor.worked(10);
        // cfgs = CfgHolder.unique(cfgs);
        // cfgs = CfgHolder.reorder(cfgs);
        IConfiguration cfgRelease = null;
        IConfiguration cfgFirst = null;
        int work = 50 / cfgs.size();
        for (IConfiguration cfg : cfgs) {
            IBuildProperty b = cfg.getBuildProperties().getProperty(ManagedBuildManager.BUILD_TYPE_PROPERTY_ID);
            if (cfgRelease == null && b != null && b.getValue() != null && ManagedBuildManager.BUILD_TYPE_PROPERTY_RELEASE.equals(b.getValue().getId())) {
                cfgRelease = cfg;
            }
            if (cfgFirst == null) {
                cfgFirst = cfg;
            }
            monitor.worked(work);
        }
        if (cfgFirst != null) {
            if (cfgRelease != null) {
                cfgFirst = cfgRelease;
            }
            MavenNarPlugin.getDefault().log("Creating configuration " + name);
            IConfiguration newCfg = createConfiguration(cfgFirst, mProj, des);
            newCfg.setName(name);
            newCfg.setDescription("m2e generated configuration");
            mavenCfg = ManagedBuildManager.getDescriptionForConfiguration(newCfg);
        }
    }
    if (mavenCfg != null) {
        if (setActive) {
            des.setActiveConfiguration(mavenCfg);
        }
        return mavenCfg;
    } else {
        throw new CoreException(new Status(IStatus.ERROR, MavenNarPlugin.PLUGIN_ID, "Cannot find any configurations"));
    }
// mngr.setProjectDescription(project, des);
}
Also used : IManagedProject(org.eclipse.cdt.managedbuilder.core.IManagedProject) IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) CoreException(org.eclipse.core.runtime.CoreException) IBuildProperty(org.eclipse.cdt.managedbuilder.buildproperties.IBuildProperty) ICConfigurationDescription(org.eclipse.cdt.core.settings.model.ICConfigurationDescription) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 24 with IConfiguration

use of org.eclipse.cdt.managedbuilder.core.IConfiguration 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));
    }
}
Also used : IStatus(org.eclipse.core.runtime.IStatus) Status(org.eclipse.core.runtime.Status) IManagedProject(org.eclipse.cdt.managedbuilder.core.IManagedProject) ICProjectDescription(org.eclipse.cdt.core.settings.model.ICProjectDescription) IManagedBuildInfo(org.eclipse.cdt.managedbuilder.core.IManagedBuildInfo) CoreException(org.eclipse.core.runtime.CoreException) ICProjectDescriptionManager(org.eclipse.cdt.core.settings.model.ICProjectDescriptionManager) BuildException(org.eclipse.cdt.managedbuilder.core.BuildException) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration)

Example 25 with IConfiguration

use of org.eclipse.cdt.managedbuilder.core.IConfiguration in project m2e-nar by maven-nar.

the class AbstractGnuCompilerSynchroniser method fullSync.

@Override
public void fullSync(ICConfigurationDescription cfg, NarBuildArtifact artifactSettings) throws CoreException {
    BuildConfigurationData confData = (BuildConfigurationData) cfg.getConfigurationData();
    IConfiguration managedConf = confData.getConfiguration();
    for (final ITool tool : managedConf.getToolsBySuperClassId(getToolId())) {
        tool.setToolCommand(getCompilerSettings(artifactSettings).getName());
    }
    final OptionSetter optionSetter = new OptionSetter(managedConf, getToolId());
    setUndefinedSymbols(optionSetter, artifactSettings);
    setOptimization(optionSetter, artifactSettings);
    setDebug(optionSetter, artifactSettings);
    setOptions(optionSetter, artifactSettings);
}
Also used : BuildConfigurationData(org.eclipse.cdt.managedbuilder.internal.dataprovider.BuildConfigurationData) IConfiguration(org.eclipse.cdt.managedbuilder.core.IConfiguration) ITool(org.eclipse.cdt.managedbuilder.core.ITool)

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