major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype), C3_BUILDER_WORK
authortimkelly
Wed, 11 Aug 2010 18:14:52 -0500
branchC3_BUILDER_WORK
changeset 1811 b1772bf1197b
parent 1805 1d57e533b09e
child 1812 3707a2756973
major refactor to wrap retieval of macros all around ISymbianBuildContext, to avoid need to access internal apis. Added getTargetTypeMacro(String targettype), List<IDefine> getMetadataMacros(), List<IDefine> getBuildMacros().
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.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/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/ISBSv1BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.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/SBSv2BuildInfo.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java
project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultViewConfiguration.java	Wed Aug 11 18:14:52 2010 -0500
@@ -205,28 +205,8 @@
 		if (context != null) {
 			ISymbianSDK sdk = context.getSDK();
 
-			if (context instanceof ISBSv2BuildContext){
-				macros.add(DefineFactory.createDefine("SBSV2", null));
-				ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
-				if (sbsv2BuildInfo != null) {
-					Map<String, String> platMacros = sbsv2BuildInfo.getPlatformMacros(context.getPlatformString());
-					for (Iterator<String> it = platMacros.keySet().iterator(); it.hasNext(); ) { 
-						String name = it.next();
-						String value = platMacros.get(name);
-						macros.add(DefineFactory.createDefine(name, value));
-					} 
-				}
-			} else {
-				ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
-				if (sbsv1BuildInfo != null) {
-					for (String platMacro : sbsv1BuildInfo.getPlatformMacros(context.getPlatformString())) {
-						macros.add(DefineFactory.createDefine(platMacro.trim(), platMacro.trim()));
-					}
-					
-					for (String vendorMacro : sbsv1BuildInfo.getVendorSDKMacros()){
-						macros.add(DefineFactory.createDefine(vendorMacro.trim(), vendorMacro.trim()));
-					}
-				}
+			for (IDefine metaDataMacro : context.getMetadataMacros()) {
+				macros.add(metaDataMacro);
 			}
 			
 			for (IDefine macro : context.getVariantHRHDefines()) {
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java	Wed Aug 11 18:14:52 2010 -0500
@@ -50,6 +50,7 @@
 import com.nokia.carbide.cdt.builder.EpocEngineHelper;
 import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
 import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView;
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory;
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext;
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
@@ -291,27 +292,8 @@
 		Map<String, String> macros = new HashMap<String, String>();
 		
 		// platform macros
-		if (context instanceof ISBSv1BuildContext) {
-			ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
-			// platform macros
-			for (String platMacro : sbsv1BuildInfo.getPlatformMacros(carbideBuildConfig.getPlatformString())) {
-				macros.put("__" + platMacro + "__", ""); //$NON-NLS-1$ //$NON-NLS-2$ //$NON-NLS-3$
-			}
-			
-			// vendor macros (e.g. __SERIES60_3x__)
-			for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) {
-				macros.put(builtinMacro, ""); //$NON-NLS-1$
-			}
-			
-			// built in macros
-			for (String builtinMacro : sbsv1BuildInfo.getBuiltinMacros(context)) {
-				macros.put(builtinMacro, ""); //$NON-NLS-1$
-			}
-			
-		} else {
-			ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
-			// platform macros
-			macros.putAll(sbsv2BuildInfo.getPlatformMacros(carbideBuildConfig.getPlatformString()));			
+		for (IDefine metaDataDefine : context.getMetadataMacros()){
+			macros.put(metaDataDefine.getName(), metaDataDefine.getExpansion());
 		}
 		
 		if ((carbideBuildConfig).hasSTDCPPSupport()){
@@ -324,17 +306,9 @@
 		// more than one but all have the same target type macro.  it wouldn't make sense to add different
 		// target type macros like __EXE__ and __DLL__.
 		if (targetTypes.size() == 1) {
-			if (context instanceof ISBSv1BuildContext) {
-				ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
-				for (String targetTypeMacro : sbsv1BuildInfo.getTargetTypeMacros(targetTypes.get(0))) {
-					macros.put(targetTypeMacro, ""); //$NON-NLS-1$
-				}
-			} else {
-				ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
-				for (String targetTypeMacro : sbsv2BuildInfo.getTargetTypeMacros(targetTypes.get(0))) {
-					macros.put(targetTypeMacro, ""); //$NON-NLS-1$
-				}
-			}
+			// Just get the macro for the first MMP found
+			IDefine ttMacro = context.getTargetTypeMacro(targetTypes.get(0));
+			macros.put(ttMacro.getName(), ttMacro.getExpansion());
 		}
 		
 		// get the list of all mmp files selected for the build configuration
--- a/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/builder/com.nokia.carbide.cpp.builder.utils/src/com/nokia/carbide/cpp/internal/builder/utils/handlers/PreprocessHandler.java	Wed Aug 11 18:14:52 2010 -0500
@@ -81,13 +81,13 @@
 import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPData;
 import com.nokia.carbide.cpp.epoc.engine.model.mmp.IMMPResource;
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.AcceptedNodesViewFilter;
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildContext;
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
 import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
 import com.nokia.carbide.cpp.internal.builder.utils.Activator;
 import com.nokia.carbide.cpp.internal.builder.utils.ui.LanguageSelectionDialog;
 import com.nokia.carbide.cpp.internal.builder.utils.ui.PreprocessPreferencePage;
-import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.cpp.internal.api.utils.core.FileUtils;
@@ -411,30 +411,15 @@
 	
 	private List<String> getMacros(ICarbideBuildConfiguration buildConfig, final IPath filePath, final IProgressMonitor monitor) {
 		final List<String> macros = new ArrayList<String>();
-		ISymbianSDK sdk = buildConfig.getSDK();
-		if (buildConfig.getBuildContext() instanceof ISBSv1BuildContext) {
-			ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
-			// platform macros
-			for (String platMacro : sbsv1BuildInfo.getPlatformMacros(buildConfig.getPlatformString())) {
-				macros.add("__" + platMacro + "__"); //$NON-NLS-1$ //$NON-NLS-2$
-			}
-			// vendor macros (e.g. __SERIES60_3x__)
-			for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) {
-				macros.add(builtinMacro);
-			}
-			
-			// built in macros
-			for (String builtinMacro : sbsv1BuildInfo.getBuiltinMacros(buildConfig.getBuildContext())) {
-				macros.add(builtinMacro);
-			}
-			
-		} else {
-			ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
-			// platform macros
-			for (Iterator<String> it = sbsv2BuildInfo.getPlatformMacros(buildConfig.getPlatformString()).keySet().iterator(); it.hasNext(); ) { 
-				String platMacro = it.next();
-				macros.add(platMacro);
-			} 
+		
+		List<IDefine> buildMacros = buildConfig.getBuildContext().getBuildMacros();
+		for (IDefine define : buildMacros){
+			macros.add(define.getName());
+		}
+		
+		List<IDefine> metaDataMacros = buildConfig.getBuildContext().getMetadataMacros();
+		for (IDefine define : metaDataMacros){
+			macros.add(define.getName());
 		}
 		
 		if (buildConfig.hasSTDCPPSupport()){
@@ -458,7 +443,7 @@
 						String targetType = mmpData.getSingleArgumentSettings().get(EMMPStatement.TARGETTYPE);
 						if (targetType != null) {
 							targetType = targetType.toUpperCase();
-							macros.add(targetType);
+							macros.add("__" + targetType + "__");
 						}
 						
 						// mmp macros
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java	Wed Aug 11 18:14:52 2010 -0500
@@ -27,6 +27,7 @@
 import org.eclipse.core.runtime.Path;
 import org.osgi.framework.Version;
 
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory;
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
 import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv1BuildInfo;
 import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
@@ -677,15 +678,42 @@
 
 	@Override
 	public List<IDefine> getBuildMacros() {
-		// TODO Auto-generated method stub
-		return null;
+		ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
+		List<IDefine> defines = new ArrayList<IDefine>();
+		for (String builtinMacro : sbsv1BuildInfo.getVendorSDKMacros()) {
+			defines.add(DefineFactory.createDefine(builtinMacro));
+		}
+		
+		for (String builtinMacro : sbsv1BuildInfo.getBuiltinMacros(this)) {
+			defines.add(DefineFactory.createDefine(builtinMacro));
+		}
+		
+		for (String variantCFGMacro : getVariantCFGMacros()) {
+			defines.add(DefineFactory.createDefine(variantCFGMacro));
+		}
+		
+		for (String platMacro : sbsv1BuildInfo.getPlatformMacros(getPlatformString())) {
+			defines.add(DefineFactory.createDefine("__" + platMacro + "__")); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		return defines;
 	}
 
 	@Override
 	public List<IDefine> getMetadataMacros() {
-		// TODO Auto-generated method stub
-		return null;
+		ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
+		List<IDefine> defines = new ArrayList<IDefine>();
+		for (String platMacro : sbsv1BuildInfo.getPlatformMacros(getPlatformString())) {
+			defines.add(DefineFactory.createDefine(platMacro)); //$NON-NLS-1$ //$NON-NLS-2$
+		}
+		
+		return defines;
+	}
+
+	@Override
+	public IDefine getTargetTypeMacro(String targettype) {
+		ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
+		return DefineFactory.createDefine(sbsv1BuildInfo.getTargetTypeMacro(targettype));
 	}
 	
-
 }
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Wed Aug 11 18:14:52 2010 -0500
@@ -14,11 +14,11 @@
 import org.eclipse.jface.dialogs.MessageDialog;
 import org.eclipse.ui.PlatformUI;
 
+import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory;
 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
 import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2ConfigQueryData;
 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.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;
@@ -409,14 +409,32 @@
 
 	@Override
 	public List<IDefine> getBuildMacros() {
-		// TODO Auto-generated method stub
-		return null;
+		ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER));
+		Map<String, String> buildMacroMap = sbsv2BldInfo.getBuildMacros(getSBSv2Alias());
+		List<IDefine> defines = new ArrayList<IDefine>();
+		for (String macroName : buildMacroMap.keySet()){
+			defines.add(DefineFactory.createDefine(macroName, buildMacroMap.get(macroName)));
+		}
+
+		return defines;
 	}
 
 	@Override
 	public List<IDefine> getMetadataMacros() {
-		// TODO Auto-generated method stub
-		return null;
+		ISBSv2BuildInfo sbsv2BldInfo = ((ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER));
+		Map<String, String> platMacroMap = sbsv2BldInfo.getMetadataMacros(getSBSv2Alias());
+		List<IDefine> defines = new ArrayList<IDefine>();
+		for (String macroName : platMacroMap.keySet()){
+			defines.add(DefineFactory.createDefine(macroName, platMacroMap.get(macroName)));
+		}
+		
+		return defines;
+	}
+
+	@Override
+	public IDefine getTargetTypeMacro(String targettype) {
+		ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
+		return DefineFactory.createDefine(sbsv2BuildInfo.getTargetTypeMacro(targettype));
 	}
 
 
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv1BuildInfo.java	Wed Aug 11 18:14:52 2010 -0500
@@ -66,12 +66,12 @@
 	ISBVCatalog getSBVCatalog();
 
 	/**
-	 * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__"
+	 * Get the macro for the given target type, e.g. "__EXE__" or "__DLL__"
 	 * @param targettype
 	 * @return list of macro strings, may be empty
 	 * @deprecated
 	 */
-	List<String> getTargetTypeMacros(String targettype);
+	String getTargetTypeMacro(String targettype);
 
 	/**
 	 * Get a list of macros that are used to distinguish a SDK. Typically only
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java	Wed Aug 11 18:14:52 2010 -0500
@@ -27,28 +27,39 @@
 public interface ISBSv2BuildInfo extends ISDKBuildInfo {
 
 	/**
-	 * Returns the list of all platform macros for a SDK.
+	 * Returns the list of all platform/metadata macros for a given build alias (sbs configuration).
 	 * <p>
-	 * This is somewhat equivalent to calling "bldmake plat" on the command line
-	 * These are the macros that can be used in MMP and INF files. They are only given by name (no value)
+	 * These are the &lt;metadata/&gt; macros from a query to Raptor with 'sbs --query=config[<config>].
+	 * These are the macros that can be used in MMP and INF files.
 	 * </p>
-	 * @param platform the platform name
-	 * @return a map of macros and values, which may be empty.
+	 * @param sbs build alias
+	 * @return a map of macros and value pairs, which may be empty.
 	 */
-	Map<String, String> getPlatformMacros(String platform);
+	Map<String, String> getMetadataMacros(String buildAlias);
 
 	/**
+	 * Returns the list of all build macros fro a given build alias (sbs configuration).
+	 * <p>
+	 * These are the &lt;build/&gt; macros from a query to Raptor with 'sbs --query=config[<config>].
+	 * These are the macros that can be used in C/C++ files.
+	 * </p>
+	 * @param buildAlias
+	 * @return a map of macros and value pairs, which may be empty.
+	 */
+	public Map<String, String> getBuildMacros(String buildAlias);
+	
+	/**
 	 * 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();
 
 	/**
-	 * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__"
+	 * Get the macro for the given target type, e.g. "__EXE__" or "__DLL__"
 	 * @param targettype
 	 * @return list of macro strings, may be empty
 	 */
-	List<String> getTargetTypeMacros(String targettype);
+	String getTargetTypeMacro(String targettype);
 
 	/**
 	 * Tells whether or not the plug-in installer has sniffed this SDK for eclipse plug-ins to install.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianMacroStore.java	Wed Aug 11 18:14:52 2010 -0500
@@ -193,6 +193,7 @@
      * @param osVersion - A version object. Only the major and minor rev are checked.
      * @param branch - An OS branch (e.g. 'a' or 'b') or an empty string if none.
      * @return A full list of define macro names (no values). Returns an empty list if the OS version is not in the store
+     * @deprecated - use {@link ISymbianBuildContext#getVariantHRHDefines()}
      */
     public List<String> getOSMacros(Version osVersion){
     	List<String> osMacroList = new ArrayList<String>();
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv1BuildInfo.java	Wed Aug 11 18:14:52 2010 -0500
@@ -153,31 +153,30 @@
 		return sbvCatalog;
 	}
 
-	public List<String> getTargetTypeMacros(String targettype) {
+	public String getTargetTypeMacro(String targettype) {
 		// this is based on \epoc32\tools\trgtype.pm which changes from
 		// OS version to OS version, but largely remains constant with
 		// regards to the basic type.
-		List<String> macros = new ArrayList<String>();
 		
 		// if it's not one of these then it's a DLL
 		if (targettype.compareToIgnoreCase("EPOCEXE") == 0) {
-			macros.add("__EXEDLL__");
+			return "__EXEDLL__";
 		} else if (targettype.compareToIgnoreCase("EXEDLL") == 0) {
-			macros.add("__EXEDLL__");
+			return "__EXEDLL__";
 		} else if (targettype.compareToIgnoreCase("EXE") == 0) {
-			macros.add("__EXE__");
+			return "__EXE__";
 		} else if (targettype.compareToIgnoreCase("EXEXP") == 0) {
-			macros.add("__EXE__");
+			return "__EXE__";
 		} else if (targettype.compareToIgnoreCase("IMPLIB") == 0) {
-			macros.add("__IMPLIB__");
+			return "__IMPLIB__";
 		} else if (targettype.compareToIgnoreCase("KLIB") == 0) {
-			macros.add("__LIB__");
+			return "__LIB__";
 		} else if (targettype.compareToIgnoreCase("LIB") == 0) {
-			macros.add("__LIB__");
+			return "__LIB__";
 		} else {
-			macros.add("__DLL__");
+			return "__DLL__";
 		}
-		return macros;
+
 	}
 
 	public List<String> getVendorSDKMacros() {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java	Wed Aug 11 18:14:52 2010 -0500
@@ -48,7 +48,10 @@
 	private ISymbianSDK sdk;
 	private List<ISymbianBuildContext> sbsv2FilteredConetxts = new ArrayList<ISymbianBuildContext>();
 	private boolean wasScanned = false;
-	private Map<String, Map<String, String>> cachedPlatformMacros = new HashMap<String, Map<String, String>>();
+	/** from <metadata> element from sbs --query=config[] */
+	private Map<String, Map<String, String>> cachedMetadataMacros = new HashMap<String, Map<String, String>>();
+	/** from <build> element from sbs --query=config[] */
+	private Map<String, Map<String, String>> cachedBuildMacros = new HashMap<String, Map<String, String>>();
 
 	private Map<String, String> aliasToMeaningMap = new HashMap<String, String>();
 	private List<String> productList = null;
@@ -188,26 +191,47 @@
 		return meaning;
 	}
 
-	public Map<String, String> getPlatformMacros(String platform) {
-		Map<String, String> platformMacros = cachedPlatformMacros.get(platform);
+	public Map<String, String> getMetadataMacros(String buildAlias) {
+		Map<String, String> platformMacros = cachedMetadataMacros.get(buildAlias);
 		if (platformMacros == null) {
 			platformMacros = new HashMap<String, String>();
-			synchronized (cachedPlatformMacros) {
+			synchronized (cachedMetadataMacros) {
 				if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) {
 					getFilteredBuildConfigurations();
 				}
 				if (sbsv2FilteredConetxts.size() > 0) {
 					for (ISymbianBuildContext context : sbsv2FilteredConetxts) {
-						if (context.getPlatformString().equalsIgnoreCase(platform)) {
+						if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) {
 							platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataMacros());
 						}
 					}
-					cachedPlatformMacros.put(platform, platformMacros);
+					cachedMetadataMacros.put(buildAlias, platformMacros);
 				}
 			}
 		}
 		return platformMacros;
 	}
+	
+	public Map<String, String> getBuildMacros(String buildAlias) {
+		Map<String, String> buildMacros = cachedBuildMacros.get(buildAlias);
+		if (buildMacros == null) {
+			buildMacros = new HashMap<String, String>();
+			synchronized (cachedBuildMacros) {
+				if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) {
+					getFilteredBuildConfigurations();
+				}
+				if (sbsv2FilteredConetxts.size() > 0) {
+					for (ISymbianBuildContext context : sbsv2FilteredConetxts) {
+						if (((ISBSv2BuildContext)context).getSBSv2Alias().equalsIgnoreCase(buildAlias)) {
+							buildMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getBuildMacros());
+						}
+					}
+					cachedBuildMacros.put(buildAlias, buildMacros);
+				}
+			}
+		}
+		return buildMacros;
+	}
 
 	/**
 	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
@@ -231,31 +255,30 @@
 		return cachedVariantHRHFile;
 	}
 
-	public List<String> getTargetTypeMacros(String targettype) {
+	public String getTargetTypeMacro(String targettype) {
 		// this is based on \epoc32\tools\trgtype.pm which changes from
 		// OS version to OS version, but largely remains constant with
 		// regards to the basic type.
-		List<String> macros = new ArrayList<String>();
 		
 		// if it's not one of these then it's a DLL
 		if (targettype.compareToIgnoreCase("EPOCEXE") == 0) {
-			macros.add("__EXEDLL__");
+			return "__EXEDLL__";
 		} else if (targettype.compareToIgnoreCase("EXEDLL") == 0) {
-			macros.add("__EXEDLL__");
+			return "__EXEDLL__";
 		} else if (targettype.compareToIgnoreCase("EXE") == 0) {
-			macros.add("__EXE__");
+			return "__EXE__";
 		} else if (targettype.compareToIgnoreCase("EXEXP") == 0) {
-			macros.add("__EXE__");
+			return "__EXE__";
 		} else if (targettype.compareToIgnoreCase("IMPLIB") == 0) {
-			macros.add("__IMPLIB__");
+			return "__IMPLIB__";
 		} else if (targettype.compareToIgnoreCase("KLIB") == 0) {
-			macros.add("__LIB__");
+			return "__LIB__";
 		} else if (targettype.compareToIgnoreCase("LIB") == 0) {
-			macros.add("__LIB__");
+			return "__LIB__";
 		} else {
-			macros.add("__DLL__");
+			return "__DLL__";
 		}
-		return macros;
+
 	}
 
 	public boolean isPreviouslyScanned() {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Wed Aug 11 18:14:52 2010 -0500
@@ -147,14 +147,24 @@
 	/**
 	 * This is the list of macros used to preprocess CPP source files.
 	 * @return a list of defines.
+	 * @since 3.0
 	 */
 	List<IDefine> getBuildMacros();
 	
 	/**
 	 * This is the list of macros used to preprocess Symbian build files (bld.inf & mmp)
 	 * @return a list of defines
+	 * @since 3.0
 	 */
 	List<IDefine> getMetadataMacros();
 	
+	/**
+	 * Get a list of macros specific to the given target type, e.g. "__EXE__" or "__DLL__"
+	 * @param targettype
+	 * @return list of macro strings, may be empty
+	 * @since 3.0
+	 */
+	IDefine getTargetTypeMacro(String targettype);
+	
 	
 }
--- a/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Wed Aug 11 11:52:30 2010 -0500
+++ b/project/com.nokia.carbide.cpp.project.ui/src/com/nokia/carbide/cpp/internal/project/ui/importWizards/ProjectPropertiesPage.java	Wed Aug 11 18:14:52 2010 -0500
@@ -16,7 +16,6 @@
 */
 package com.nokia.carbide.cpp.internal.project.ui.importWizards;
 
-import java.io.File;
 import java.lang.reflect.InvocationTargetException;
 import java.util.List;
 
@@ -291,6 +290,10 @@
     }
 
     public boolean linkedResourcesEnabled(){
+    	if (linkedResourcesCheck == null){
+    		return false;
+    	}
+    	
     	return linkedResourcesCheck.getSelection();
     }