bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
authortimkelly
Mon, 29 Mar 2010 15:56:12 -0500
changeset 1138 352c0236f181
parent 1137 ba4d2e64ac43
child 1139 6ab3b690a049
child 1142 1d7dae831144
bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java
core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/project/ICarbideProjectInfo.java	Mon Mar 29 15:56:12 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();
 }
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Mon Mar 29 15:56:12 2010 -0500
@@ -288,6 +288,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")){
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectInfo.java	Mon Mar 29 15:56:12 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<ICarbideBuildConfiguration> 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;
+	}
 }
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideProjectModifier.java	Mon Mar 29 15:56:12 2010 -0500
@@ -220,6 +220,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
@@ -318,6 +320,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) {
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java	Mon Mar 29 15:56:12 2010 -0500
@@ -502,6 +502,11 @@
 		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?
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/BuildSettingsUI.java	Mon Mar 29 15:56:12 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();
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideCPPProjectSettingsPage.java	Mon Mar 29 15:56:12 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<String> checkedComponents = getCheckedComponentFilenames();
@@ -328,6 +330,7 @@
         		buildSettingsUI.setOverrideDefaultMakeEngine(cpi.overrideMakeEngineProjectValue());
         		buildSettingsUI.setMakeEngineText(cpi.makeEngineProjectValue());
         		buildSettingsUI.setExtraSBSv2Args(cpi.extraSBSv2ArgsProjectValue());
+        		buildSettingsUI.setBuildAliasAppendText(cpi.buildAliasAppendTextValue());
     		}
     		
     		initMMPSelectionUI(cpi);
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties	Fri Mar 26 14:07:53 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/messages.properties	Mon Mar 29 15:56:12 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
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java	Mon Mar 29 15:56:12 2010 -0500
@@ -239,27 +239,7 @@
 			}
 		}
 		
-		Collections.sort(contexts, new Comparator<ISymbianBuildContext>() {
-
-			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);
 	}
 
 	/**
@@ -381,5 +361,90 @@
 		}
 		return sbsPath != null ? sbsPath : new Path(sbsScriptName);  // dummy
 	}
+	
+	private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> 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<ISymbianBuildContext>() {
+
+			// 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<ISymbianBuildContext>() {
+
+			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<ISymbianBuildContext>() {
+
+			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;
+	}
 
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Mon Mar 29 15:56:12 2010 -0500
@@ -109,7 +109,6 @@
 	public SymbianSDK(DeviceType device) {
 		deviceEntry = device;
 		scanSDK();
-		
 	}
 	
 	public void scanSDK(){
@@ -1042,8 +1041,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){
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Fri Mar 26 14:07:53 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java	Mon Mar 29 15:56:12 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).keySet());
-
+		Object[] keySet = SBSv2Utils.getUnfilteredSBSv2BuildConfigurations(refreshList).keySet().toArray();
+		List<String> sbsAliases = new ArrayList<String>();
+		for (Object key : keySet)
+			sbsAliases.add((String)key);
+		Collections.sort(sbsAliases);
+		tableViewer.setInput(sbsAliases);
+		
 		// check all configs
 		tableViewer.setAllChecked(true);