Add exception handling (SBSv2MinimumVersionException) before trying to query raptor for config info. Min Raptor version is 2.15
--- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java Wed Jun 16 15:43:22 2010 -0500
+++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/BuilderUtilsPropertyTester.java Wed Jun 16 16:53:22 2010 -0500
@@ -61,14 +61,6 @@
if (!CarbideBuilderPlugin.getBuildManager().isCarbideProject(file.getProject())) {
return false;
}
-
- if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(file.getProject())) {
- 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/api/sdk/BuildContextSBSv2.java Wed Jun 16 15:43:22 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Wed Jun 16 16:53:22 2010 -0500
@@ -67,7 +67,7 @@
if (configParseErrorMessage != null && configParseErrorMessage.length() > 0){
this.displayString = sbsv2Alias + " ERROR: " + configParseErrorMessage;
} else {
- this.displayString = getPlatformString().toUpperCase() + " " + getTargetString().toUpperCase();
+ this.displayString = sbsv2Alias + " [" + sdk.getUniqueId() + "]";
}
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2MinimumVersionException.java Wed Jun 16 16:53:22 2010 -0500
@@ -0,0 +1,38 @@
+/*
+* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies).
+* All rights reserved.
+* This component and the accompanying materials are made available
+* under the terms of the License "Eclipse Public License v1.0"
+* which accompanies this distribution, and is available
+* at the URL "http://www.eclipse.org/legal/epl-v10.html".
+*
+* Initial Contributors:
+* Nokia Corporation - initial contribution.
+*
+*/
+package com.nokia.carbide.cpp.internal.api.sdk.sbsv2;
+
+/**
+ * Exception thrown in case something fails when trying
+ * find out facts about current SDK/Platform environment tools.
+ */
+public class SBSv2MinimumVersionException extends Exception {
+
+ static final long serialVersionUID = -6103977959623981590L;
+
+ /**
+ * Default constructor.
+ */
+ public SBSv2MinimumVersionException(){
+ super();
+ }
+
+ /**
+ * Constructor with attached message.
+ * @param message Informative message about situation causing the exception.
+ */
+ public SBSv2MinimumVersionException(String message){
+ super(message);
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Wed Jun 16 15:43:22 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Wed Jun 16 16:53:22 2010 -0500
@@ -36,6 +36,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
+import org.osgi.framework.Version;
import org.w3c.dom.Element;
import org.w3c.dom.NamedNodeMap;
import org.w3c.dom.Node;
@@ -54,7 +55,10 @@
public static final String QUERY_CONFIG_COMMAND = "--query=config";
public static final String QUERY_COMMAND = "--query=aliases";
- public static HashMap<String, String> getAliasesForSDK(ISymbianSDK sdk){
+ public static HashMap<String, String> getAliasesForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException{
+
+ checkForMinimumRaptorVersion();
+
List<String> argListAliasQuery = new ArrayList<String>();
argListAliasQuery.add(QUERY_COMMAND);
@@ -70,7 +74,10 @@
return parseQueryAliasResult(queryResult);
}
- public static List<String> getProductVariantsForSDK(ISymbianSDK sdk){
+ public static List<String> getProductVariantsForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException{
+
+ checkForMinimumRaptorVersion();
+
List<String> argListProductQuery = new ArrayList<String>();
Properties envVars = EnvironmentReader.getEnvVars();
@@ -85,7 +92,9 @@
return parseQueryProductsResults(queryResult);
}
- public static String getConfigQueryXML(ISymbianSDK sdk, List<String> aliasOrMeaningArray){
+ public static String getConfigQueryXML(ISymbianSDK sdk, List<String> aliasOrMeaningArray) throws SBSv2MinimumVersionException{
+
+ checkForMinimumRaptorVersion();
List<String> argListConfigQuery = new ArrayList<String>();
@@ -105,7 +114,9 @@
}
- public static HashMap<String, String> queryConfigTargetInfo(ISymbianSDK sdk, List<String> aliasOrMeaningArray){
+ public static HashMap<String, String> queryConfigTargetInfo(ISymbianSDK sdk, List<String> aliasOrMeaningArray) throws SBSv2MinimumVersionException{
+
+ checkForMinimumRaptorVersion();
List<String> argListConfigQuery = new ArrayList<String>();
@@ -298,7 +309,10 @@
return productList;
}
- public static ISBSv2QueryData queryFilteredConfigsForSDK(ISymbianSDK sdk) {
+ public static ISBSv2QueryData queryFilteredConfigsForSDK(ISymbianSDK sdk) throws SBSv2MinimumVersionException {
+
+ checkForMinimumRaptorVersion();
+
List<String> argListConfigQuery = new ArrayList<String>();
argListConfigQuery.add(QUERY_COMMAND);
SBSv2QueryData sbsQueryData = new SBSv2QueryData();
@@ -333,7 +347,15 @@
return sbsQueryData;
}
-
+ private static boolean checkForMinimumRaptorVersion() throws SBSv2MinimumVersionException{
+ Version sbsVers = SDKCorePlugin.getSDKManager().getSBSv2Version(false);
+ if (sbsVers.compareTo(SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version()) >= 0)
+ return true;
+ else {
+ String message = "Raptor/SBSv2 minimum version supported in Carbide.c++ is " + SDKCorePlugin.getSDKManager().getMinimumSupportedSBSv2Version() + ". Your sbs version is " + sbsVers + ". Please update your sbs installation.";
+ throw new SBSv2MinimumVersionException(message);
+ }
+ }
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Jun 16 15:43:22 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Jun 16 16:53:22 2010 -0500
@@ -111,7 +111,7 @@
/**
* Minimum SBSv2 version supported with Carbide
*/
- public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 8, 6);
+ public static final Version MINIMUM_RAPTOR_VERSION = new Version(2, 15, 0);
static boolean hasScannedSDKs = false; // make sure we only scan SDKs when needed
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Wed Jun 16 15:43:22 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Wed Jun 16 16:53:22 2010 -0500
@@ -17,6 +17,7 @@
import java.io.FileReader;
import java.io.IOException;
import java.io.Reader;
+import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
@@ -24,17 +25,20 @@
import java.util.regex.Matcher;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2;
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
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.cpp.internal.api.utils.core.Logging;
import com.nokia.cpp.internal.api.utils.core.PathUtils;
/**
@@ -70,12 +74,22 @@
public List<ISymbianBuildContext> getFilteredBuildConfigurations() {
if (aliasToMeaningMap.size() == 0)
- aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+ try {
+ aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+ } catch (SBSv2MinimumVersionException e) {
+ Logging.log( SDKCorePlugin.getDefault(),
+ Logging.newSimpleStatus(0, IStatus.ERROR,
+ MessageFormat.format(e.getMessage(), ""), e));
+ }
List<String> allowedConfigs = SBSv2Utils.getSBSv2FilteredConfigPreferences(); // From global prefs
if ((sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0)
&& SBSv2Utils.enableSBSv2Support()){
-
+
+ //////// TODO Refactor this block to sub routine
+ // First time to be scanned so create a new list based on what we allow
+ // from the global prefs
+
// if (!(new File(sdk.getEPOCROOT()).exists())){
// return sbsv2FilteredConetxts;
// }
@@ -91,15 +105,23 @@
}
}
- String configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, filteredAliasList);
+ String configQueryXML;
+ try {
+ configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, filteredAliasList);
- for (String alias : filteredAliasList){
- ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, aliasToMeaningMap.get(alias), configQueryXML);
- sbsv2FilteredConetxts.add(sbsv2Context);
+ for (String alias : filteredAliasList){
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, aliasToMeaningMap.get(alias), configQueryXML);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ }
+ } catch (SBSv2MinimumVersionException e) {
+ // ignore, previous exception would have caught the error
}
} else if (SBSv2Utils.enableSBSv2Support()){
+ // TODO: Refactor to subroutine
+ //////////////////////////////////////////////////////
// Check and see if the filtered list has changed
+ //////////////////////////////////////////////////////
boolean contextExists = false;
List<String> newContextsToQuery = new ArrayList<String>();
for (String aliasName : allowedConfigs){
@@ -116,7 +138,12 @@
contextExists = false;
}
- String configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, newContextsToQuery);
+ String configQueryXML = "";
+ try {
+ configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, newContextsToQuery);
+ } catch (SBSv2MinimumVersionException e) {
+ // ignore, previous exception would have caught the error
+ }
for (String alias : newContextsToQuery){
if (aliasToMeaningMap.get(alias) == null){
continue; // This alias is not valid with this SDK, ignore
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jun 16 15:43:22 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jun 16 16:53:22 2010 -0500
@@ -21,6 +21,7 @@
import java.util.HashMap;
import java.util.List;
+import org.eclipse.jface.dialogs.MessageDialog;
import org.eclipse.jface.viewers.ArrayContentProvider;
import org.eclipse.jface.viewers.CheckboxTableViewer;
import org.eclipse.jface.viewers.LabelProvider;
@@ -35,6 +36,7 @@
import org.eclipse.swt.widgets.TableItem;
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
@@ -103,7 +105,12 @@
SBSv2Utils.initDefaultConfigsToFilter();
// TODO: Aliases need to be the union of all SDKs
- HashMap<String, String> aliasMap = SBSv2QueryUtils.getAliasesForSDK(null);
+ HashMap<String, String> aliasMap = new HashMap<String, String>();
+ try {
+ aliasMap = SBSv2QueryUtils.getAliasesForSDK(null);
+ } catch (SBSv2MinimumVersionException e) {
+ MessageDialog.openError(getShell(), "Minimum sbs version not met.", e.getMessage());
+ }
List<String> sbsAliases = new ArrayList<String>();
for (String key : aliasMap.keySet())
sbsAliases.add(key);