bug 10674 continuation. Allow SBSv1-style build config names to co-exist with newer SBSv2 configuraiton names that use aliases. This does not use project converstion, just adds the support to differentiate between the two. Also, write new .cproject data to a SBSV2_DATA_ID node (which is not currently read, but to be used for future purposes)
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Fri Apr 02 10:01:56 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/api/builder/ui/ManageConfigurationsDialog.java Fri Apr 02 15:04:41 2010 -0500
@@ -287,7 +287,21 @@
// if the current config is already a config set it to checked.
ISymbianBuildContext buildContext = (ISymbianBuildContext)currConfigNode.getValue();
for (ICarbideBuildConfiguration currExistingConfig : buildConfigList){
- if (currExistingConfig.equals(buildContext)){
+ boolean checkIt = false;
+ checkIt = currExistingConfig.equals(buildContext);
+ if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(cpi.getProject()) &&
+ !checkIt && currExistingConfig.getSBSv2Alias() == null){
+
+ // extra check to see if we're using SBSv2 and config display name is older SBSv1 style
+ if (buildContext.getTargetString().equals(currExistingConfig.getTargetString()) &&
+ buildContext.getPlatformString().equals(currExistingConfig.getPlatformString()) &&
+ buildContext.getSDK().getUniqueId().equals(currExistingConfig.getSDK().getUniqueId() )
+ && buildContext.getSBSv2Alias() != null && buildContext.getSBSv2Alias().split("_").length == 2){
+
+ checkIt = true;
+ }
+ }
+ if (checkIt){
// must expand parent before checking, otherwise, we won't succeed
properSdkViewer.setExpandedState(sdkNode, true);
properSdkViewer.setChecked(currConfigNode, true);
@@ -364,10 +378,14 @@
// Now find out if it's checked. If it's not checked remove it
if (!properSdkViewer.getChecked(currConfigNode)){
ICarbideBuildConfiguration config = cpm.getNamedConfiguration(buildContext.getDisplayString());
+ if (config == null){
+ config = cpm.getNamedConfiguration(currExistingConfig.getDisplayString());
+ }
if (config != null){
cpm.deleteConfiguration(config);
break;
}
+
}
}
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Fri Apr 02 10:01:56 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Fri Apr 02 15:04:41 2010 -0500
@@ -16,17 +16,23 @@
*/
package com.nokia.carbide.cdt.internal.builder;
+import java.io.File;
import java.util.ArrayList;
import java.util.List;
import org.eclipse.cdt.core.CCorePlugin;
+import org.eclipse.cdt.core.ICDescriptor;
+import org.eclipse.cdt.core.ICExtensionReference;
import org.eclipse.cdt.core.model.CoreModel;
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.WriteAccessException;
import org.eclipse.cdt.core.settings.model.extension.CConfigurationData;
import org.eclipse.core.resources.IMarker;
import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IProjectDescription;
+import org.eclipse.core.resources.IResource;
import org.eclipse.core.runtime.CoreException;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -40,9 +46,11 @@
import com.nokia.carbide.cdt.builder.project.IBuildArgumentsInfo;
import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration;
import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo;
+import com.nokia.carbide.cdt.builder.project.ICarbideProjectModifier;
import com.nokia.carbide.cdt.builder.project.IEnvironmentVarsInfo;
import com.nokia.carbide.cdt.builder.project.IROMBuilderInfo;
import com.nokia.carbide.cdt.builder.project.ISISBuilderInfo;
+import com.nokia.carbide.cdt.internal.api.builder.CarbideConfigurationDataProvider;
import com.nokia.carbide.cdt.internal.api.builder.SISBuilderInfo2;
import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContext;
@@ -60,13 +68,19 @@
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$
+ protected final static String ATRRIB_CONFIG_BASE_PLATFORM = "CONFIG_BASE_PLATFORM"; //$NON-NLS-1$
+ protected final static String ATTRIB_CONFIG_TARGET = "CONFIG_TARGET"; //$NON-NLS-1$
+ protected final static String ATTRIB_SBSV2_BUILD_ALIAS = "SBSV2_BUILD_ALIAS"; //$NON-NLS-1$
+ protected final static String ATTRIB_SBSV2_CONFIG_DISPLAY_STRING = "SBSV2_CONFIG_DISPLAY_STRING"; //$NON-NLS-1$
+
protected TrackedResource projectTracker;
protected List<ISISBuilderInfo> sisBuilderInfoList;
protected EnvironmentVarsInfo2 envVarsInfo;
protected BuildArgumentsInfo buildArgumentsInfo;
protected BuildConfigurationData buildConfigData;
protected ROMBuilderInfo romBuilderInfo;
-
public CarbideBuildConfiguration(IProject project, ISymbianBuildContext context) {
super(context.getSDK(), context.getPlatformString(), context.getTargetString(), context.getSBSv2Alias());
@@ -117,9 +131,20 @@
envVarsInfo.saveToStorage(rootStorage.createChild(ENV_VAR_DATA_ID));
saveBuildArgsToStorage(rootStorage.createChild(ARGUMENTS_DATA_ID));
romBuilderInfo.saveToStorage(rootStorage.createChild(ROM_BUILDER_DATA_ID));
+
+ if (getSBSv2Alias() != null){
+ saveSBSv2DataToStorage(rootStorage.createChild(SBSV2_DATA_ID));
+ }
}
}
+ private void saveSBSv2DataToStorage(ICStorageElement createChild) {
+ createChild.setAttribute(ATRRIB_CONFIG_BASE_PLATFORM, getPlatformString());
+ createChild.setAttribute(ATTRIB_CONFIG_TARGET, getTargetString());
+ createChild.setAttribute(ATTRIB_SBSV2_BUILD_ALIAS, getSBSv2Alias());
+ createChild.setAttribute(ATTRIB_SBSV2_CONFIG_DISPLAY_STRING, getDisplayString());
+ }
+
private void loadBuildArgsFromStorage(ICStorageElement rootStorage) {
String value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE);
if (value != null) {
@@ -234,7 +259,7 @@
}
public boolean saveConfiguration(boolean refreshFileSystem) {
-
+
try {
ICProjectDescription projDes = CoreModel.getDefault().getProjectDescription(projectTracker.getProject());
if (projDes != null) {
@@ -243,14 +268,13 @@
// save the CDT project description. this saves all configs but that's the
// only thing CDT allows at this point.
CCorePlugin.getDefault().setProjectDescription(projectTracker.getProject(), projDes, true, new NullProgressMonitor());
-
return true;
}
}
} catch (CoreException e) {
CarbideBuilderPlugin.log(e.getStatus());
}
-
+
return false;
}
@@ -277,6 +301,11 @@
ISymbianBuildContext context = (ISymbianBuildContext)obj;
if (context.getDisplayString().equals(this.getDisplayString())){
return true;
+ } else if (context.getPlatformString().equals(this.getPlatformString()) &&
+ context.getTargetString().equals(this.getTargetString()) &&
+ context.getSDK().equals(this.getSDK()) && context.getSBSv2Alias() != null && context.getSBSv2Alias().split("_").length == 2){
+
+ return true;
}
} else {
return false;
@@ -404,4 +433,5 @@
return false;
}
+
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Fri Apr 02 10:01:56 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideSBSv2Builder.java Fri Apr 02 15:04:41 2010 -0500
@@ -502,8 +502,11 @@
args.add("-c"); //$NON-NLS-1$
String configName = getConfigName(buildConfig);
if (configName == null){
- //TODO: Try to contrive if the project hasn't yet been converted.....
- configName = "error_retrieving_sbs_config";
+ // Just get the default target. This is a SBSv1 style configuration name...
+ if (buildConfig.getSBSv2Alias() == null)
+ configName = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase();
+ else
+ configName = "error_retrieving_build_alias";
}
if (isTest) {
configName = configName + ".test"; //$NON-NLS-1$
@@ -588,8 +591,11 @@
String configName = getConfigName(buildConfig);
if (configName == null){
- //TODO: Try to contrive if the project hasn't yet been converted.....
- configName = "error_retrieving_sbs_config";
+ // Just get the default target. This is a SBSv1 style configuration name...
+ if (buildConfig.getSBSv2Alias() == null)
+ configName = buildConfig.getPlatformString().toLowerCase() + "_" + buildConfig.getTargetString().toLowerCase();
+ else
+ configName = "error_retrieving_build_alias";
}
String[] sbsArgs = new String[] {"--source-target=" + file.toOSString(), COMPILE_ARG, configName, COMPONENT_ARG, fullMMPPath.toFile().getName()};
launcher.setErrorParserManager(buildConfig.getCarbideProject().getINFWorkingDirectory(), buildConfig.getErrorParserList());
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java Fri Apr 02 10:01:56 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/ui/CarbideBuildConfigurationsPage.java Fri Apr 02 15:04:41 2010 -0500
@@ -508,7 +508,9 @@
String defaultConfigName = cpm.getDefaultBuildConfigName();
if (!selectedConfigString.equals(defaultConfigName)) {
- cpm.setDefaultConfiguration(cpm.getNamedConfiguration(selectedConfigString));
+ if (cpm.getNamedConfiguration(selectedConfigString) != null){
+ cpm.setDefaultConfiguration(cpm.getNamedConfiguration(selectedConfigString));
+ }
cpm.saveChanges();
}