fix problem constructing macros with values from mmps. Was causing .pro file imports to fail completely.
authortimkelly
Thu, 26 Aug 2010 09:45:25 -0500
changeset 1891 1c19331f819a
parent 1890 467f946a6cd1
child 1892 2009dcd074b0
fix problem constructing macros with values from mmps. Was causing .pro file imports to fail completely.
builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Thu Aug 26 08:29:58 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Thu Aug 26 09:45:25 2010 -0500
@@ -1727,8 +1727,8 @@
 	 * @return List of macro strings which may be empty.  There is no macro value, only a
 	 * string like "FOO".
 	 */
-	public static List<String> getMMPMacrosForBuildConfiguration(final IPath workspaceRelativeMMPPath, final ICarbideBuildConfiguration buildConfig) {
-		final List<String> macros = new ArrayList<String>();
+	public static List<IDefine> getMMPMacrosForBuildConfiguration(final IPath workspaceRelativeMMPPath, final ICarbideBuildConfiguration buildConfig) {
+		final List<IDefine> macros = new ArrayList<IDefine>();
 		
 		EpocEnginePlugin.runWithMMPData(workspaceRelativeMMPPath, 
 				new DefaultMMPViewConfiguration(buildConfig.getCarbideProject().getProject(), buildConfig.getBuildContext(), new AcceptedNodesViewFilter()), 
@@ -1738,8 +1738,14 @@
 					Map<EMMPStatement, List<String>> listArgumentSettings = mmpData.getListArgumentSettings();
 					List<String> macroList = listArgumentSettings.get(EMMPStatement.MACRO);
 					for (String macro : macroList) {
-						if (!macros.contains(macro)) {
-							macros.add(macro);
+						String macroValue = null;
+						if (macro.contains("=")){
+							macroValue = macro.split("=")[1]; // expansion
+							macro = macro.split("=")[0]; // name
+						}
+						IDefine newDefine = DefineFactory.createDefine(macro, macroValue);
+						if (!macros.contains(newDefine)) {
+							macros.add(newDefine);
 						}
 					}
 					return null;
@@ -2795,11 +2801,10 @@
 			// is enabled (Use preprocessor symbols....)
 			for (IPath mmpPath : mmpFiles) {
 				
-				List<String> mmpMacros = getMMPMacrosForBuildConfiguration(
+				List<IDefine> mmpMacros = getMMPMacrosForBuildConfiguration(
 						mmpPath, config);
-				for (String macro : mmpMacros) {
-					// Symbian docs say they are converted to upper case always
-					projectDefines.add(DefineFactory.createDefine(macro.toUpperCase()));
+				if (mmpMacros != null && mmpMacros.size() > 0){
+					projectDefines.addAll(mmpMacros);
 				}
 			}
 		}