Merge commit. C3_BUILDER_WORK
authorstechong
Wed, 02 Jun 2010 17:18:05 -0500
branchC3_BUILDER_WORK
changeset 1422 efad5bbb7534
parent 1421 587da7cb64b7 (current diff)
parent 1420 9dfc6e3dc4b9 (diff)
child 1423 17dfd1c1fef1
Merge commit.
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java	Wed Jun 02 17:18:05 2010 -0500
@@ -2303,7 +2303,7 @@
 		String plat = config.getPlatformString();
 		String basePlat = "";
 		if (config.getBuildContext() instanceof ISBSv2BuildConfigInfo){
-			basePlat = ((ISBSv1BuildContext)config).getBasePlatformForVariation();
+			basePlat = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation();
 		} else {
 			basePlat = config.getPlatformString();
 		}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/builder/CarbideCPPBuilder.java	Wed Jun 02 17:18:05 2010 -0500
@@ -908,7 +908,7 @@
 			List<String> argsList = new ArrayList<String>();
 			argsList.add("bldfiles");
 			if (config instanceof ISBSv1BuildContext){
-				argsList.add(((ISBSv1BuildContext)config).getBasePlatformForVariation().toLowerCase());
+				argsList.add(((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toLowerCase());
 			}
 			
 			for (String arg : config.getBuildArgumentsInfo().getBldmakeBldFilesArgs().split(" ")) {
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/CarbideConfigurationDataProvider.java	Wed Jun 02 17:18:05 2010 -0500
@@ -28,6 +28,7 @@
 import org.eclipse.cdt.core.ICExtensionReference;
 import org.eclipse.cdt.core.settings.model.ICConfigurationDescription;
 import org.eclipse.cdt.core.settings.model.ICProjectDescription;
+import org.eclipse.cdt.core.settings.model.ICStorageElement;
 import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
 import org.eclipse.cdt.core.settings.model.extension.CConfigurationDataProvider;
 import org.eclipse.core.resources.IFolder;
@@ -52,13 +53,16 @@
 import com.nokia.carbide.cdt.internal.builder.CarbideProjectInfo;
 import com.nokia.carbide.cdt.internal.builder.EnvironmentVarsInfo;
 import com.nokia.carbide.cdt.internal.builder.EnvironmentVarsInfo2;
+import com.nokia.carbide.cdt.internal.builder.ISBSv2BuildConfigInfo;
 import com.nokia.carbide.cdt.internal.builder.SISBuilderInfo;
 import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.CarbideBuilderConfigInfoType;
 import com.nokia.carbide.cdt.internal.builder.gen.CarbideBuildConfig.ConfigurationType;
 import com.nokia.carbide.cdt.internal.builder.xml.CarbideBuildConfigurationLoader;
 import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1;
-import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext;
+import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2;
 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 
 /**
  * Main interface point with CDT with regards to our build configurations.  Note that
@@ -124,7 +128,76 @@
 			String configId = des.getConfiguration().getId();
 			// TODO: We should be able to get the build context from the SBSv2 data, if present,
 			// otherwise from the display name for ABLD
-			ISymbianBuildContext context = BuildContextSBSv1.getBuildContextFromDisplayName(configId);
+			ISymbianBuildContext context = null;
+			String buidAlias = "";
+			String platform = "";
+			String target = "";
+			String displayString = "";
+			String variant = "";
+			String sdkID = null;
+			if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(project)){
+				ICStorageElement rootStorage = des.getStorage(CarbideBuildConfiguration.CARBIDE_STORAGE_ID, false);
+				if (rootStorage != null) {
+					for (ICStorageElement se : rootStorage.getChildren()) {
+						if (se.getName().equals(
+								CarbideBuildConfiguration.SBSV2_DATA_ID)) {
+							String value = se.getAttribute(ISBSv2BuildConfigInfo.ATRRIB_CONFIG_BASE_PLATFORM);
+							if (value != null) {
+								platform = value;
+							}
+
+							value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT);
+							if (value != null) {
+								variant = value;
+							}
+
+							value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET);
+							if (value != null) {
+								target = value;
+							}
+
+							value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_BUILD_ALIAS);
+							if (value != null) {
+								buidAlias = value;
+							}
+
+							value = se.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING);
+							if (value != null) {
+								displayString = value;
+							}
+							
+							value = se
+							.getAttribute(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID);
+							if (value != null) {
+								sdkID = value;
+							}
+						}
+					}
+				} else {
+					throw new CoreException(new Status(IStatus.ERROR,
+							CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK,
+							"Unable to load Carbide settings for project "
+									+ project.getProject().getName(), null));
+				}
+				
+				ISymbianSDK sdk = null;
+				if (sdkID == null){
+					// pre-C3 project, get SDK id from config name
+					sdkID = BuildContextSBSv2.getSDKIDFromConfigName(displayString);
+				}
+				if (sdkID != null){
+					sdk = SDKCorePlugin.getSDKManager().getSDK(sdkID, true);
+					// TODO: NEED TO HANDLE MISSING SDK ID
+					if (sdk != null){
+						context = new BuildContextSBSv2(sdk, platform, target, buidAlias);
+					}
+				}
+				
+			} else {
+				// TODO: Presume it's SBSv1?
+				context = BuildContextSBSv1.getBuildContextFromDisplayName(configId);
+			}
+			
 			if (context == null) {
 				throw new CoreException(new Status(IStatus.ERROR, CarbideBuilderPlugin.PLUGIN_ID, IStatus.OK, "SDK specified in project " + project.getName() + " is not installed, please set it up from project property", null));
 			}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java	Wed Jun 02 17:18:05 2010 -0500
@@ -59,14 +59,14 @@
 	
 	static final String NOT_INSTALLED = "(SDK not found)"; //$NON-NLS-1$
 
-	protected static final String CARBIDE_STORAGE_ID = "CarbideConfigurationDataProvider"; //$NON-NLS-1$
+	public static final String CARBIDE_STORAGE_ID = "CarbideConfigurationDataProvider"; //$NON-NLS-1$
 	protected final static String SIS_BUILDER_DATA_ID = "SIS_BUILDER_DATA_ID"; //$NON-NLS-1$
 	protected final static String ENV_VAR_DATA_ID = "ENV_VAR_DATA_ID"; //$NON-NLS-1$
 	protected final static String ARGUMENTS_DATA_ID = "ARGUMENTS_DATA_ID"; //$NON-NLS-1$
 	protected final static String ROM_BUILDER_DATA_ID = "ROM_BUILDER_DATA_ID"; //$NON-NLS-1$
 	
 	// SBSv2 only config settings 
-	protected final static String SBSV2_DATA_ID = "SBSV2_DATA_ID"; //$NON-NLS-1$ 
+	public final static String SBSV2_DATA_ID = "SBSV2_DATA_ID"; //$NON-NLS-1$ 
 	
 	protected ISymbianBuildContext context;
 	protected TrackedResource projectTracker;
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv1Builder.java	Wed Jun 02 17:18:05 2010 -0500
@@ -2368,7 +2368,7 @@
 					 EpocEngineHelper.hasFeatureVariantKeyword(config.getCarbideProject(), componentPath)){
 				buildPlatform = config.getPlatformString().toLowerCase();
 			} else if (config.getBuildContext() instanceof ISBSv1BuildContext) {
-				buildPlatform = ((ISBSv1BuildContext)config).getBasePlatformForVariation().toLowerCase();
+				buildPlatform = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toLowerCase();
 			}
 			
 			abldArgs.add(MAKEFILE_CMD); //$NON-NLS-1$
@@ -2587,10 +2587,10 @@
 		if (EpocEngineHelper.hasFeatureVariantKeyword(config.getCarbideProject(), componentPath)){
 			platformName = config.getPlatformString().toUpperCase();
 		} else if (config.getBuildContext() instanceof ISBSv1BuildContext) {
-			platformName = ((ISBSv1BuildContext)config).getBasePlatformForVariation();
+			platformName = ((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation();
 		}
 		
-		makefilePath = makefilePath.append(((ISBSv1BuildContext)config).getBasePlatformForVariation().toUpperCase());
+		makefilePath = makefilePath.append(((ISBSv1BuildContext)config.getBuildContext()).getBasePlatformForVariation().toUpperCase());
 
 		// and the makefile has the form MMPNAME.PLATFORM
 		makefilePath = makefilePath.append(mmpName + "." + platformName);
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java	Wed Jun 02 17:18:05 2010 -0500
@@ -89,7 +89,7 @@
     
     /** Get the build-able configuration from the command line (i.e. build alias). This is passed after the sbs -c parameter */
     protected String getConfigName(ICarbideBuildConfiguration buildConfig) {
-    	String buildAlias = ((ISBSv2BuildContext)buildConfig).getSBSv2Alias();
+    	String buildAlias = ((ISBSv2BuildContext)buildConfig.getBuildContext()).getSBSv2Alias();
     	if (buildAlias == null){ 
     		// Just get the default target. This is a SBSv1 style configuration name...
     		buildAlias = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase();
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ISBSv2BuildConfigInfo.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ISBSv2BuildConfigInfo.java	Wed Jun 02 17:18:05 2010 -0500
@@ -27,6 +27,7 @@
 	public final static String ATTRIB_SBSV2_BUILD_ALIAS = "SBSV2_BUILD_ALIAS"; //$NON-NLS-1$ 
 	public final static String ATTRIB_SBSV2_CONFIG_DISPLAY_STRING = "SBSV2_CONFIG_DISPLAY_STRING"; //$NON-NLS-1$ 
 	public final static String ATTRIB_SBSV2_VARIANT = "ATTRIB_SBSV2_VARIANT";
+	public final static String ATTRIB_SBSV2_SDK_ID = "ATTRIB_SBSV2_SDK_ID";
 	
 	/** Retrieve a specfic .cproject SBSv2 data value from a given ID */
 	String getSBSv2Setting(String id);
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SBSv2BuilderInfo.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/SBSv2BuilderInfo.java	Wed Jun 02 17:18:05 2010 -0500
@@ -39,6 +39,7 @@
 		sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_CONFIG_TARGET, context.getTargetString());
 		sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, context.getDisplayString());
 		sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT, "");
+		sbsv2ConfigDataMap.put(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_SDK_ID, context.getSDK().getUniqueId());
 		this.context = context;
 	}
 	
@@ -69,6 +70,12 @@
 			sbsv2ConfigDataMap.put(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value);
 		}
 		
+		value = rootStorage.getAttribute(ATTRIB_SBSV2_SDK_ID);
+		if (value != null) {
+			sbsv2ConfigDataMap.put(ATTRIB_SBSV2_SDK_ID, value);
+		}
+		
+		
 	}
 	
 	public void saveToStorage(ICStorageElement rootStorage) {
@@ -97,6 +104,11 @@
 		if (value != null && value.trim().length() > 0){
 			rootStorage.setAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, value);
 		}
+		
+		value = sbsv2ConfigDataMap.get(ATTRIB_SBSV2_SDK_ID);
+		if (value != null && value.trim().length() > 0){
+			rootStorage.setAttribute(ATTRIB_SBSV2_SDK_ID, value);
+		}
 
 	}
 
@@ -107,5 +119,5 @@
 	public void setSBSv2Setting(String id, String value) {
 		sbsv2ConfigDataMap.put(id, value);
 	}
-
+	
 }
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SBSv2BuildConfigTabComposite.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/SBSv2BuildConfigTabComposite.java	Wed Jun 02 17:18:05 2010 -0500
@@ -90,7 +90,7 @@
 	
 	public void initData(ICarbideBuildConfiguration buildConfig) {
 		this.config = buildConfig;
-		context = (ISBSv2BuildContext)buildConfig;
+		context = (ISBSv2BuildContext)buildConfig.getBuildContext();
 		ISBSv2BuildConfigInfo sbsv2ConfigInfo = ((CarbideBuildConfiguration)buildConfig).getSBSv2ConfigInfo();
 		if (sbsv2ConfigInfo != null && sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT) != null){
 			variantEdit.setText(sbsv2ConfigInfo.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT));
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Wed Jun 02 17:08:00 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java	Wed Jun 02 17:18:05 2010 -0500
@@ -12,6 +12,7 @@
 import com.nokia.carbide.cpp.sdk.core.IBSFPlatform;
 import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
 import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
 
@@ -255,5 +256,18 @@
 		// TODO: Still need to consider this for SBSv2 refactoring / Raptor query
 		return getCachedData().getSystemIncludePaths();
 	}
+	
+	
+	// Fall-back to get SDK id from old config name
+	public static String getSDKIDFromConfigName(String configName) {
+		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
+		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
+		if (indexBegin > 0 && indexEnd > 0){
+			return configName.substring(indexBegin+1, indexEnd);
+		} else {
+			return ""; //$NON-NLS-1$
+		}
+	}
+
 
 }