1) Add EpocEngineHelper#hasFeatureVariantKeyword(...)
authortimkelly
Tue, 19 May 2009 10:08:04 -0500
changeset 162 9cf153286621
parent 161 db723d303030
child 163 b25acbfc406a
1) Add EpocEngineHelper#hasFeatureVariantKeyword(...) 2) Make sure retrieval of makefile directory and makefile name hadles default ARMV5 case where config is a variant but the FEATUREVARIANT keyword is not specified.
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/CarbideSBSv1Builder.java
core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Tue May 19 08:16:15 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Tue May 19 10:08:04 2009 -0500
@@ -1884,6 +1884,27 @@
 	}
 	
 	/**
+	 * Tell if given MMP has the FEATUREVARIANT keyword
+	 * 
+	 * @param projectInfo the current Carbide project
+	 * @param relativeMMPPath -project relative path to the MMP file we need to inspect
+	 * 
+	 */
+	public static boolean hasFeatureVariantKeyword(ICarbideProjectInfo projectInfo, final IPath relativeMMPPath) {
+		Boolean result = (Boolean) EpocEnginePlugin.runWithMMPData(
+				relativeMMPPath, 
+			new DefaultMMPViewConfiguration(
+					projectInfo,
+					new AllNodesViewFilter()),
+			new MMPDataRunnableAdapter() {
+				public Object run(IMMPData data) {
+					return data.getFlags().contains(EMMPStatement.FEATUREVARIANT);
+				}
+		});
+		return result != null ? result.booleanValue() : false;
+	}
+	
+	/**
 	 * A particular MMP file is considered to be a Symbian Binary Variation iff the MMP file
 	 * has the keyword "FEATUREVARIANT" flag defined and the build configuration has a valid
 	 * build variant target in it's configuration name.
@@ -1891,7 +1912,7 @@
 	 * @param project - The project we need to get the build configuration name from
 	 * @return true if a variant executable will be built for this mmp
 	 */
-	public static boolean isFeatureVariantMMP(IMMPData mmpData, IProject project){
+	private static boolean isFeatureVariantMMP(IMMPData mmpData, IProject project){
 		
 		boolean isFeatureVariant = false;
 		ICarbideProjectInfo cpi = CarbideBuilderPlugin.getBuildManager().getProjectInfo(project);
@@ -2035,6 +2056,11 @@
 		String mmpRootName = mmpFile.lastSegment();
 		String plat = config.getPlatformString();
 		String basePlat = config.getBasePlatformForVariation();
+		String variantPlat = config.getBuildVariationName();
+		
+		if (variantPlat.length() == 0){
+			plat = plat + "." + ISymbianBuildContext.DEFAULT_VARIANT;
+		}
 		
 		String makefilePath = makefileDir.toOSString() + File.separator + mmpRootName + File.separator + basePlat + File.separator;
 		String variantMakeFileName = mmpRootName + "." + plat;
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Tue May 19 08:16:15 2009 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Tue May 19 10:08:04 2009 -0500
@@ -532,8 +532,10 @@
 			modelProvider.releaseSharedModel(model);
 
 			IPath objectDir = null;
-			if (buildConfig.isSymbianBinaryVariation()){
+			if ( buildConfig.getPlatformString().startsWith(ISymbianBuildContext.ARMV5_PLATFORM) &&
+				 EpocEngineHelper.hasFeatureVariantKeyword(cpi, fullMMPPath)){
 				// if symbian binary variation, then the object file dir will be in sub-directory with <md5>/udeb/<obj>
+				// The platform can only be a variant if the MMP file has FEATUREVARIANT keyword && The platform is ARMV5-based.
 				String MD5Name = EpocEngineHelper.getMD5HashForBinaryVariant(buildConfig, fullMMPPath);
 				if (MD5Name != null && MD5Name.length() > 0){
 					objectDir = new Path(epocBldMacros[0].getValue().toString()).append(MD5Name).append(buildConfig.getTargetString());
@@ -2439,7 +2441,13 @@
 		makefilePath = makefilePath.append(mmpName);
 
 		// each platform has its own directory
-		String platformName = config.getPlatformString().toUpperCase();
+		String platformName = "";
+		if (EpocEngineHelper.hasFeatureVariantKeyword(config.getCarbideProject(), componentPath)){
+			platformName = config.getPlatformString().toUpperCase();
+		} else {
+			platformName = config.getBasePlatformForVariation();
+		}
+		
 		makefilePath = makefilePath.append(config.getBasePlatformForVariation().toUpperCase());
 
 		// and the makefile has the form MMPNAME.PLATFORM
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Tue May 19 08:16:15 2009 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianBuildContext.java	Tue May 19 10:08:04 2009 -0500
@@ -42,6 +42,12 @@
 	public static final String ARMV6_ABIV2_PLATFORM = "ARMV6_ABIV2";
 	
 	/**
+	 * DEFAULT suffix to use for components that are specified as variant, but don't buid as variants. For example, plain ARMV5, when specified as
+	 * as a FEATUREVARIANT, will build as ARMV5.DEFAULT
+	 */
+	public static final String DEFAULT_VARIANT = "DEFAULT";
+	
+	/**
 	 * Target constants
 	 */
 
@@ -64,6 +70,7 @@
 	/**
 	 * For Symbian Bianry Variation, platforms will be names <plat>.<variation>
 	 * So in some cases you need to know only the platforms that the variant is based on.
+	 * For example, a build platform name of "armv5.myvariant" will return "armv5".
 	 * @return The base platform string.
 	 * @see isSymbianBinaryVariation()
 	 */