fix 12140. Only scan Raptor to try to repair configs with errors once per IDE session.
authortimkelly
Tue, 21 Sep 2010 09:13:39 -0500
changeset 2078 4f1f19efcb66
parent 2077 d930aa7f4428
child 2079 e2d158cf422d
fix 12140. Only scan Raptor to try to repair configs with errors once per IDE session.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java
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/api/sdk/sbsv2/SBSv2QueryUtils.java	Mon Sep 20 18:51:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java	Tue Sep 21 09:13:39 2010 -0500
@@ -143,18 +143,25 @@
 	}
 
 	@SuppressWarnings("unchecked")
+	/**
+	 * Adds build config info for a single Raptor build config in an SDK. If the config exists in the map it
+	 * will be overwritten
+	 */
 	public static void storeConfigQueryDataForSDK(ISymbianSDK sdk, String alias, SBSv2ConfigQueryData configQueryData) {
 		Map<String, SBSv2ConfigQueryData> configsMap = SDKCacheUtils.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0);
 		String key = (new SBSv2SDKKey(sdk)).toString() + "[" + alias + "]";
 
 		if (configsMap == null) {
 			configsMap = new HashMap<String, SBSv2ConfigQueryData>();
-		} else {
-			if (configsMap.get(key) != null) {
-				// configQueryData already exist in cache
-				return;
-			}
 		}
+		// Always add the config, b/c if there's an erro in the config we want to be able to update it
+		// when the IDE rescans at startup checking for Raptor config errors that were saved to the cache
+//		else {
+//			if (configsMap.get(key) != null) {
+//				// configQueryData already exist in cache
+//			//	return;
+//			}
+//		}
 
 		configsMap.put(key, configQueryData);
 		SDKCacheUtils.getCache().putCachedData(CONFIG_CACHE_KEY, (Serializable)configsMap, 0);		
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Mon Sep 20 18:51:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Tue Sep 21 09:13:39 2010 -0500
@@ -68,7 +68,7 @@
 
 	public List<ISymbianBuildContext> getAllBuildConfigurations() {
 		// This really only applies to SBSv1. We never return the full list of configs for SBSv2, only the filtered ones
-		return sortContexts(sbsv2FilteredContexts);
+		return getFilteredBuildConfigurations();
 	}
 
 	public void clearDataFromBuildCache(){
@@ -122,14 +122,11 @@
 			}
 		} 
 		
-		
-		
 		return sortContexts(sbsv2FilteredContexts);
 	}
 
 	private void initSBSv2BuildContextList(List<String> allowedConfigs) throws SBSv2MinimumVersionException {
 		List<String> filteredAliasList = new ArrayList<String>();
-		
 		for (String alias : aliasToMeaningMap.keySet()){
 			for (String checkedAlias : allowedConfigs){
 				if (checkedAlias.equalsIgnoreCase(alias)){
@@ -155,20 +152,28 @@
 
 		List<String> processedAliasList = new ArrayList<String>();
 		sbsv2FilteredContexts.clear();
+		// First check if we have scanned configs already this IDE session.
+		// We don't want to scan broken configs over and over
+		boolean isStartUpScan = !((SymbianSDK)sdk).hasScannedRaptor();
+		
 		for (String alias : filteredAliasList) {
 			SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
-			if (configQueryData != null && configQueryData.getConfigurationErrorMessage().trim().length() == 0) {
-				ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
-				sbsv2FilteredContexts.add(sbsv2Context);
-				processedAliasList.add(alias);
+			if (configQueryData != null) {
+				if (configQueryData.getConfigurationErrorMessage().trim().length() == 0 || isStartUpScan == false){
+					ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
+					sbsv2FilteredContexts.add(sbsv2Context);
+					processedAliasList.add(alias);
+				}
 			}
 		}
 
 		if (!processedAliasList.isEmpty()) {
-			filteredAliasList.removeAll(processedAliasList);
+			filteredAliasList.removeAll(processedAliasList); // Get the configs that had errors
 		}
 
 		if (!filteredAliasList.isEmpty()) {
+			// These configs have no data or had errors in them reported by Raptor
+			
 			String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, filteredAliasList);
 
 			for (String alias : filteredAliasList) {
@@ -189,6 +194,11 @@
 		}
 
 		checkWINSCWSupport();
+		if (!((SymbianSDK)sdk).hasScannedRaptor()){
+			((SymbianSDK)sdk).setScannedRaptor(true);
+			SBSv2QueryUtils.flushAllSBSv2Caches();
+		}
+		
 	}
 
 	private void checkWINSCWSupport() {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Mon Sep 20 18:51:12 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java	Tue Sep 21 09:13:39 2010 -0500
@@ -78,6 +78,8 @@
 	private Map<String, File> prefixFileMap = new HashMap<String, File>();
 	private Set<Object> sdkFeatures = new HashSet<Object>();
 
+	private boolean hasScannedRaptor;
+	
 	public SymbianSDK(DeviceType device) {
 		deviceEntry = device;
 		scanSDK();
@@ -628,5 +630,12 @@
 		return foundOSVersion;
 		
 	}
+	
+	public boolean hasScannedRaptor(){
+		return hasScannedRaptor;
+	}
 
+	void setScannedRaptor(boolean hasScannedRaptor){
+		this.hasScannedRaptor = hasScannedRaptor;
+	}
 }