refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file. C3_BUILDER_WORK
authortimkelly
Tue, 10 Aug 2010 19:07:16 -0500
branchC3_BUILDER_WORK
changeset 1801 1d73a4591cf8
parent 1800 2e59aa939b8f
child 1802 7e50573a0115
refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file. Removed start-up checks for Perl version.
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java
builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java
core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java
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/ISBSv1BuildContext.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.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/ISDKBuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Tue Aug 10 19:07:16 2010 -0500
@@ -418,15 +418,8 @@
 				defaultContext = context;
 				ISymbianSDK sdk = defaultContext.getSDK();
 				
-				if (context instanceof ISBSv1BuildContext){
-					ISDKBuildInfo sdkBuildInfo = sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-					if (sdkBuildInfo.getPrefixFromVariantCfg() != null)
-						break;
-				} else {
-					ISDKBuildInfo sdkBuildInfo = sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);;
-					if (sdkBuildInfo.getPrefixFromVariantCfg() != null)
-						break;
-				}
+				if (context.getPrefixFromVariantCfg() != null)
+					break;
 			}
 		}
 		final ISymbianBuildContext defaultContextToUse = defaultContext;
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Tue Aug 10 19:07:16 2010 -0500
@@ -162,7 +162,7 @@
 				macros.add(new CMacroEntry(define.getNameAndArguments(), define.getExpansion(), 0));
 			}
 
-			for (IDefine define : carbideBuildConfig.getBuildContext().getCompilerMacros()) {
+			for (IDefine define : carbideBuildConfig.getBuildContext().getCompilerPreincludeDefines()) {
 				macros.add(new CMacroEntry(define.getNameAndArguments(), define.getExpansion(), 0));
 			}
 			
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Tue Aug 10 19:07:16 2010 -0500
@@ -2319,13 +2319,12 @@
 			}
 			
 			// we need to check the variant hrh files as well
-			ISDKBuildInfo sdkBuildInfo = config.getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-			File prefixFile = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+			File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile();
 			if (prefixFile != null && prefixFile.lastModified() > oldestMakefileTimestamp) {
 				return true;
 			}
 
-			for (File file : config.getBuildContext().getPrefixFileIncludes()) {
+			for (File file : config.getBuildContext().getVariantHRHIncludes()) {
 				if (file.lastModified() > oldestMakefileTimestamp) {
 					return true;
 				}
@@ -2441,13 +2440,12 @@
 		final long makefileTimestamp = makefile.lastModified();
 		
 		// we need to check the variant hrh files as well
-		ISDKBuildInfo sdkBuildInfo = config.getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-		File prefixFile = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+		File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile();
 		if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) {
 			return true;
 		}
 
-		for (File file : config.getBuildContext().getPrefixFileIncludes()) {
+		for (File file : config.getBuildContext().getVariantHRHIncludes()) {
 			if (file.lastModified() > makefileTimestamp) {
 				return true;
 			}
@@ -2525,13 +2523,12 @@
 		final long makefileTimestamp = makefile.lastModified();
 		
 		// we need to check the variant hrh files as well
-		ISDKBuildInfo sdkBuildInfo = config.getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-		File prefixFile = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+		File prefixFile = config.getBuildContext().getPrefixFromVariantCfg().toFile();
 		if (prefixFile != null && prefixFile.lastModified() > makefileTimestamp) {
 			return true;
 		}
 		
-		for (File file : config.getBuildContext().getPrefixFileIncludes()) {
+		for (File file : config.getBuildContext().getVariantHRHIncludes()) {
 			if (file.lastModified() > makefileTimestamp) {
 				return true;
 			}
@@ -2899,8 +2896,7 @@
 				ISymbianSDK sdk = config.getSDK();
 				ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
 				ISBVPlatform sbvPlatform = sbsv1BuildInfo.getSBVCatalog().findPlatform(config.getPlatformString());
-				ISDKBuildInfo sdkBuildInfo = config.getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-				File sdkPrefix = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+				File sdkPrefix = config.getBuildContext().getPrefixFromVariantCfg().toFile();
 
 				if (sbvPlatform != null){
 					// might be an alternate HRH file to use
@@ -2914,7 +2910,6 @@
 					newRule = newRule + "-include \"" + sdkPrefix.getAbsolutePath() + "\" "; 
 				}
 
-				
 				newRule += " -o " + depFilePath + view.getEOL();
 				
 				// for some reason cpp.exe doesn't like paths without the drive letter when working on a subst'ed drive.
--- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java	Tue Aug 10 19:07:16 2010 -0500
@@ -203,14 +203,7 @@
 							}
 
 							// add the sdk prefix file if any
-							File sdkPrefix = null;
-							if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) {
-								ISDKBuildInfo sdkBuildInfo = buildConfig.getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);;
-								sdkPrefix = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
-							} else {
-								ISDKBuildInfo sdkBuildInfo = buildConfig.getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);;
-								sdkPrefix = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
-							}
+							File sdkPrefix = buildConfig.getBuildContext().getPrefixFromVariantCfg().toFile();
 							
 							if (sdkPrefix != null && sdkPrefix.exists()) {
 								args.add("-include"); //$NON-NLS-1$
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java	Tue Aug 10 19:07:16 2010 -0500
@@ -77,14 +77,14 @@
 		assertNotNull(context.getVariantHRHDefines());
 
 		// getPrefixFileIncludes()
-		assertNotNull(context.getPrefixFileIncludes());
-		for (Iterator<File> itr = context.getPrefixFileIncludes().iterator(); itr.hasNext();) {
+		assertNotNull(context.getVariantHRHIncludes());
+		for (Iterator<File> itr = context.getVariantHRHIncludes().iterator(); itr.hasNext();) {
 			File includeFile = itr.next();
 			assertTrue(includeFile.exists());
 		}
 
 		// getCompilerMacros()
-		assertNotNull(context.getCompilerMacros());		
+		assertNotNull(context.getCompilerPreincludeDefines());		
 
 		// getToolChain()
 		String toolChain = context.getToolChain();
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java	Tue Aug 10 19:07:16 2010 -0500
@@ -13,11 +13,18 @@
 package com.nokia.carbide.cpp.internal.api.sdk;
 
 import java.io.File;
+import java.io.FileReader;
+import java.io.IOException;
+import java.io.Reader;
+import java.util.ArrayList;
 import java.util.Collections;
 import java.util.List;
+import java.util.regex.Matcher;
+import java.util.regex.Pattern;
 
 import org.eclipse.cdt.core.settings.model.ICStorageElement;
 import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
 import org.osgi.framework.Version;
 
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
@@ -33,6 +40,7 @@
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.cpp.internal.api.utils.core.PathUtils;
 
 public class BuildContextSBSv1 implements ISBSv1BuildContext {
 
@@ -55,6 +63,14 @@
 	protected BuildArgumentsInfo buildArgumentsInfo;
 	protected final static String ARGUMENTS_DATA_ID = "ARGUMENTS_DATA_ID"; //$NON-NLS-1$
 	
+	// --> variant.cfg info
+	// greedy match means the filename is in the last group
+	public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)");
+	private IPath variantFilePath;
+	public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$
+	public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$
+	// <--
+	
 	public BuildContextSBSv1(ISymbianSDK theSDK, String thePlatform, String theTarget) {
 		sdkId = theSDK.getUniqueId();
 		platform = thePlatform.toUpperCase();
@@ -348,12 +364,12 @@
 		return getCachedData().getVariantHRHDefines();
 	}
 
-	public List<File> getPrefixFileIncludes() {
+	public List<File> getVariantHRHIncludes() {
 		return getCachedData().getPrefixFileIncludes();
 	}
 
 
-	public List<IDefine> getCompilerMacros() {
+	public List<IDefine> getCompilerPreincludeDefines() {
 		// we parse the compiler prefix file to gather macros.  this can be time consuming so do it
 		// once and cache the values.  only reset the cache when the compiler prefix has changed.
 		
@@ -377,14 +393,13 @@
 		return varName;
 	}
 
-
-	public boolean isSymbianBinaryVariation() {
-		if (getPlatformString().split("\\.").length == 2){
-			return true;
-		} else {
-			return false;
-		}
-	}
+//	public boolean isSymbianBinaryVariation() {
+//		if (getPlatformString().split("\\.").length == 2){
+//			return true;
+//		} else {
+//			return false;
+//		}
+//	}
 
 	/**
 	 * Get the cache holding the data that applies to this build context globally.
@@ -564,5 +579,97 @@
 	public String getConfigurationID() {
 		return getDisplayString();
 	}
+	
+	/**
+	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
+	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
+	 */
+	public IPath getPrefixFromVariantCfg(){
+		
+		if (variantFilePath != null){
+			return variantFilePath;
+		}
+		
+		File epocRoot = new File(getSDK().getEPOCROOT());
+		File variantCfg;
+		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
+		if (!variantCfg.exists()) {
+			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
+			if (!variantCfg.exists())
+				return null;
+		}
+		
+		String variantDir = null;
+		String variantFile = null;
+		try {
+			char[] cbuf = new char[(int) variantCfg.length()];
+			Reader reader = new FileReader(variantCfg);
+			reader.read(cbuf);
+			reader.close();
+			String[] lines = new String(cbuf).split("\r\n|\r|\n");
+			for (int i = 0; i < lines.length; i++) {
+				// skip comments and blank lines
+				String line = SymbianSDK.removeComments(lines[i]);
+				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
+					continue;
+				
+				// parse the variant line, which is an EPOCROOT-relative
+				// path to a bldvariant.hrh file
+				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
+				if (matcher.matches()) {
+					variantDir = matcher.group(1);
+					variantFile = matcher.group(3); 
+					File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile);
+					variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath()));
+					return variantFilePath;
+				}
+			}
+		} catch (IOException e) {
+		}
+		
+		return null; // can't find the file...
+	}
+	
+	@SuppressWarnings("unchecked")
+	public List<String> getVariantCFGMacros(){
+		
+		List<String> variantCFGMacros = new ArrayList<String>();
+		File epocRoot = new File(getSDK().getEPOCROOT());
+		File variantCfg;
+		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
+		if (!variantCfg.exists()) {
+			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
+			if (!variantCfg.exists())
+				return Collections.EMPTY_LIST;
+		}
+		
+		try {
+			char[] cbuf = new char[(int) variantCfg.length()];
+			Reader reader = new FileReader(variantCfg);
+			reader.read(cbuf);
+			reader.close();
+			String[] lines = new String(cbuf).split("\r\n|\r|\n");
+			for (int i = 0; i < lines.length; i++) {
+				// skip comments and blank lines
+				String line = SymbianSDK.removeComments(lines[i]);
+				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
+					continue;
+				
+				// parse the variant line, which is an EPOCROOT-relative
+				// path to a bldvariant.hrh file
+				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
+				if (matcher.matches()) {
+					continue; // Skip this it's the file
+				} else {
+					// all other patterns are assumed to be macro
+					variantCFGMacros.add(line.trim());
+				}
+			}
+		} catch (IOException e) {
+		}
+		
+		return variantCFGMacros;
+	}
+	
 
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Tue Aug 10 19:07:16 2010 -0500
@@ -20,6 +20,7 @@
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
 import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 import com.nokia.cpp.internal.api.utils.core.Check;
@@ -41,6 +42,8 @@
 	// cconfiguration data store
 	private SBSv2BuilderInfo sbsv2BuildInfo;
 	
+	private IPath cachedVariantHRHFile = null;
+	
 	public BuildContextSBSv2(ISymbianSDK sdk, String platform, String target, String alias, String displayString, String configID) {
 		this.sdk = sdk;
 		if (platform == null){
@@ -157,12 +160,12 @@
 	}
 
 	@Override
-	public List<File> getPrefixFileIncludes() {
+	public List<File> getVariantHRHIncludes() {
 		return getCachedData().getPrefixFileIncludes();
 	}
 
 	@Override
-	public List<IDefine> getCompilerMacros() {
+	public List<IDefine> getCompilerPreincludeDefines() {
 		IPath prefixFile = getCompilerPrefixFile();
 		if (prefixFile == null || !prefixFile.toFile().exists()) {
 			return getCachedData().getCompilerMacros(null);
@@ -176,13 +179,6 @@
 		// Not needed for Raptor
 		return "";
 	}
-
-	@Override
-	public boolean isSymbianBinaryVariation() {
-		// Not be needed for Raptor. We do check
-		// in the MPP for the featurevariant keyword
-		return false;
-	}
 	
 	@Override
 	public String getSBSv2Alias() {
@@ -401,6 +397,16 @@
 	public String getConfigurationID() {
 		return getConfigID();
 	}
+	
+	/**
+	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
+	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
+	 */
+	public IPath getPrefixFromVariantCfg(){
+		ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER));
+		return sbsv2BldInfo.getPrefixFromVariantCfg();
+	}
+
 
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildContext.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildContext.java	Tue Aug 10 19:07:16 2010 -0500
@@ -1,5 +1,7 @@
 package com.nokia.carbide.cpp.internal.api.sdk;
 
+import java.util.List;
+
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
 
 /**
@@ -52,5 +54,12 @@
 	 */
 	void setBuildArgumentsInfo(BuildArgumentsInfo bldArgInfo);
 	
+	/**
+	* Returns a list of the macros defined in the variant.cfg file. This is NOT the macros
+	* in the HRH file, but the actual maros written to the variant.cfg file.
+	* @return A String list of macros found as is, or an empty list if none.
+	*/
+	public List<String> getVariantCFGMacros();
+	
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Tue Aug 10 19:07:16 2010 -0500
@@ -94,13 +94,5 @@
 	 * @return A list of targettype names that can be used in an MMP file
 	 */
 	List<String> getSupportedTargetTypes();
-
-	
-	/**
-	 * Returns a list of the macros defined in the variant.cfg file. This is NOT the macros
-	 * in the HRH file, but the actual maros written to the variant.cfg file.
-	 * @return A String list of macros found as is, or an empty list if none.
-	 */
-	List<String> getVariantCFGMacros();
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java	Tue Aug 10 19:07:16 2010 -0500
@@ -188,14 +188,13 @@
 			List<IDefine> macros = new ArrayList<IDefine>();
 			Map<String, IDefine> namedMacros = new HashMap<String, IDefine>();
 			
-			ISDKBuildInfo sdkBuildInfo = sdk.getBuildInfo(builderId);
-			File prefixFile = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+			File prefixFile = context.getPrefixFromVariantCfg().toFile();
 			ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId);
 			
 			if (prefixFile == null){
 				// Check that the prefix file may have become available since the SDK was scanned last.
 				// This can happen, for e.g., if the user opens the IDE _then_ does a subst on a drive that already has an SDK entry.
-				IPath prefixCheck = buildInfo.getPrefixFromVariantCfg();
+				IPath prefixCheck = context.getPrefixFromVariantCfg();
 				if (prefixCheck != null){
 					prefixFile = prefixCheck.toFile();
 					((SymbianSDK)sdk).setPrefixFile(prefixCheck, builderId);
@@ -261,9 +260,7 @@
 				
 				if (buildInfo instanceof ISBSv1BuildInfo) {
 					// SBSv2 does not parse the variant.cfg file to collect macros.
-					List<String> variantCFGMacros = new ArrayList<String>();
-					
-					variantCFGMacros = ((ISBSv1BuildInfo)buildInfo).getVariantCFGMacros();
+					List<String> variantCFGMacros = ((ISBSv1BuildContext)context).getVariantCFGMacros();
 					for (String cfgMacros : variantCFGMacros){
 						// we don't want duplicate macros, so check to see if it's already there.
 						IDefine existingMacro = namedMacros.get(cfgMacros);
@@ -476,8 +473,7 @@
 		}
 		
 		// also search files in same folder as variant.hrh
-		ISDKBuildInfo sdkBuildInfo = sdk.getBuildInfo(builderId);
-		File prefix = sdkBuildInfo.getPrefixFromVariantCfg().toFile();
+		File prefix = context.getPrefixFromVariantCfg().toFile();
 		if (sbvPlatform != null){
 			// might be an alternate HRH file to use
 			IPath varVarHRH = sbvPlatform.getBuildVariantHRHFile();
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Tue Aug 10 19:07:16 2010 -0500
@@ -24,11 +24,6 @@
 import java.util.List;
 import java.util.Map;
 import java.util.Set;
-import java.util.regex.Matcher;
-import java.util.regex.Pattern;
-
-import org.eclipse.core.runtime.IPath;
-import org.eclipse.core.runtime.Path;
 
 import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1;
 import com.nokia.carbide.cpp.internal.api.sdk.BuildPlat;
@@ -44,7 +39,6 @@
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
-import com.nokia.cpp.internal.api.utils.core.PathUtils;
 
 /**
  * SBSv1 specific build information.
@@ -60,14 +54,8 @@
 	private List<ISymbianBuildContext> bsfContextList = new ArrayList<ISymbianBuildContext>(0);
 	private Map<String, List<String>> cachedPlatformMacros = new HashMap<String, List<String>>();
 	private List<String> supportedTargetTypesList = new ArrayList<String>();
-	private IPath variantFilePath;
 	
 	private static final String TARGETTYPE_PM_FILE = "epoc32/tools/trgtype.pm"; //$NON-NLS-1$
-	public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$
-	public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$
-
-	// greedy match means the filename is in the last group
-	public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)");
 	
 	public SBSv1BuildInfo(ISymbianSDK sdk) {
 		this.sdk = sdk;
@@ -154,55 +142,7 @@
 		return platformMacros;
 	}
 
-	/**
-	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
-	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
-	 */
-	public IPath getPrefixFromVariantCfg(){
-		
-		if (variantFilePath != null){
-			return variantFilePath;
-		}
-		
-		File epocRoot = new File(sdk.getEPOCROOT());
-		File variantCfg;
-		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
-		if (!variantCfg.exists()) {
-			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
-			if (!variantCfg.exists())
-				return null;
-		}
-		
-		String variantDir = null;
-		String variantFile = null;
-		try {
-			char[] cbuf = new char[(int) variantCfg.length()];
-			Reader reader = new FileReader(variantCfg);
-			reader.read(cbuf);
-			reader.close();
-			String[] lines = new String(cbuf).split("\r\n|\r|\n");
-			for (int i = 0; i < lines.length; i++) {
-				// skip comments and blank lines
-				String line = SymbianSDK.removeComments(lines[i]);
-				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
-					continue;
-				
-				// parse the variant line, which is an EPOCROOT-relative
-				// path to a bldvariant.hrh file
-				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
-				if (matcher.matches()) {
-					variantDir = matcher.group(1);
-					variantFile = matcher.group(3); 
-					File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile);
-					variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath()));
-					return variantFilePath;
-				}
-			}
-		} catch (IOException e) {
-		}
-		
-		return null; // can't find the file...
-	}
+
 
 	public ISBVCatalog getSBVCatalog() {
 		synchronized (sdk) {
@@ -385,46 +325,6 @@
 		return supportedTargetTypesList;
 	}
 	
-	@SuppressWarnings("unchecked")
-	public List<String> getVariantCFGMacros(){
-		
-		List<String> variantCFGMacros = new ArrayList<String>();
-		File epocRoot = new File(sdk.getEPOCROOT());
-		File variantCfg;
-		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
-		if (!variantCfg.exists()) {
-			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
-			if (!variantCfg.exists())
-				return Collections.EMPTY_LIST;
-		}
-		
-		try {
-			char[] cbuf = new char[(int) variantCfg.length()];
-			Reader reader = new FileReader(variantCfg);
-			reader.read(cbuf);
-			reader.close();
-			String[] lines = new String(cbuf).split("\r\n|\r|\n");
-			for (int i = 0; i < lines.length; i++) {
-				// skip comments and blank lines
-				String line = SymbianSDK.removeComments(lines[i]);
-				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
-					continue;
-				
-				// parse the variant line, which is an EPOCROOT-relative
-				// path to a bldvariant.hrh file
-				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
-				if (matcher.matches()) {
-					continue; // Skip this it's the file
-				} else {
-					// all other patterns are assumed to be macro
-					variantCFGMacros.add(line.trim());
-				}
-			}
-		} catch (IOException e) {
-		}
-		
-		return variantCFGMacros;
-	}
-	
+
 
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java	Tue Aug 10 19:07:16 2010 -0500
@@ -12,11 +12,9 @@
 */
 package com.nokia.carbide.cpp.internal.sdk.core.model;
 
-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.text.MessageFormat;
@@ -25,12 +23,9 @@
 import java.util.List;
 
 import org.eclipse.cdt.utils.WindowsRegistry;
-import org.eclipse.core.resources.ResourcesPlugin;
 import org.eclipse.core.runtime.IPath;
 import org.eclipse.core.runtime.IProgressMonitor;
-import org.eclipse.core.runtime.IStatus;
 import org.eclipse.core.runtime.Path;
-import org.eclipse.core.runtime.Status;
 import org.eclipse.emf.common.util.EList;
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.swt.widgets.Shell;
@@ -42,9 +37,9 @@
 import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesFactory;
 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.ISDKManager;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
-import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 import com.nokia.carbide.cpp.sdk.core.SDKEnvInfoFailureException;
 import com.nokia.cpp.internal.api.utils.core.HostOS;
 import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
@@ -79,7 +74,6 @@
 	
 	public SDKManager() {
 		super();
-		checkPerlInstallation();
 	}
 	
 	protected boolean doScanSDKs(IProgressMonitor monitor) {
@@ -297,33 +291,6 @@
 		return false;
 	}
 	
-	protected void checkPerlInstallation(){
-		
-		Runtime rt=Runtime.getRuntime();
-		
-		// check for Perl
-		try {
-			Process p = rt.exec("perl.exe -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 && !overallOutput.contains("v5.6.1")){
-				ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.WARNING, SDKCorePlugin.PLUGIN_ID, IStatus.WARNING, "Perl v5.6.1 was not detected. Some SDKs do not work with other Perl versions.", null));
-			}
-			
-			p.destroy();
-			
-		}
-		catch (IOException e) {
-			//	report error to PDE log
-			ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, "Perl was not found on the PATH environment variable. Perl 5.6.1 is recommended for Carbide use if using SBSv1 and Symbian OS 9.4 and prior.", e));
-		}
-	}
 	
 	/**
 	 * Checks to see if the devices.xml on disk contains the same current information
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISDKBuildInfo.java	Tue Aug 10 19:07:16 2010 -0500
@@ -15,8 +15,6 @@
 
 import java.util.List;
 
-import org.eclipse.core.runtime.IPath;
-
 /**
  * Interface for build related information of a Symbian SDK.
  * @since 3.0
@@ -35,11 +33,5 @@
 	 * @return list of ISymbianBuildContext
 	 */
 	List<ISymbianBuildContext> getFilteredBuildConfigurations();
-
-	/**
-	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
-	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
-	 */
-	public IPath getPrefixFromVariantCfg();
 	
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Tue Aug 10 19:07:16 2010 -0500
@@ -85,27 +85,33 @@
 	public IPath getCompilerPrefixFile();
 
 	/**
-	 * Returns the list of all vendor specific C/C++ macros for this SDK.  The list of macros is defined in
-	 * the variant configuration file inside \epoc32\tools\variant.cfg (or \epoc32\tools\spp_variant.cfg
-	 * for platform variation SDKs).  The file itself contains an HRH file entry and may also contain macro definitions
-	 * thereafter.
+	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
+	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
+	 * @since 3.0
+	 */
+	public IPath getPrefixFromVariantCfg();
+	
+	/**
+	 * Returns the list of all vendor specific C/C++ macros for this SDK.  This is the result of preprocessing
+	 * the HRH file defined under /epoc32/tools/variant/variant.cfg
 	 * @return a list of macros which may be empty.
 	 */
 	public List<IDefine> getVariantHRHDefines();
 	
 	/**
-	 * Returns the list of all header files recursively included by the SDK prefix file.  Note that the list of
+	 * Returns the list of all header files recursively included by the SDK prefix file (defined in /epoc32/tools/variant/variant.cfg).  Note that the list of
 	 * files could be different for different context's since the platform can potentially change the list of include
 	 * paths.
 	 * @return a list of header files which may be empty
 	 */
-	public List<File> getPrefixFileIncludes();
+	public List<File> getVariantHRHIncludes();
 
 	/**
-	 * Returns the list of compiler macros from the compiler prefix file (if any).
+	 * Returns the list of compiler macros from the compiler prefix file (if any). This is the result
+	 * of preprocessing the actual compiler pre-include file, e.g. rvct.h or gcce.h. WINSCW platform builds will return an empty list.
 	 * @return a list of macros which may be empty.
 	 */
-	public List<IDefine> getCompilerMacros();
+	public List<IDefine> getCompilerPreincludeDefines();
 	
 	/**
 	 * For platforms that are building with Symbian Binary Variation, this suffix will be included in the configuration name
@@ -116,13 +122,6 @@
 	public String getBuildVariationName();
 	
 	/**
-	 * Is the current build context building as a Symbian Binary Variation? Not to be confused with BSF.
-	 * @return true if this is a binary variant build
-	 * @since 2.0
-	 */
-	public boolean isSymbianBinaryVariation();
-	
-	/**
 	 * Load build context specific configuration settings
 	 * @param ICStorageElement - a child of CARBIDE_STORAGE_ID ("CarbideConfigurationDataProvider") in .cproject data
 	 * @since 3.0
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Mon Aug 09 17:32:51 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java	Tue Aug 10 19:07:16 2010 -0500
@@ -12,8 +12,6 @@
 */
 package com.nokia.carbide.cpp.sdk.core;
 
-import java.io.File;
-import java.util.List;
 import java.util.Set;
 
 import org.eclipse.core.runtime.IPath;