# HG changeset patch # User timkelly # Date 1270070515 18000 # Node ID c2836b036bd58526954b2105a10130af940313cb # Parent 77fe575a35282202c9764bb3f04fd7d86e791cab merge changes for bug 10674 from default diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java Wed Mar 31 16:21:55 2010 -0500 @@ -298,5 +298,12 @@ */ public String extraSBSv2Args(); - + /** + * Appends arbitrary text to a default Carbide/Raptor configuration (the -c parameter). The default name is always given, e.g. armv5_urel, but users can + * append whatever they want to change the behavior of the build. + * @return the string to append the text to for the Raptor -c parameter + * + * @since 2.6 + */ + public String buildConfigAppender(); } diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Wed Mar 31 16:21:55 2010 -0500 @@ -69,7 +69,7 @@ public CarbideBuildConfiguration(IProject project, ISymbianBuildContext context) { - super(context.getSDK(), context.getPlatformString(), context.getTargetString()); + super(context.getSDK(), context.getPlatformString(), context.getTargetString(), context.getSBSv2Alias()); projectTracker = new TrackedResource(project); sisBuilderInfoList = new ArrayList(0); envVarsInfo = new EnvironmentVarsInfo2(project, context); @@ -287,6 +287,10 @@ public int getErrorParserId(){ String plat = this.getPlatformString(); + if (this.getSBSv2Alias() != null && this.getSBSv2Alias().toUpperCase().contains(ISymbianBuildContext.GCCE_PLATFORM)){ + return ERROR_PARSERS_GCCE; + } + if (plat.equals(ISymbianBuildContext.EMULATOR_PLATFORM)){ return ERROR_PARSERS_WINSCW; } else if (plat.startsWith("ARMV")){ diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java Wed Mar 31 16:21:55 2010 -0500 @@ -61,7 +61,8 @@ protected boolean overrideMakeEngine; protected String makeEngineToUse; protected String extraSBSv2Args; - + protected String buildAliasAppender; + // for internal plugin use public static final String OVERRIDE_WORKSPACE_SETTINGS_KEY = "overrideWorkspaceSettings"; //$NON-NLS-1$ public static final String CLEAN_LEVEL = "cleanLevel"; //$NON-NLS-1$ @@ -79,7 +80,7 @@ public static final String OVERRIDE_MAKE_ENGINE = "overrideMakeEngine"; //$NON-NLS-1$ public static final String MAKE_ENGINE_TO_USE = "makeEngineToUse"; //$NON-NLS-1$ public static final String EXTRA_SBSV2_ARGS = "extraSBSv2Args"; //$NON-NLS-1$ - + public static final String BUILD_ALIAS_APPENDER = "buildAliasAppendText"; //$NON-NLS-1$ public CarbideProjectInfo(IProject project) { this.projectTracker = new TrackedResource(project); @@ -229,6 +230,10 @@ if (orig != null){ extraSBSv2Args = orig; } + orig = storage.getAttribute(BUILD_ALIAS_APPENDER); + if (orig != null){ + buildAliasAppender = orig; + } } } @@ -262,6 +267,7 @@ overrideMakeEngine = BuilderPreferencePage.overrideDefaultMakeEngine(); makeEngineToUse = BuilderPreferencePage.makeEngine(); extraSBSv2Args = BuilderPreferencePage.extraSBSv2ArgsTextStore(); + buildAliasAppender = ""; // project setting only } public List getBuildConfigurations() { @@ -527,6 +533,11 @@ return BuilderPreferencePage.extraSBSv2ArgsTextStore(); } + public String buildConfigAppender() { + // This is a project setting only, i.e. no workspace setting to override + return buildAliasAppender; + } + /* * The following methods are non-API */ @@ -585,4 +596,8 @@ public String extraSBSv2ArgsProjectValue() { return extraSBSv2Args; } + + public String buildAliasAppendTextValue() { + return buildAliasAppender; + } } diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java Wed Mar 31 16:21:55 2010 -0500 @@ -219,6 +219,8 @@ makeEngineToUse = settingValue; } else if (settingName.equals(EXTRA_SBSV2_ARGS)) { extraSBSv2Args = settingValue; + } else if (settingName.equals(BUILD_ALIAS_APPENDER)) { + buildAliasAppender = settingValue; } // now write it to the file @@ -308,6 +310,7 @@ storage.setAttribute(OVERRIDE_MAKE_ENGINE, overrideMakeEngine ? "true" : "false"); storage.setAttribute(MAKE_ENGINE_TO_USE, makeEngineToUse); storage.setAttribute(EXTRA_SBSV2_ARGS, extraSBSv2Args); + storage.setAttribute(BUILD_ALIAS_APPENDER, buildAliasAppender); } } } catch (CoreException e) { diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Wed Mar 31 16:21:55 2010 -0500 @@ -91,9 +91,9 @@ return true; } + /** Get the build-able configuration from the command line (i.e. build alias). This is passed after the sbs -c parameter */ protected String getConfigName(ICarbideBuildConfiguration buildConfig) { - //TODO is this sufficient? - return buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase(); //$NON-NLS-1$ + return buildConfig.getSBSv2Alias(); } public boolean buildComponent(ICarbideBuildConfiguration buildConfig, IPath componentPath, boolean isTest, CarbideCommandLauncher launcher, IProgressMonitor monitor) { @@ -501,9 +501,17 @@ args.add(cpi.getAbsoluteBldInfPath().toOSString()); args.add("-c"); //$NON-NLS-1$ String configName = getConfigName(buildConfig); + if (configName == null){ + configName = "error_retrieving_sbs_config"; + } if (isTest) { configName = configName + ".test"; //$NON-NLS-1$ } + + if (cpi.buildConfigAppender() != null && cpi.buildConfigAppender().length() > 0){ + configName = configName + cpi.buildConfigAppender(); + } + args.add(configName); //TODO this causes output to go to stdout, but only at the end of the build. should we specify a logfile name and tail the file? diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java Wed Mar 31 16:21:55 2010 -0500 @@ -65,6 +65,8 @@ private Text makeEngineText; private Label extraArgsLabel; private Text extraArgsText; + private Label buildAliasLabel; // project setting only + private Text buildAliasText; // project setting only public BuildSettingsUI(Shell shell, boolean wantsSBSv2, boolean projectSetting) { this.shell = shell; @@ -256,6 +258,17 @@ extraArgsText.setToolTipText(Messages.getString("BuildSettingsUI.ExtraArgsToolTipText")); //$NON-NLS-1$ extraArgsText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + if (projectSetting){ + buildAliasLabel = new Label(content, SWT.NONE); + buildAliasLabel.setText(Messages.getString("BuildSettingsUI.AlliasAppendLabel")); //$NON-NLS-1$ + buildAliasLabel.setToolTipText(Messages.getString("BuildSettingsUI.AlliasAppendToolTipText")); //$NON-NLS-1$ + GridData buildAliasGridData = new GridData(); + buildAliasLabel.setLayoutData(buildAliasGridData); + + buildAliasText = new Text(content, SWT.BORDER); + buildAliasText.setToolTipText(Messages.getString("BuildSettingsUI.AlliasAppendToolTipText")); //$NON-NLS-1$ + buildAliasText.setLayoutData(new GridData(SWT.FILL, SWT.CENTER, true, false)); + } overrideDefaultMakeEngineCheck = new Button(content, SWT.CHECK); overrideDefaultMakeEngineCheck.setText(Messages.getString("BuildSettingsUI.OverrideMakeEngineLabel")); //$NON-NLS-1$ overrideDefaultMakeEngineCheck.setToolTipText(Messages.getString("BuildSettingsUI.OverrideMakeEngineToolTip")); //$NON-NLS-1$ @@ -457,6 +470,14 @@ extraArgsText.setText(args); } + public String getBuildAliasAppendText() { + return buildAliasText.getText(); + } + + public void setBuildAliasAppendText(String args) { + buildAliasText.setText(args); + } + public boolean getDontPromtTrackDeps(){ if (!projectSetting){ return dontCheckForExternalDependencies.getSelection(); diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java Wed Mar 31 16:21:55 2010 -0500 @@ -273,6 +273,8 @@ cpi.writeProjectSetting(CarbideProjectInfo.MAKE_ENGINE_TO_USE, buildSettingsUI.getMakeEngine()); cpi.writeProjectSetting(CarbideProjectInfo.EXTRA_SBSV2_ARGS, buildSettingsUI.getExtraSBSv2Args()); + + cpi.writeProjectSetting(CarbideProjectInfo.BUILD_ALIAS_APPENDER, buildSettingsUI.getBuildAliasAppendText()); } List checkedComponents = getCheckedComponentFilenames(); @@ -328,6 +330,7 @@ buildSettingsUI.setOverrideDefaultMakeEngine(cpi.overrideMakeEngineProjectValue()); buildSettingsUI.setMakeEngineText(cpi.makeEngineProjectValue()); buildSettingsUI.setExtraSBSv2Args(cpi.extraSBSv2ArgsProjectValue()); + buildSettingsUI.setBuildAliasAppendText(cpi.buildAliasAppendTextValue()); } initMMPSelectionUI(cpi); diff -r 77fe575a3528 -r c2836b036bd5 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Wed Mar 31 13:19:37 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties Wed Mar 31 16:21:55 2010 -0500 @@ -98,6 +98,8 @@ BuildSettingsUI.ExtraArgsLabelToolTip=Pass additional arguments to the sbs command-line. BuildSettingsUI.ExtraArgsText=Additional SBSv2 arguments BuildSettingsUI.ExtraArgsToolTipText=Add any extra arguments to be passed to sbs.bat here. +BuildSettingsUI.AlliasAppendLabel=Append to Build Configuration +BuildSettingsUI.AlliasAppendToolTipText=Appends the text to the default -c SBS parameter exactly as entered in the edit box. BuildSettingsUI.KeepGoingLabel=Keep going BuildSettingsUI.KeepGoingToolTip=Continue building, even if some build commands fail BuildSettingsUI.MakeEngineLabel=Make engine diff -r 77fe575a3528 -r c2836b036bd5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Mar 31 13:19:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Mar 31 16:21:55 2010 -0500 @@ -17,7 +17,10 @@ import java.util.ArrayList; import java.util.Collections; import java.util.Comparator; +import java.util.HashMap; +import java.util.Iterator; import java.util.List; +import java.util.Map; import javax.xml.parsers.DocumentBuilder; import javax.xml.parsers.DocumentBuilderFactory; @@ -55,9 +58,9 @@ private static boolean scannedSbsState = false; private static final String sbsScriptName = "sbs.bat"; protected static final String SBS_HOME = "SBS_HOME"; - - private static List unfilteredSBSv2ConfigNames; + /** Map of usable Raptor alias for -c parameter and base platform: */ + private static Map unfilteredSBSv2ConfigNames; /** * Get the path to the SBSv2 bin directory. This is based on the SBS_HOME environment variable @@ -75,12 +78,12 @@ /** * Get the build configurations supported by SBSv2 * @param refreshList whether or not to parse the configuration xml files again - * @return list of configuration names, never null + * @return A map of raptor aliases (key) to base build platform. Never null; */ - public static List getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { + public static Map getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { if (unfilteredSBSv2ConfigNames == null || refreshList) { - unfilteredSBSv2ConfigNames = new ArrayList(); + unfilteredSBSv2ConfigNames = new HashMap(); // parse the xml files in SBS_HOME/lib/config/ to get SBSv2 configs try { @@ -182,11 +185,15 @@ public static List getFilteredSBSv2BuildContexts(ISymbianSDK sdk) { List contexts = new ArrayList(); - for (String name : getUnfilteredSBSv2BuildConfigurations(false)) { - + Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); + while (it.hasNext()){ + Map.Entry buildConfigPair = (Map.Entry)it.next(); + String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias + String basePlat = (String)buildConfigPair.getValue(); + boolean addConfig = true; for (String filteredConfig : getSBSv2ConfigurationsToFilter()) { - if (filteredConfig.compareTo(name) == 0) { + if (filteredConfig.compareTo(alias) == 0) { addConfig = false; break; } @@ -196,43 +203,25 @@ // only support configs that fall into something we can make a build context // out of. They must have a platform and a target. String targetString = null; - if (name.toLowerCase().endsWith("_udeb") || name.toLowerCase().endsWith("_deb")) { //$NON-NLS-1$ //$NON-NLS-2$ + String[] configTokens = alias.split("_"); // $//$NON-NLS-N$ + // We presume that aliases have the second token as the "target". + if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ targetString = ISymbianBuildContext.DEBUG_TARGET; - } else if (name.toLowerCase().endsWith("_urel") || name.toLowerCase().endsWith("_rel")) { //$NON-NLS-1$ //$NON-NLS-2$ + } else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ targetString = ISymbianBuildContext.RELEASE_TARGET; } if (targetString != null) { - String[] parts = name.split("_"); //$NON-NLS-1$ - if (parts.length == 2) { - SymbianBuildContext context = new SymbianBuildContext(sdk, parts[0].toUpperCase(), targetString); + + SymbianBuildContext context = null; + context = new SymbianBuildContext(sdk, basePlat, targetString, alias); + if (context != null) contexts.add(context); - } } } } - Collections.sort(contexts, new Comparator() { - - public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { - String platform1 = o1.getPlatformString(); - String platform2 = o2.getPlatformString(); - if (platform1.equals(platform2)) { - return o1.getTargetString().compareTo(o2.getTargetString()); - } else { - if (platform1.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { - return -1; - } - else if (platform2.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { - return 1; - } - } - return 0; - } - - }); - - return contexts; + return sortContexts(contexts); } /** @@ -259,7 +248,7 @@ NodeList children = root.getChildNodes(); for (int i=0; i< children.getLength(); i++) { - getConfigsForNode(children.item(i)); + getConfigsForNode(children.item(i), root); } } catch (Exception e) { @@ -268,27 +257,37 @@ } } - private static void getConfigsForNode(Node node) { + private static void getConfigsForNode(Node node, Node parentNode) { if (node.getNodeName().equals("config")) { //$NON-NLS-1$ Node abstractNode = node.getAttributes().getNamedItem("abstract"); //$NON-NLS-1$ + Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$ if (abstractNode == null || abstractNode.getNodeValue().equals("false")) { //$NON-NLS-1$ - Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$ if (namedNode != null) { + + // Get the parent base build platform + String baseBuildPlatform = null; + if (parentNode != null){ + baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue(); + } // only support configs that fall into something we can make a build context // out of. They must have a platform and a target. String configName = namedNode.getNodeValue(); - if (configName.toLowerCase().endsWith("_udeb") || configName.toLowerCase().endsWith("_deb") || //$NON-NLS-1$ //$NON-NLS-2$ - configName.toLowerCase().endsWith("_urel") || configName.toLowerCase().endsWith("_rel")) { //$NON-NLS-1$ //$NON-NLS-2$ - if (configName.split("_").length == 2) { //$NON-NLS-1$ - unfilteredSBSv2ConfigNames.add(configName); - } - } + String[] configTokens = configName.split("_"); + if (configTokens.length >= 2) { //$NON-NLS-1$ + String target = configTokens[1]; + if (target.endsWith("deb") || target.endsWith("rel")){ //$NON-NLS-1$ + if (baseBuildPlatform == null){ + baseBuildPlatform = "unknown"; + } + unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform); + } + } } } NodeList children = node.getChildNodes(); for (int i=0; i< children.getLength(); i++) { - getConfigsForNode(children.item(i)); + getConfigsForNode(children.item(i), node); } } } @@ -323,4 +322,89 @@ return sbsPath != null ? sbsPath : new Path(sbsScriptName); } + private static List sortContexts(List contexts){ + + // 3 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel) + + Collections.sort(contexts, new Comparator() { + + // First sort the target name (Debug / Release) and push Emulation to the top + public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { + String sbsAlias1 = o1.getSBSv2Alias(); + String sbsAlias2 = o2.getSBSv2Alias(); + + if (o1.getPlatformString().equals(o2.getPlatformString())) { + if (o1.getSBSv2Alias().split("_").length == 2 && o2.getSBSv2Alias().split("_").length == 2) + return o1.getTargetString().compareTo(o2.getTargetString()); + else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3) + return 1; + } else { + if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { + return -1; + }else if (sbsAlias2.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { + return 1; + } + } + return sbsAlias1.compareTo(sbsAlias2); + + } + + }); + + // Sort long alias names + Collections.sort(contexts, new Comparator() { + + public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { + String sbsAlias1 = o1.getSBSv2Alias(); + String sbsAlias2 = o2.getSBSv2Alias(); + + if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){ + String temp1[] = sbsAlias1.split("_"); + String temp2[] = sbsAlias2.split("_"); + String suffix1 = ""; + String suffix2 = ""; + for (int i = 2; i < temp1.length; i++){ + suffix1 += temp1[i] + "_"; + } + + for (int i = 2; i < temp2.length; i++){ + suffix2 += temp2[i] + "_"; + } + + return suffix1.compareTo(suffix2); + } + + return 0; + } + }); + + // Sort the target string for long aliases + Collections.sort(contexts, new Comparator() { + + public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { + String sbsAlias1 = o1.getSBSv2Alias(); + String sbsAlias2 = o2.getSBSv2Alias(); + String temp1[] = sbsAlias1.split("_"); + String temp2[] = sbsAlias2.split("_"); + String suffix1 = ""; + String suffix2 = ""; + for (int i = 2; i < temp1.length; i++){ + suffix1 += temp1[i] + "_"; + } + + for (int i = 2; i < temp2.length; i++){ + suffix2 += temp2[i] + "_"; + } + + if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && suffix1.equals(suffix2)){ + return o1.getTargetString().compareTo(o2.getTargetString()); + } + + return 0; + } + }); + + return contexts; + } + } diff -r 77fe575a3528 -r c2836b036bd5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Wed Mar 31 13:19:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Wed Mar 31 16:21:55 2010 -0500 @@ -13,16 +13,30 @@ package com.nokia.carbide.cpp.internal.api.sdk; import java.io.File; -import java.util.*; +import java.util.ArrayList; +import java.util.HashMap; +import java.util.LinkedHashMap; +import java.util.List; +import java.util.Map; +import java.util.Set; import org.eclipse.core.runtime.IPath; import org.osgi.framework.Version; import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultModelDocumentProvider; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultTranslationUnitProvider; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; -import com.nokia.carbide.cpp.sdk.core.*; +import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; +import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; +import com.nokia.carbide.cpp.sdk.core.ISBVPlatform; +import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.MacroScanner; @@ -32,6 +46,7 @@ private String platform; private String target; private String displayString = null; + private String sbsv2Alias = null; private static String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$ private static String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$ @@ -54,15 +69,22 @@ private List compilerPrefixMacros = new ArrayList(); private long compilerCacheTimestamp; + public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget, String theSBSv2Alias) { + sdkId = theSDK.getUniqueId(); + platform = thePlatform.toUpperCase(); + target = theTarget.toUpperCase(); + sbsv2Alias = theSBSv2Alias; + + getDisplayString(); + } public SymbianBuildContext(ISymbianSDK theSDK, String thePlatform, String theTarget) { sdkId = theSDK.getUniqueId(); - platform = thePlatform; - target = theTarget; + platform = thePlatform.toUpperCase(); + target = theTarget.toUpperCase(); getDisplayString(); } - @Override public int hashCode() { final int prime = 31; @@ -97,8 +119,11 @@ if (target == null) { if (other.target != null) return false; - } else if (!target.equals(other.target)) + } else if (!target.equals(other.target)) { return false; + } else if (sbsv2Alias!= null && !sbsv2Alias.equals(other.sbsv2Alias)) { + return false; + } return true; } @@ -114,11 +139,11 @@ } public String getPlatformString() { - return platform; + return platform.toUpperCase(); } public String getTargetString() { - return target; + return target.toUpperCase(); } public String getDisplayString() { @@ -137,7 +162,13 @@ displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT; } - displayString = displayString + " (" + platform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$ + String basePlatform; + if (sbsv2Alias != null) + basePlatform = sbsv2Alias; + else + basePlatform = platform; + + displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$ } return displayString; } @@ -151,15 +182,37 @@ sdk = SDKManagerInternalAPI.addMissingSdk(sdkId); } - return new SymbianBuildContext(sdk, getPlatformFromBuildConfigName(displayName), getTargetFromBuildConfigName(displayName)); + return new SymbianBuildContext(sdk, getPlatformFromBuildConfigName(displayName), + getTargetFromBuildConfigName(displayName), getSBSv2AliasFromConfigName(displayName)); } - return new SymbianBuildContext(fallbackForBadSdk, SDK_NOT_INSTALLED, SDK_NOT_INSTALLED); + return new SymbianBuildContext(fallbackForBadSdk, SDK_NOT_INSTALLED, SDK_NOT_INSTALLED); } - + /** + * See if the build configuration is an SBSv2 alias, and if so get the build-able alias name + * @param displayName + * @return The full SBSv2 alias that can be used with -c, otherwise null if not SBSv2 + */ + private static String getSBSv2AliasFromConfigName(String displayName) { + int indexBegin = displayName.indexOf("("); //$NON-NLS-1$ + int indexEnd = displayName.indexOf(")"); //$NON-NLS-1$ + if (indexBegin > 0 && indexEnd > 0){ + String configPart = displayName.substring(indexBegin+1, indexEnd); + if (configPart.split("_").length > 1){ + return configPart; + } + } + return null; + } private static String getPlatformFromBuildConfigName(String configName) { String[] tokens = configName.split(SPACE_DISPLAY_TEXT); String sdkIdToken = tokens[2]; - return sdkIdToken.substring(1, sdkIdToken.length()-1); + if (sdkIdToken.contains("_")){ + sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1); + String[] aliasTokens = sdkIdToken.split("_"); + return aliasTokens[0]; + } else { + return sdkIdToken.substring(1, sdkIdToken.length()-1); + } } public static String getSDKIDFromConfigName(String configName) { @@ -253,7 +306,8 @@ } public IPath getCompilerPrefixFile() { - if (platform.equals(GCCE_PLATFORM)) { + if (platform.equals(GCCE_PLATFORM) || + (sbsv2Alias != null && sbsv2Alias.toUpperCase().contains(GCCE_PLATFORM))) { return getGCCEPrefixFilePath(); } else if (platform.equals(ARMV5_PLATFORM) || platform.equals(ARMV5_ABIV2_PLATFORM) @@ -569,5 +623,15 @@ return plat; } + public String getSBSv2Alias() { + return sbsv2Alias; + } + public void setSBSv2Alias(String sbsv2Alias) { + this.sbsv2Alias = sbsv2Alias; + } + + public void setDisplayString(String newDisplayName) { + this.displayString = newDisplayName; + } } diff -r 77fe575a3528 -r c2836b036bd5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Wed Mar 31 13:19:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Wed Mar 31 16:21:55 2010 -0500 @@ -107,7 +107,6 @@ public SymbianSDK(DeviceType device) { deviceEntry = device; scanSDK(); - } public void scanSDK(){ @@ -1026,8 +1025,18 @@ if (line.startsWith(BUILD_INFO_KEYWORD)){ String[] versionTokens = line.split(" "); if (versionTokens.length == 3){ - int index = versionTokens[2].lastIndexOf("v"); - if (index > 0){ + + if (versionTokens[2].toUpperCase().startsWith("TB92SF") || versionTokens[2].toUpperCase().endsWith("TB92SF")){ + setOSVersion(new Version("9.5.0")); + setSDKVersion(new Version("5.2.0")); + break; + } else if (versionTokens[2].toUpperCase().startsWith("TB101SF") || versionTokens[2].toUpperCase().endsWith("TB101SF")){ + setOSVersion(new Version("9.6.0")); + setSDKVersion(new Version("6.0.0")); + break; + } + else if (versionTokens[2].lastIndexOf("v") > 0){ + int index = versionTokens[2].lastIndexOf("v"); String osVersionString = versionTokens[2].substring(index+1, versionTokens[2].length()); if (osVersionString.compareToIgnoreCase("tb91sf") == 0){ diff -r 77fe575a3528 -r c2836b036bd5 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Wed Mar 31 13:19:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java Wed Mar 31 16:21:55 2010 -0500 @@ -143,4 +143,15 @@ * @since 2.0 */ public boolean isSymbianBinaryVariation(); + + /** + * Retrieve the build-able configuration; a valid command that cab be passed with Raptor's -c parameter. + * This should not be used and should return null for abld-configurations. + * @return the configuration name, or null if none. + */ + public String getSBSv2Alias(); + + public void setSBSv2Alias(String newAlias); + + public void setDisplayString(String newDisplayName); } diff -r 77fe575a3528 -r c2836b036bd5 core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java --- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Mar 31 13:19:37 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Mar 31 16:21:55 2010 -0500 @@ -17,6 +17,7 @@ package com.nokia.carbide.cpp.internal.api.sdk.ui; import java.util.ArrayList; +import java.util.Collections; import java.util.List; import org.eclipse.jface.viewers.ArrayContentProvider; @@ -97,8 +98,13 @@ private void initTable(boolean refreshList) { - tableViewer.setInput(SBSv2Utils.getUnfilteredSBSv2BuildConfigurations(refreshList)); - + Object[] keySet = SBSv2Utils.getUnfilteredSBSv2BuildConfigurations(refreshList).keySet().toArray(); + List sbsAliases = new ArrayList(); + for (Object key : keySet) + sbsAliases.add((String)key); + Collections.sort(sbsAliases); + tableViewer.setInput(sbsAliases); + // check all configs tableViewer.setAllChecked(true);