Manually merge in changeset 501:c39dede7ad37 from default. RCL_2_2
authortimkelly
Mon, 21 Sep 2009 10:30:34 -0500
branchRCL_2_2
changeset 502 bbc19f0223db
parent 500 c5f00d93c283
child 503 a31863532fab
Manually merge in changeset 501:c39dede7ad37 from default.
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/MakeSisErrorParser.java
builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/MakeSisErrorParser.java	Thu Sep 17 15:23:01 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/error/parsers/MakeSisErrorParser.java	Mon Sep 21 10:30:34 2009 -0500
@@ -45,7 +45,7 @@
 		// OR
 		// (lineno) : Error: description
 		
-		if (   aLine.contains("makesis.exe ")) {
+		if (aLine.contains("makesis.exe ")) {
 			int packageStart = aLine.indexOf("makesis.exe ") + "makesis.exe ".length();
 			int packageEnd   = aLine.indexOf(' ', packageStart);
 			// store the name of the package file for cases above where
@@ -80,9 +80,9 @@
 		}
 		setDescription(aLine);
 		
-		if (aLine.contains(CarbideCPPBuilder.RESOLVED_PKG_PREFIX)){
-			aLine = aLine.replaceAll(CarbideCPPBuilder.RESOLVED_PKG_PREFIX, "");
-		}
+//		if (aLine.contains(CarbideCPPBuilder.RESOLVED_PKG_PREFIX)){
+//			aLine = aLine.replaceAll(CarbideCPPBuilder.RESOLVED_PKG_PREFIX, "");
+//		}
 		
 		if (!setFileNameAndLineNumber(aLine)) {
 			return false;
--- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java	Thu Sep 17 15:23:01 2009 -0500
+++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java	Mon Sep 21 10:30:34 2009 -0500
@@ -22,8 +22,12 @@
 import org.eclipse.core.resources.IFile;
 import org.eclipse.core.resources.IProject;
 import org.eclipse.jface.viewers.ISelection;
+import org.osgi.framework.Version;
 
 import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin;
+import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
+import com.nokia.carbide.cpp.sdk.core.ISDKManager;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 
 public class BuilderUtilsPropertyTester extends PropertyTester {
 	
@@ -60,10 +64,12 @@
 						return false;
 					}
 					
-					// disable for SBSv2 projects for now. see
-					// http://xdabug001.ext.nokia.com/bugzilla/show_bug.cgi?id=7659 for details.
 					if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(file.getProject())) {
-						return false;
+						Version sbsVers = SDKCorePlugin.getSDKManager().getSBSv2Version(false);
+						if (sbsVers.compareTo(SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version()) >= 0)
+							return true;
+						else
+							return false;
 					}
 				}
 				return true;
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Thu Sep 17 15:23:01 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Mon Sep 21 10:30:34 2009 -0500
@@ -12,41 +12,72 @@
 */
 package com.nokia.carbide.cpp.internal.sdk.core.model;
 
-import java.io.*;
-import java.net.*;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileWriter;
+import java.io.IOException;
+import java.io.InputStreamReader;
+import java.net.MalformedURLException;
+import java.net.URISyntaxException;
+import java.net.URL;
 import java.text.MessageFormat;
-import java.util.*;
+import java.util.ArrayList;
+import java.util.HashMap;
+import java.util.Iterator;
+import java.util.List;
 
-import javax.xml.parsers.*;
-import javax.xml.transform.*;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+import javax.xml.transform.Result;
+import javax.xml.transform.TransformerConfigurationException;
+import javax.xml.transform.TransformerException;
+import javax.xml.transform.TransformerFactory;
 import javax.xml.transform.dom.DOMSource;
 import javax.xml.transform.stream.StreamResult;
 
 import org.eclipse.cdt.utils.WindowsRegistry;
 import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.core.runtime.*;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Path;
+import org.eclipse.core.runtime.Platform;
+import org.eclipse.core.runtime.Status;
 import org.eclipse.emf.common.util.EList;
-import org.eclipse.jface.dialogs.ErrorDialog;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.osgi.service.datalocation.Location;
 import org.eclipse.swt.widgets.Shell;
 import org.eclipse.ui.IWorkbenchWindow;
 import org.eclipse.ui.PlatformUI;
 import org.osgi.framework.Version;
-import org.w3c.dom.*;
+import org.w3c.dom.Document;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
 import org.w3c.dom.traversal.NodeIterator;
 import org.xml.sax.SAXException;
 
-import com.nokia.carbide.cpp.internal.api.sdk.*;
+import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
+import com.nokia.carbide.cpp.internal.api.sdk.ICarbideDevicesXMLChangeListener;
+import com.nokia.carbide.cpp.internal.api.sdk.ISDKManagerInternal;
+import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
+import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore;
 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DeviceType;
 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType;
 import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader;
-import com.nokia.carbide.cpp.sdk.core.*;
+import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener;
+import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
+import com.nokia.carbide.cpp.sdk.core.ISDKManager;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.carbide.cpp.sdk.core.SDKEnvInfoFailureException;
 import com.nokia.carbide.cpp.sdk.core.ICarbideInstalledSDKChangeListener.SDKChangeEventType;
-import com.nokia.cpp.internal.api.utils.core.*;
+import com.nokia.cpp.internal.api.utils.core.FileUtils;
 import com.nokia.cpp.internal.api.utils.core.ListenerList;
+import com.nokia.cpp.internal.api.utils.core.Logging;
 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
 import com.sun.org.apache.xpath.internal.XPathAPI;
+import com.sun.org.apache.xpath.internal.operations.Minus;
 
 public class SDKManager implements ISDKManager, ISDKManagerInternal {
 	
@@ -75,6 +106,14 @@
 	private static SymbianMacroStore macroStore;
 	
 	private static final String[] knownRVCTVersions = {"3.1", "3.0", "2.2", "2.1"};
+	private Version sbsV2Version;
+	
+	/**
+	 * Minimum SBSv2 version supported with Carbide
+	 */
+	public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 8, 6);
+
+	
 	
 	static boolean hasPromptedForDevicesXML = false; // make sure we only ask once at startup if devices.xml does not exist
 	static boolean hasScannedSDKs = false; // make sure we only scan SDKs when needed
@@ -120,7 +159,9 @@
 		synchronized (sdkList)
 		{
 			ArrayList<ISymbianSDK> oldSDkList = new ArrayList<ISymbianSDK>(sdkList);
-
+			
+			getSBSv2Version(true);
+			
 			if (sdkList != null){
 				sdkList.clear();
 			}
@@ -666,7 +707,7 @@
 				// RVCT waits for like 4 minutes trying to find a license when the computer is
 				// not connected to the network.  in such cases, the call to br.readline doesn't
 				// return for 4 minutes which is unacceptable here.  Instead we'll poll at 1/2 second
-				// intervals for 40 seconds and see if we get a response. On the first reposon we break out
+				// intervals for 40 seconds and see if we get a response. On the first response we break out
 				// of the loop and read the output. So in most normal circumstances it will take 1/2 to 1 seconds.
 				int maxTries = 80;
 				int numTries = 0;
@@ -917,4 +958,64 @@
 	private void logError(String message, Throwable t) {
 		SDKCorePlugin.getDefault().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.getPluginId(), message, t));		
 	}
+
+	public Version getSBSv2Version(boolean forceScan) {
+		if (sbsV2Version == null || forceScan){
+			sbsV2Version = new Version(0, 0, 0);
+			
+			Runtime rt=Runtime.getRuntime();
+			try {
+				Process p = rt.exec("sbs.bat -v");
+				
+				BufferedReader br = new BufferedReader(new InputStreamReader(p.getInputStream()));
+				String overallOutput = null;
+				String stdErrLine = null;
+				while ((stdErrLine = br.readLine()) != null) {
+					overallOutput += stdErrLine;
+				}
+				
+				if (overallOutput != null) {
+				{
+					String[] tokens = overallOutput.split(" ");
+					if (tokens.length >= 3) {
+						if (tokens[2].split("\\.").length == 3) {
+							sbsV2Version = Version.parseVersion(tokens[2]);
+						}
+					}
+						if (sbsV2Version.compareTo(MINIMUM_RAPTOR_VERSION) < 0 && sbsV2Version.getMajor() > 0) {
+
+							String incorrectRaptorVersionStr = "SBSv2 version detected: "
+									+ sbsV2Version.toString()
+									+ ". The minimum version suggested for Carbide is: "
+									+ MINIMUM_RAPTOR_VERSION.getMajor()
+									+ "."
+									+ MINIMUM_RAPTOR_VERSION.getMinor()
+									+ "."
+									+ MINIMUM_RAPTOR_VERSION.getMicro();
+
+							ResourcesPlugin.getPlugin().getLog().log(
+									new Status(IStatus.WARNING,
+											SDKCorePlugin.PLUGIN_ID,
+											IStatus.WARNING,
+											incorrectRaptorVersionStr, null));
+						}
+					
+					p.destroy();
+				}
+			}
+			} catch (IOException e) {
+				e.printStackTrace();
+			}
+			
+			
+			
+		}
+		return sbsV2Version;
+	}
+
+	public Version getMinimumSupportedSBSv2Version() {
+		return MINIMUM_RAPTOR_VERSION;
+	}
+	
+	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java	Thu Sep 17 15:23:01 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKManager.java	Mon Sep 21 10:30:34 2009 -0500
@@ -15,13 +15,15 @@
 import java.io.File;
 import java.util.List;
 
+import org.osgi.framework.Version;
+
 import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
 import com.nokia.carbide.cpp.internal.api.sdk.SymbianMacroStore;
 
 /**
  * Interface to Symbian OS SDK's. Use this interface to get the list of all SDKs.
  * @see ISymianSDK
- *
+ * @noimplement This interface is not intended to be implemented by clients.
  */
 
 public interface ISDKManager {
@@ -43,7 +45,6 @@
 	 */
 	public static final String DEVICES_FILE_NAME = "devices.xml";
 
-	
 	/**
 	 * Scan devices.xml and build the SDK list. Call this routine clears
 	 * all current SDK entries.
@@ -176,4 +177,17 @@
 	 * @since 2.0
 	 */ 
 	public boolean checkDevicesXMLSynchronized();
+	
+	/**
+	 * Get the version of SBSv2 installed on the PATH.
+	 * @param boolean forceScan - forceScan even if version already determined.
+	 * @return A Verion object of the installed SBSv2 version. Version will be 0.0.0 if not found.
+	 */
+	public Version getSBSv2Version(boolean forceScan);
+	
+	/**
+	 * Retrieve the minimum supported version of SBSv2 for Carbide.c++
+	 * @return Version
+	 */
+	public Version getMinimumSupportedSBSv2Version();
 }