Make sure we're getting the correct set of macros for each SBSv2 build context. C3_BUILDER_WORK
authorstechong
Thu, 22 Jul 2010 15:45:27 -0500
branchC3_BUILDER_WORK
changeset 1669 d7359f2d2080
parent 1668 0d8b054f7f83
child 1670 f1324e4c3588
Make sure we're getting the correct set of macros for each SBSv2 build context.
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Thu Jul 22 15:40:20 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Thu Jul 22 15:45:27 2010 -0500
@@ -153,7 +153,7 @@
 	public List<IDefine> getCompilerMacros() {
 		IPath prefixFile = getCompilerPrefixFile();
 		if (prefixFile == null || !prefixFile.toFile().exists()) {
-			return Collections.emptyList();
+			return getCachedData().getCompilerMacros(null);
 		}
 		
 		return getCachedData().getCompilerMacros(prefixFile);
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Thu Jul 22 15:40:20 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Thu Jul 22 15:45:27 2010 -0500
@@ -87,7 +87,16 @@
 	 * @return
 	 */
 	private static String getBuildContextKey(ISymbianBuildContext context) {
-		String key = context.getPlatformString() + "/" + context.getTargetString() + "/";
+		String key;
+		if (context instanceof ISBSv2BuildContext) {
+			// use config ID instead of platform + target since
+			// platform and target can be the same for different build contexts
+			ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
+			key = v2Context.getConfigID() + "/";
+		}
+		else {
+			key = context.getPlatformString() + "/" + context.getTargetString() + "/";
+		}
 		ISymbianSDK sdk = context.getSDK();
 		if (sdk != null)
 			key += sdk.getEPOCROOT();
@@ -285,7 +294,8 @@
 		// we assume that the prefix file will not change often,
 		// (if at all) for a build context, so dump the cache if the prefix file changes.
 		
-		if (compilerPrefixFile != null && !compilerPrefixFile.equals(prefixFile)) {
+		if (compilerPrefixFile != null && prefixFile != null && 
+			!compilerPrefixFile.equals(prefixFile)) {
 			compilerPrefixFileInfo = null;
 		}
 		
@@ -342,12 +352,15 @@
 				if (context instanceof ISBSv2BuildContext) {
 					// add macros from raptor query
 					ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
-					Map<String, String> buildMacros = v2Context.getConfigQueryData().getBuildMacros();
-					if (buildMacros != null) {
-						for (Iterator<String> itr = buildMacros.keySet().iterator(); itr.hasNext(); ) { 
-							String name = itr.next();
-							String value = buildMacros.get(name);
-							macros.add(DefineFactory.createDefine(name, value));
+					ISBSv2ConfigQueryData configData = v2Context.getConfigQueryData();
+					if (configData != null) {
+						Map<String, String> buildMacros = configData.getBuildMacros();
+						if (buildMacros != null) {
+							for (Iterator<String> itr = buildMacros.keySet().iterator(); itr.hasNext(); ) { 
+								String name = itr.next();
+								String value = buildMacros.get(name);
+								macros.add(DefineFactory.createDefine(name, value));
+							}
 						}
 					}
 				}