core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java
branchC3_BUILDER_WORK
changeset 1669 d7359f2d2080
parent 1659 48d0d704d5e6
child 1736 ba74c19c6de3
equal deleted inserted replaced
1668:0d8b054f7f83 1669:d7359f2d2080
    85 	/**
    85 	/**
    86 	 * @param context
    86 	 * @param context
    87 	 * @return
    87 	 * @return
    88 	 */
    88 	 */
    89 	private static String getBuildContextKey(ISymbianBuildContext context) {
    89 	private static String getBuildContextKey(ISymbianBuildContext context) {
    90 		String key = context.getPlatformString() + "/" + context.getTargetString() + "/";
    90 		String key;
       
    91 		if (context instanceof ISBSv2BuildContext) {
       
    92 			// use config ID instead of platform + target since
       
    93 			// platform and target can be the same for different build contexts
       
    94 			ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
       
    95 			key = v2Context.getConfigID() + "/";
       
    96 		}
       
    97 		else {
       
    98 			key = context.getPlatformString() + "/" + context.getTargetString() + "/";
       
    99 		}
    91 		ISymbianSDK sdk = context.getSDK();
   100 		ISymbianSDK sdk = context.getSDK();
    92 		if (sdk != null)
   101 		if (sdk != null)
    93 			key += sdk.getEPOCROOT();
   102 			key += sdk.getEPOCROOT();
    94 		return key;
   103 		return key;
    95 	}
   104 	}
   283 	public synchronized List<IDefine> getCompilerMacros(IPath prefixFile) {
   292 	public synchronized List<IDefine> getCompilerMacros(IPath prefixFile) {
   284 		
   293 		
   285 		// we assume that the prefix file will not change often,
   294 		// we assume that the prefix file will not change often,
   286 		// (if at all) for a build context, so dump the cache if the prefix file changes.
   295 		// (if at all) for a build context, so dump the cache if the prefix file changes.
   287 		
   296 		
   288 		if (compilerPrefixFile != null && !compilerPrefixFile.equals(prefixFile)) {
   297 		if (compilerPrefixFile != null && prefixFile != null && 
       
   298 			!compilerPrefixFile.equals(prefixFile)) {
   289 			compilerPrefixFileInfo = null;
   299 			compilerPrefixFileInfo = null;
   290 		}
   300 		}
   291 		
   301 		
   292 		compilerPrefixFile = prefixFile;
   302 		compilerPrefixFile = prefixFile;
   293 
   303 
   340 				}
   350 				}
   341 				
   351 				
   342 				if (context instanceof ISBSv2BuildContext) {
   352 				if (context instanceof ISBSv2BuildContext) {
   343 					// add macros from raptor query
   353 					// add macros from raptor query
   344 					ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
   354 					ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
   345 					Map<String, String> buildMacros = v2Context.getConfigQueryData().getBuildMacros();
   355 					ISBSv2ConfigQueryData configData = v2Context.getConfigQueryData();
   346 					if (buildMacros != null) {
   356 					if (configData != null) {
   347 						for (Iterator<String> itr = buildMacros.keySet().iterator(); itr.hasNext(); ) { 
   357 						Map<String, String> buildMacros = configData.getBuildMacros();
   348 							String name = itr.next();
   358 						if (buildMacros != null) {
   349 							String value = buildMacros.get(name);
   359 							for (Iterator<String> itr = buildMacros.keySet().iterator(); itr.hasNext(); ) { 
   350 							macros.add(DefineFactory.createDefine(name, value));
   360 								String name = itr.next();
       
   361 								String value = buildMacros.get(name);
       
   362 								macros.add(DefineFactory.createDefine(name, value));
       
   363 							}
   351 						}
   364 						}
   352 					}
   365 					}
   353 				}
   366 				}
   354 
   367 
   355 				compilerPrefixMacros = macros;
   368 				compilerPrefixMacros = macros;