first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
--- a/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java Tue Jun 15 23:12:37 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder.test/src/com/nokia/carbide/cdt/builder/test/SBSv2QueryTests.java Wed Jun 16 11:49:20 2010 -0500
@@ -59,7 +59,7 @@
startTime = System.currentTimeMillis();
if (sbsAliasBaseQuery == null){
- sbsAliasBaseQuery = SBSv2QueryUtils.queryAliasAndProductVariants();
+ sbsAliasBaseQuery = SBSv2QueryUtils.queryFilteredConfigsForSDK(null);
}
if (printTimingStats)
@@ -98,7 +98,7 @@
assertEquals(10, sdkSpecificConfigs.size());
// Get the union of the base Raptor configs and the SDK
- List<ISBSv2ConfigData> allSDKConfigUnion = sbsAliasBaseQuery.getAllConfigurationsForSDK(sdk);
+ List<ISBSv2ConfigData> allSDKConfigUnion = sbsAliasBaseQuery.getConfigsForSDK(sdk);
assertEquals(28, allSDKConfigUnion.size());
}
@@ -114,9 +114,9 @@
ISBSv2ConfigData config = sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb");
assertNotNull(config);
- assertEquals("/epoc32/release/armv5/udeb", config.getReleaseDirectory(null));
- assertEquals("armv5", config.getTraditionalPlatform(null));
- assertEquals("udeb", config.getTraditionalTarget(null));
+ assertEquals("/epoc32/release/armv5/udeb", config.getReleaseDirectory());
+ assertEquals("armv5", config.getTraditionalPlatform());
+ assertEquals("udeb", config.getTraditionalTarget());
config = sbsAliasBaseQuery.getSBSConfigByAlias(null, "armv5_udeb_gcce");
assertNull(config); // This config should only be defined by SDK suppliers
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Wed Jun 16 11:49:20 2010 -0500
@@ -1,17 +1,27 @@
package com.nokia.carbide.cpp.internal.api.sdk;
import java.io.File;
+import java.io.StringReader;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.Path;
import org.osgi.framework.Version;
+import org.w3c.dom.Element;
+import org.w3c.dom.NamedNodeMap;
+import org.w3c.dom.Node;
+import org.w3c.dom.NodeList;
+import org.xml.sax.InputSource;
+import org.xml.sax.helpers.DefaultHandler;
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo;
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
-import com.nokia.carbide.cpp.sdk.core.IBSFCatalog;
-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;
@@ -19,16 +29,25 @@
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
import com.nokia.cpp.internal.api.utils.core.Check;
+import com.nokia.cpp.internal.api.utils.core.Logging;
public class BuildContextSBSv2 implements ISBSv2BuildContext {
private String platform;
private String target;
private String sbsv2Alias;
+ private String meaning;
private ISymbianSDK sdk;
private String displayString;
private String configID; // cconfiguration 'id' attribute from .cproject
+ // Raptor config query data
+ String outputPathString;
+ List<String> metaDataMacros = new ArrayList<String>(); // macros to parse the INF/MMPs files (these do not contain values)
+ List<String> metaDataIncludes = new ArrayList<String>();
+ String metaDataVariantHRH;
+ String configParseErrorMessage = null;
+
public BuildContextSBSv2(ISymbianSDK theSDK, String thePlatform, String theTarget, String theSBSv2Alias, String displayName, String configID) {
this.sdk = theSDK;
this.platform = thePlatform.toUpperCase();
@@ -38,6 +57,16 @@
this.configID = configID;
}
+ public BuildContextSBSv2(ISymbianSDK sdk, String alias, String meaning, String contextQueryXML) {
+ this.sdk = sdk;
+ this.sbsv2Alias = alias;
+ this.meaning = meaning;
+ this.configID = ISBSv2BuildContext.BUILDER_ID + "." + sbsv2Alias + "." + sdk.getUniqueId();
+ parseQueryConfigResults(contextQueryXML);
+
+ this.displayString = getPlatformString().toUpperCase() + " " + getTargetString().toUpperCase();
+ }
+
@Override
public ISymbianSDK getSDK() {
return sdk;
@@ -45,11 +74,26 @@
@Override
public String getPlatformString() {
+
+ if (platform == null){
+ return configParseErrorMessage;
+ }
+
+ if (platform.contains(".")){
+ return platform.split(".")[0];
+ }
+ return platform;
+ }
+
+ public String getPlatformReleaseDirName() {
return platform;
}
@Override
public String getTargetString() {
+ if (target == null){
+ return configParseErrorMessage;
+ }
return target;
}
@@ -325,7 +369,105 @@
return ""; //$NON-NLS-1$
}
}
+
+
+ private void parseQueryConfigResults(String queryResult) {
+
+ try {
+ Element root = null;
+ DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ parser.setErrorHandler(new DefaultHandler());
+
+ StringReader reader = new StringReader( queryResult );
+ InputSource inputSource = new InputSource( reader );
+ root = parser.parse(inputSource).getDocumentElement();
+
+ NodeList children = root.getChildNodes();
+ for (int i=0; i< children.getLength(); i++) {
+ Node configNode = children.item(i);
+ if (configNode.getNodeName().equals("config")){
+ NamedNodeMap aliasAttribs = configNode.getAttributes();
+ String dottedName = aliasAttribs.getNamedItem("meaning").getNodeValue();
+ if (!dottedName.equalsIgnoreCase(meaning)){
+ continue;
+ }
+ if (configNode.getTextContent() != null&& configNode.getTextContent().length() > 0){
+ // The config failed, likely due to envrionment set up issue.
+ // Save the error message
+ configParseErrorMessage = configNode.getTextContent();
+ break;
+ }
+
+ String outputpath = aliasAttribs.getNamedItem("outputpath").getNodeValue();
+ if (outputpath != null){
+ outputPathString = outputpath;
+ }
+
+ // get <metadata>
+ NodeList configChillens = configNode.getChildNodes();
+ for (int ii = 0; ii < configChillens.getLength(); ii++){
+ Node metaDataNode = configChillens.item(ii);
+ if (metaDataNode.getNodeName().equals("metadata")){
+ NodeList metaDataChillens = metaDataNode.getChildNodes();
+ for (int iii = 0; iii < metaDataChillens.getLength(); iii++){
+ Node metaChild = metaDataChillens.item(iii);
+ NamedNodeMap attribs = metaChild.getAttributes();
+ try {
+ if (metaChild.getNodeName().equals("macro")){
+ String name = attribs.getNamedItem("name").getNodeValue();
+ metaDataMacros.add(name);
+ } else if (metaChild.getNodeName().equals("include")){
+ String path = attribs.getNamedItem("path").getNodeValue();
+ metaDataIncludes.add(path);
+ } else if (metaChild.getNodeName().equals("preinclude")){
+ metaDataVariantHRH = attribs.getNamedItem("file").getNodeValue();
+ }
+ } catch (Exception e) {
+ // skip it
+ e.printStackTrace();
+ }
+ }
+
+ } else if (metaDataNode.getNodeName().equals("compilerinfo")){
+ // TODO: Placeholder for future cpp preprocessor macros and compiler prefix
+ // Not sure what it will be called yet.
+ }
+ }
+
+ break;
+ }
+ }
+
+ } catch (Exception e) {
+ e.printStackTrace();
+ Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
+ }
+
+ setPlatformAndTargetFromOutputPath();
+
+ }
+ private void setPlatformAndTargetFromOutputPath() {
+ if (outputPathString == null) return;
+
+ IPath releasePath = new Path(outputPathString);
+ int epoc32SegmentIndex = 0;
+ for (String segment : releasePath.segments()){
+ if (segment.toLowerCase().equals("epoc32"))
+ break;
+ epoc32SegmentIndex++;
+ }
+ // assuming /epoc32/<release>/<target>/
+ platform = releasePath.segment(epoc32SegmentIndex+2);
+ target = releasePath.segment(epoc32SegmentIndex+3);
+ }
+ /**
+ * Error message, if any.
+ * @return An error message if a problem occurred while trying to get config info from Raptor. Null if no error.
+ */
+ public String getConfigurationErrorMessage(){
+ return configParseErrorMessage;
+ }
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java Wed Jun 16 11:49:20 2010 -0500
@@ -55,15 +55,17 @@
*/
public class SBSv2Utils {
- private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$
- private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$
+ //private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$
+ private static final String SBSV2_FILTERED_CONFIGS_STORE_V2 = "sbsv2FilteredConfigs_V2"; //$NON-NLS-1$
+ //private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$
+ private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED_V2 = "sbsv2FilteredConfigsInited_V2"; //$NON-NLS-1$
private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$
private static final long VALID_ABLD_SIZE = 1024;
/**
* Map of usable Raptor alias for -c parameter and base platform: <alise, base plat>
*/
- private static Map<String, String> unfilteredSBSv2ConfigNames;
+// private static Map<String, String> unfilteredSBSv2ConfigNames;
/** Path, to and including the SBS script */
protected static IPath sbsPath;
@@ -90,44 +92,44 @@
* @param refreshList whether or not to parse the configuration xml files again
* @return A map of raptor aliases (key) to base build platform. Never null;
*/
- public static Map<String, String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) {
-
- if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) {
- unfilteredSBSv2ConfigNames = new HashMap<String, String>();
-
- // parse the xml files in <sbs-install>/lib/config/ to get SBSv2 configs
- try {
-
- IPath configPath = getSBSBinDirectory();
- if (configPath != null) {
- configPath = configPath.removeLastSegments(1).append("lib/config"); //$NON-NLS-1$
- File configDir = configPath.toFile();
- if (configDir.exists() && configDir.isDirectory()) {
- File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() {
-
- public boolean accept(File arg0) {
- if (arg0.isDirectory()) {
- return true;
- }
- return arg0.getName().toLowerCase().endsWith("xml"); //$NON-NLS-1$
- }
-
- }, false);
-
- for (File file : configFiles) {
- getConfigsForFile(file);
- }
- }
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
- }
- }
-
- return unfilteredSBSv2ConfigNames;
- }
+// public static Map<String, String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) {
+//
+// if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) {
+// unfilteredSBSv2ConfigNames = new HashMap<String, String>();
+//
+// // parse the xml files in <sbs-install>/lib/config/ to get SBSv2 configs
+// try {
+//
+// IPath configPath = getSBSBinDirectory();
+// if (configPath != null) {
+// configPath = configPath.removeLastSegments(1).append("lib/config"); //$NON-NLS-1$
+// File configDir = configPath.toFile();
+// if (configDir.exists() && configDir.isDirectory()) {
+// File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() {
+//
+// public boolean accept(File arg0) {
+// if (arg0.isDirectory()) {
+// return true;
+// }
+// return arg0.getName().toLowerCase().endsWith("xml"); //$NON-NLS-1$
+// }
+//
+// }, false);
+//
+// for (File file : configFiles) {
+// getConfigsForFile(file);
+// }
+// }
+// }
+//
+// } catch (Exception e) {
+// e.printStackTrace();
+// Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
+// }
+// }
+//
+// return unfilteredSBSv2ConfigNames;
+// }
/**
* Given a list of SDKs, returns the list of the SDK's supported by SBSv2
@@ -156,23 +158,27 @@
/**
* Returns the list of SBSv2 build configuration names that should
- * be filtered out of any UI
+ * INCLUDED in any UI. Only configs to be displayed are saved
*/
- public static String[] getSBSv2ConfigurationsToFilter() {
+ public static List<String> getSBSv2FilteredConfigs() {
+ List<String> buildAliasList = new ArrayList<String>();
IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID);
if (prefs != null) {
- String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE, "");
- return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER);
+ String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, "");
+ String aliasesToInclude[] = configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER);
+ for (String alias : aliasesToInclude){
+ buildAliasList.add(alias);
+ }
}
- return new String[0];
+ return buildAliasList;
}
/**
- * Set the list of SBSv2 build configurations that should be filtered
- * out of any UI
+ * Set the list of SBSv2 build configurations that should be included in a build config list
+ * All others will be filtered out
* @param configs configs to be filtered
*/
- public static void setSBSv2ConfigurationsToFilter(String[] configs) {
+ public static void setSBSv2FilteredConfigs(String[] configs) {
IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID);
if (prefs != null) {
String store = ""; //$NON-NLS-1$
@@ -186,7 +192,7 @@
}
if (store.length() >= 0){
// lenght of zero means there are not configs to filter (or show them all)
- prefs.put(SBSV2_FILTERED_CONFIGS_STORE, store);
+ prefs.put(SBSV2_FILTERED_CONFIGS_STORE_V2, store);
try {
prefs.flush();
} catch (BackingStoreException e) {
@@ -198,118 +204,24 @@
}
/**
- * Gets the list of all SBSv2 build contexts for the given SDK
- * @param sdk the SDK to get the build contexts for
- * @return the list of SBSv2 build contexts. the list may be empty
- */
- public static List<ISymbianBuildContext> getAllSBSv2BuildContexts(ISymbianSDK sdk) {
- List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
- Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator();
- while (it.hasNext()){
-
- Map.Entry buildConfigPair = (Map.Entry)it.next();
- String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias
- String basePlat = (String)buildConfigPair.getValue();
- // only support configs that fall into something we can make a build context
- // out of. They must have a platform and a target.
- String targetString = null;
- String[] configTokens = alias.split("_"); // $//$NON-NLS-N$
- // We presume that aliases have the second token as the "target".
- if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ //$NON-NLS-2$
- targetString = ISymbianBuildContext.DEBUG_TARGET;
- } else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ //$NON-NLS-2$
- targetString = ISymbianBuildContext.RELEASE_TARGET;
- }
-
- if (targetString != null) {
- BuildContextSBSv2 context = null;
- // TODO: Display String not properly set
- String configID = ISBSv2BuildContext.BUILDER_ID + "." + alias + "." + sdk.getUniqueId();
- String displayString = alias + " [" + sdk.getUniqueId() + "]";
- context = new BuildContextSBSv2(sdk, basePlat, targetString, alias, displayString, configID);
- if (context != null)
- contexts.add(context);
- }
- }
-
- return sortContexts(contexts);
- }
-
- /**
- * Gets the list of SBSv2 build contexts for the given SDK
- * @param sdk the SDK to get the build contexts for
- * @return the list of SBSv2 build contexts. the list may be empty
- */
- public static List<ISymbianBuildContext> getFilteredSBSv2BuildContexts(ISymbianSDK sdk) {
- List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
-
- initDefaultConfigsToFilter();
-
- Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator();
-
- while (it.hasNext()){
-
- Map.Entry buildConfigPair = (Map.Entry)it.next();
- String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias
- String basePlat = (String)buildConfigPair.getValue();
- boolean addConfig = true;
-
- for (String filteredConfig : getSBSv2ConfigurationsToFilter()) {
- if (filteredConfig.compareTo(alias) == 0) {
- addConfig = false;
- break;
- }
- }
-
- if (addConfig) {
-
- // only support configs that fall into something we can make a build context
- // out of. They must have a platform and a target.
- String targetString = null;
- String[] configTokens = alias.split("_"); // $//$NON-NLS-N$
- // We presume that aliases have the second token as the "target".
- if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ //$NON-NLS-2$
- targetString = ISymbianBuildContext.DEBUG_TARGET;
- } else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ //$NON-NLS-2$
- targetString = ISymbianBuildContext.RELEASE_TARGET;
- }
-
- if (targetString != null) {
- BuildContextSBSv2 context = null;
- // TODO: Display String not properly set
- String configID = ISBSv2BuildContext.BUILDER_ID + "." + alias + "." + sdk.getUniqueId();
- String displayString = alias + " [" + sdk.getUniqueId() + "]";
- context = new BuildContextSBSv2(sdk, basePlat, targetString, alias, displayString, configID);
- if (context != null)
- contexts.add(context);
- }
- }
- }
-
- return sortContexts(contexts);
- }
-
- /**
* There are many build aliases presented by default from Raptor
* Filter out those that are less commonly used on new workspace creation.
*/
public static void initDefaultConfigsToFilter() {
IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId());
- String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED, "");
+ String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, "");
if (inited == null || inited.length() == 0){
- Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator();
List<String> defaultConfigsToFilter = new ArrayList<String>();
- while (it.hasNext()){
- Map.Entry buildConfigPair = (Map.Entry)it.next();
- String buildAlias = (String)buildConfigPair.getKey();
- if (buildAlias.toLowerCase().startsWith("armv6") ||
- buildAlias.toLowerCase().startsWith("armv7") ||
- buildAlias.toLowerCase().startsWith("armv9")){
- defaultConfigsToFilter.add(buildAlias);
- }
- }
- prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true");
- setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()]));
+
+ defaultConfigsToFilter.add("armv5_udeb");
+ defaultConfigsToFilter.add("armv5_urel");
+ defaultConfigsToFilter.add("armv5_udeb_gcce");
+ defaultConfigsToFilter.add("armv5_urel_gcce");
+ defaultConfigsToFilter.add("winscw_urel");
+ defaultConfigsToFilter.add("winscw_udeb");
+
+ prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, "true");
+ setSBSv2FilteredConfigs(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()]));
}
}
@@ -346,66 +258,6 @@
return false;
}
- private static void getConfigsForFile(File file) {
-
- try {
- Element root = null;
- DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
- parser.setErrorHandler(new DefaultHandler());
-
- InputSource source = new InputSource(URIUtil.toURI(file.getAbsolutePath()).getPath());
- root = parser.parse(source).getDocumentElement();
-
- NodeList children = root.getChildNodes();
- for (int i=0; i< children.getLength(); i++) {
- getConfigsForNode(children.item(i), root);
- }
-
- } catch (Exception e) {
- e.printStackTrace();
- Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
- }
- }
-
- private static void getConfigsForNode(Node node, Node parentNode) {
- if (node.getNodeName().equals("config")) { //$NON-NLS-1$
- Node abstractNode = node.getAttributes().getNamedItem("abstract"); //$NON-NLS-1$
- Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$
- if (abstractNode == null || abstractNode.getNodeValue().equals("false")) { //$NON-NLS-1$
- if (namedNode != null) {
-
- // Get the parent base build platform
- String baseBuildPlatform = null;
- if (parentNode != null){
- baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue();
- if (baseBuildPlatform.split("_").length > 1){
- baseBuildPlatform = baseBuildPlatform.split("_")[0];
- }
- }
-
- // only support configs that fall into something we can make a build context
- // out of. They must have a platform and a target.
- String configName = namedNode.getNodeValue();
- String[] configTokens = configName.split("_");
- if (configTokens.length >= 2) { //$NON-NLS-1$
- String target = configTokens[1];
- if (target.endsWith("deb") || target.endsWith("rel")){ //$NON-NLS-1$
- if (baseBuildPlatform == null){
- baseBuildPlatform = "unknown";
- }
- unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform);
- }
- }
- }
- }
-
- NodeList children = node.getChildNodes();
- for (int i=0; i< children.getLength(); i++) {
- getConfigsForNode(children.item(i), node);
- }
- }
- }
-
/**
* (Re-)scan the SBSv2 / Raptor configuration
* @return message if error, else null
@@ -444,93 +296,14 @@
}
private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> contexts){
-
- // 2 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel)
-
Collections.sort(contexts, new Comparator<ISymbianBuildContext>() {
-
- // First sort the target name (Debug / Release) and push Emulation to the top
public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
- ISBSv2BuildContext sbsv2Context1 = null;
- ISBSv2BuildContext sbsv2Context2 = null;
- String sbsAlias1 = "";
- String sbsAlias2 = "";
- if (o1 instanceof ISBSv2BuildContext && o2 instanceof ISBSv2BuildContext){
- sbsv2Context1 = ((ISBSv2BuildContext)o1);
- sbsv2Context2 = ((ISBSv2BuildContext)o2);
- sbsAlias1 = sbsv2Context1.getSBSv2Alias();
- sbsAlias2 = sbsv2Context2.getSBSv2Alias();
- }
- if (o1.getPlatformString().equals(o2.getPlatformString())) {
- if (sbsv2Context1.getSBSv2Alias().split("_").length != sbsv2Context1.getSBSv2Alias().split("_").length)
- return o1.getTargetString().compareTo(o2.getTargetString());
- else if (sbsAlias1.split("_").length >= 3){
- String temp1[] = sbsAlias1.split("_");
- String temp2[] = sbsAlias2.split("_");
- String suffix1 = "";
- String suffix2 = "";
- for (int i = 2; i < temp1.length; i++){
- suffix1 += temp1[i] + "_";
- }
-
- for (int i = 2; i < temp2.length; i++){
- suffix2 += temp2[i] + "_";
- }
-
- return suffix1.compareTo(suffix2);
- }
- } else {
- if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) {
- return -1;
- }else if (sbsAlias2.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) {
- return 1;
- }
- }
- return sbsAlias1.compareTo(sbsAlias2);
- }
-
- });
-
- // Sort long alias names
- Collections.sort(contexts, new Comparator<ISymbianBuildContext>() {
-
- public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
- ISBSv2BuildContext sbsv2Context1 = null;
- ISBSv2BuildContext sbsv2Context2 = null;
- String sbsAlias1 = "";
- String sbsAlias2 = "";
- if (o1 instanceof ISBSv2BuildContext && o2 instanceof ISBSv2BuildContext){
- sbsv2Context1 = ((ISBSv2BuildContext)o1);
- sbsv2Context2 = ((ISBSv2BuildContext)o2);
- sbsAlias1 = sbsv2Context1.getSBSv2Alias();
- sbsAlias2 = sbsv2Context2.getSBSv2Alias();
- }
-
- if (sbsv2Context1.getSBSv2Alias().split("_").length == 3 && sbsv2Context2.getSBSv2Alias().split("_").length == 3 &&
- o1.getPlatformString().equals(o2.getPlatformString()))
- return o1.getTargetString().compareTo(o2.getTargetString());
- else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){
- String temp1[] = sbsAlias1.split("_");
- String temp2[] = sbsAlias2.split("_");
- String suffix1 = "";
- String suffix2 = "";
- for (int i = 2; i < temp1.length; i++){
- suffix1 += temp1[i] + "_";
- }
-
- for (int i = 2; i < temp2.length; i++){
- suffix2 += temp2[i] + "_";
- }
-
- return suffix1.compareTo(suffix2);
- }
-
- return 0;
+ return o2.getDisplayString().compareTo(o1.getDisplayString());
}
});
- return contexts;
- }
+ return contexts;
+ }
/**
* If a variant is defined and it changes the output directory, return the directory name.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/ISBSv2ConfigData.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/ISBSv2ConfigData.java Wed Jun 16 11:49:20 2010 -0500
@@ -44,28 +44,28 @@
* @param sdk - use null if for base configuration
* @return the portable OS string starting from /epoc32/
*/
- String getReleaseDirectory(ISymbianSDK sdk);
+ String getReleaseDirectory();
/**
* TODO: This API is not yet defined.
* @param sdk
* @return
*/
- ISBSv2ConfigPreprocessorInfo getBuildData(ISymbianSDK sdk);
+ ISBSv2ConfigPreprocessorInfo getCPPPreprocessorData();
/**
* Get the name of the folder where executable binaries are written (typically 'debug' or 'release')
* @param sdk - use null for base configuration
* @return string of folder name
*/
- String getTraditionalTarget(ISymbianSDK sdk);
+ String getTraditionalTarget();
/**
* Get the name of the folder where executable binaries are written (component before the target)
* @param sdk - use null for base configuration
* @return string of folder name
*/
- String getTraditionalPlatform(ISymbianSDK sdk);
+ String getTraditionalPlatform();
/**
* Get the SDK for which this configuration was qeuried.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/ISBSv2QueryData.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/ISBSv2QueryData.java Wed Jun 16 11:49:20 2010 -0500
@@ -44,7 +44,7 @@
* @see {@link ISBSv2QueryData#getSDKSpecificConfigData(ISymbianSDK)}
* @see {@link ISBSv2QueryData#getBaseSBSConfigurations()}
*/
- List<ISBSv2ConfigData> getAllConfigurationsForSDK(ISymbianSDK sdk);
+ List<ISBSv2ConfigData> getConfigsForSDK(ISymbianSDK sdk);
/**
* Get the SBS configurations that are defined only by the SDK.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigData.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigData.java Wed Jun 16 11:49:20 2010 -0500
@@ -61,54 +61,23 @@
}
- public String getReleaseDirectory(ISymbianSDK sdk) {
- if (releaseDirectory == null){
- initDefaultConfigTargetInfo(sdk);
- }
+ public String getReleaseDirectory() {
+
return releaseDirectory;
}
- private void initDefaultConfigTargetInfo(ISymbianSDK sdk) {
- List<String> aliasOrMeaningArray = new ArrayList<String>();
- aliasOrMeaningArray.add(buildAlias);
- HashMap <String, String> configResponse = SBSv2QueryUtils.queryConfigTargetInfo(aliasOrMeaningArray, sdk);
- String releaseTree = configResponse.get(meaning);
- if (releaseTree == null){
- // TODO: Throw Exception
- return;
- }
- IPath releasePath = new Path(releaseTree);
- int epoc32SegmentIndex = 0;
- for (String segment : releasePath.segments()){
- if (segment.toLowerCase().equals("epoc32"))
- break;
- epoc32SegmentIndex++;
- }
- platform = releasePath.segment(epoc32SegmentIndex+2);
- target = releasePath.segment(epoc32SegmentIndex+3);
- String device = releasePath.getDevice();
- releaseDirectory = releasePath.removeFirstSegments(epoc32SegmentIndex).toPortableString();
- releaseDirectory = releaseDirectory.replace(device, "");
-
- }
-
- public ISBSv2ConfigPreprocessorInfo getBuildData(ISymbianSDK sdk) {
+ public ISBSv2ConfigPreprocessorInfo getCPPPreprocessorData() {
// TODO Auto-generated method stub
return null;
}
- public String getTraditionalTarget(ISymbianSDK sdk) {
- if (target == null){
- initDefaultConfigTargetInfo(sdk);
- }
+ public String getTraditionalTarget() {
+
return target;
}
- public String getTraditionalPlatform(ISymbianSDK sdk) {
- if (platform == null){
- initDefaultConfigTargetInfo(sdk);
- }
+ public String getTraditionalPlatform() {
return platform;
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryData.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryData.java Wed Jun 16 11:49:20 2010 -0500
@@ -75,7 +75,7 @@
return sdkDefinedConfigs;
}
- public List<ISBSv2ConfigData> getAllConfigurationsForSDK(ISymbianSDK sdk) {
+ public List<ISBSv2ConfigData> getConfigsForSDK(ISymbianSDK sdk) {
return sbsSDKBuildConfigMap.get(sdk);
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Wed Jun 16 11:49:20 2010 -0500
@@ -54,58 +54,58 @@
public static final String QUERY_CONFIG_COMMAND = "--query=config";
public static final String QUERY_COMMAND = "--query=aliases";
- public static ISBSv2QueryData queryAliasAndProductVariants() {
- List<String> argListConfigQuery = new ArrayList<String>();
- List<String> argListProductQuery = new ArrayList<String>();
- argListConfigQuery.add(QUERY_COMMAND);
- SBSv2QueryData sbsQueryData = new SBSv2QueryData();
+ public static HashMap<String, String> getAliasesForSDK(ISymbianSDK sdk){
+ List<String> argListAliasQuery = new ArrayList<String>();
+ argListAliasQuery.add(QUERY_COMMAND);
- /////// Invoke Raptor once with no EPOCROOT
Properties envVars = EnvironmentReader.getEnvVars();
- envVars.setProperty("EPOCROOT", "FOOBAR");
- String queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars));
-
- HashMap<String, String> sbsAliasMap = parseQueryAliasResult(queryResult);
+ if (sdk != null){
+ envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
+ } else {
+ envVars.setProperty("EPOCROOT", "FOOBAR");
+ }
+
+ String queryResult = getSBSQueryOutput(argListAliasQuery, createEnvStringList(envVars));
- for (String aliasKey : sbsAliasMap.keySet()){
- String meaning = sbsAliasMap.get(aliasKey);
- SBSv2ConfigData oneSBSConfig = new SBSv2ConfigData(aliasKey, meaning, null);
- sbsQueryData.addConfigurationData(null, oneSBSConfig);
+ return parseQueryAliasResult(queryResult);
+ }
+
+ public static List<String> getProductVariantsForSDK(ISymbianSDK sdk){
+ List<String> argListProductQuery = new ArrayList<String>();
+
+ Properties envVars = EnvironmentReader.getEnvVars();
+ if (sdk != null){
+ envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
+ } else {
+ envVars.setProperty("EPOCROOT", "FOOBAR");
}
- /////// Do for each SDK to build up the alias list...
- for (ISymbianSDK sdk : SDKCorePlugin.getSDKManager().getSDKList()){
- IPath epocRoot = new Path(sdk.getEPOCROOT());
- if ((sdk.getOSVersion().getMajor() <= 9 && sdk.getOSVersion().getMinor() <5)
- || !epocRoot.toFile().exists()){
-
- continue; // skip it, the sdk is not supported or broken
- }
-
- envVars = EnvironmentReader.getEnvVars();
- envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
-
- queryResult = getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars));
-
- sbsAliasMap = parseQueryAliasResult(queryResult);
-
- for (String aliasKey : sbsAliasMap.keySet()){
- String meaning = sbsAliasMap.get(aliasKey);
- SBSv2ConfigData oneSBSConfig = new SBSv2ConfigData(aliasKey, meaning, sdk);
- sbsQueryData.addConfigurationData(sdk, oneSBSConfig);
- }
-
- // Now get the products for each SDK
- argListProductQuery.add(QUERY_PRODUCTS_COMMAND);
- queryResult = getSBSQueryOutput(argListProductQuery, createEnvStringList(envVars));
- List<String> productList = parseQueryProductsResults(queryResult);
- sbsQueryData.addProductListForSDK(sdk, productList);
+ argListProductQuery.add(QUERY_PRODUCTS_COMMAND);
+ String queryResult = getSBSQueryOutput(argListProductQuery, createEnvStringList(envVars));
+ return parseQueryProductsResults(queryResult);
+ }
+
+ public static String getConfigQueryXML(ISymbianSDK sdk, List<String> aliasOrMeaningArray){
+
+ List<String> argListConfigQuery = new ArrayList<String>();
+
+ for (String alias : aliasOrMeaningArray){
+ argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]");
}
- return sbsQueryData;
+ Properties envVars = null;
+ if (sdk != null){
+ File epocRoot = new File(sdk.getEPOCROOT());
+ if (epocRoot.exists()){
+ envVars = EnvironmentReader.getEnvVars();
+ envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
+ }
+ }
+ return getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars));
}
- public static HashMap<String, String> queryConfigTargetInfo(List<String> aliasOrMeaningArray, ISymbianSDK sdk){
+
+ public static HashMap<String, String> queryConfigTargetInfo(ISymbianSDK sdk, List<String> aliasOrMeaningArray){
List<String> argListConfigQuery = new ArrayList<String>();
@@ -253,7 +253,7 @@
if (aliasNode.getNodeName().equals("config")){
NamedNodeMap meaning = aliasNode.getAttributes();
String outputpath = meaning.getNamedItem("outputpath").getNodeValue();
- String fullName = meaning.getNamedItem("fullname").getNodeValue();
+ String fullName = meaning.getNamedItem("meaning").getNodeValue();
//System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias);
sbsAliasMap.put(fullName, outputpath);
}
@@ -286,7 +286,6 @@
if (aliasNode.getNodeName().equals("product")){
NamedNodeMap productAttribs = aliasNode.getAttributes();
String name = productAttribs.getNamedItem("name").getNodeValue();
- //System.out.println("ALIAS QUERY ==> " + dottedName + " <==> " + alias);
productList.add(name);
}
}
@@ -299,6 +298,41 @@
return productList;
}
+ public static ISBSv2QueryData queryFilteredConfigsForSDK(ISymbianSDK sdk) {
+ List<String> argListConfigQuery = new ArrayList<String>();
+ argListConfigQuery.add(QUERY_COMMAND);
+ SBSv2QueryData sbsQueryData = new SBSv2QueryData();
+
+ IPath epocRoot = new Path(sdk.getEPOCROOT());
+ if ((sdk.getOSVersion().getMajor() <= 9 && sdk.getOSVersion()
+ .getMinor() < 5) || !epocRoot.toFile().exists()) {
+
+ return null; // skip it, the sdk is not supported or broken
+ }
+
+ Properties envVars = EnvironmentReader.getEnvVars();
+ envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
+
+ String queryResult = getSBSQueryOutput(argListConfigQuery,
+ createEnvStringList(envVars));
+
+ HashMap<String, String> sbsAliasMap = parseQueryAliasResult(queryResult);
+
+ List<String> aliasFilterList = SBSv2Utils.getSBSv2FilteredConfigs();
+ for (String aliasKey : sbsAliasMap.keySet()) {
+
+ if (!aliasFilterList.contains(aliasKey))
+ continue;
+
+ String meaning = sbsAliasMap.get(aliasKey);
+ SBSv2ConfigData oneSBSConfig = new SBSv2ConfigData(aliasKey,
+ meaning, sdk);
+ sbsQueryData.addConfigurationData(sdk, oneSBSConfig);
+ }
+
+ return sbsQueryData;
+ }
+
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Wed Jun 16 11:49:20 2010 -0500
@@ -44,6 +44,7 @@
import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
import org.eclipse.core.runtime.jobs.Job;
import org.osgi.framework.Version;
@@ -128,6 +129,20 @@
*/
protected static ListenerList<ICarbideDevicesXMLChangeListener> devicesXMLListeners = new ListenerList<ICarbideDevicesXMLChangeListener>();
+ IJobChangeListener scanJobListener = new IJobChangeListener() {
+
+ public void sleeping(IJobChangeEvent event) {}
+ public void scheduled(IJobChangeEvent event) {}
+ public void running(IJobChangeEvent event) {}
+ public void awake(IJobChangeEvent event) {}
+ public void aboutToRun(IJobChangeEvent event) {}
+
+ public void done(IJobChangeEvent event) {
+ fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
+ }
+
+ };
+
public AbstractSDKManager() {
macroStore = SymbianMacroStore.getInstance();
@@ -137,6 +152,8 @@
return handleScan(monitor);
}
};
+
+ addScanJobListner(scanJobListener);
}
public SymbianMacroStore getSymbianMacroStore(){
@@ -201,7 +218,6 @@
hasScannedSDKs = true;
// tell others about it
- fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
scanCarbideSDKCache();
updateCarbideSDKCache();
@@ -225,13 +241,13 @@
abstract protected boolean doScanSDKs(IProgressMonitor monitor);
public void addScanJobListner(IJobChangeListener listener) {
- if (scanJob != null) {
+ if (scanJob != null && listener != null) {
scanJob.addJobChangeListener(listener);
}
}
public void removeScanJobLisner(IJobChangeListener listener) {
- if (scanJob != null) {
+ if (scanJob != null && listener != null) {
scanJob.removeJobChangeListener(listener);
}
}
@@ -864,6 +880,6 @@
return;
}
-
+
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Wed Jun 16 11:49:20 2010 -0500
@@ -26,8 +26,11 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;
+import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2;
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
+import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
@@ -41,9 +44,12 @@
public class SBSv2BuildInfo implements ISBSv2BuildInfo {
private ISymbianSDK sdk;
+ private List<ISymbianBuildContext> sbsv2FilteredConetxts = new ArrayList<ISymbianBuildContext>();
private boolean wasScanned = false;
private Map<String, List<String>> cachedPlatformMacros = new HashMap<String, List<String>>();
+ private Map<String, String> aliasToMeaningMap = new HashMap<String, String>();
+
public SBSv2BuildInfo(ISymbianSDK sdk) {
this.sdk = sdk;
}
@@ -56,20 +62,82 @@
@Override
public List<ISymbianBuildContext> getAllBuildConfigurations() {
- return SBSv2Utils.getAllSBSv2BuildContexts(sdk);
+ // TODO: Will get rid of this. Only filtered configs will apply
+ return sbsv2FilteredConetxts;
}
@Override
public List<ISymbianBuildContext> getFilteredBuildConfigurations() {
- // This is probably a bug, but the filtering only uses SBSv1 preferences if SBSv1 is enabled...
- List<ISymbianBuildContext> filteredContexts;
- if (SBSv2Utils.enableSBSv2Support()) {
- filteredContexts = SBSv2Utils.getFilteredSBSv2BuildContexts(sdk);
- } else {
- // be optimistic in this case... SBSv3? ;)
- filteredContexts = getAllBuildConfigurations();
+
+ if (aliasToMeaningMap.size() == 0)
+ aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+
+ List<String> allowedConfigs = SBSv2Utils.getSBSv2FilteredConfigs(); // From global prefs
+ if ((sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0)
+ && SBSv2Utils.enableSBSv2Support()){
+
+ if (!(new File(sdk.getEPOCROOT()).exists())){
+ return sbsv2FilteredConetxts;
+ }
+
+ List<String> filteredAliasList = new ArrayList<String>();
+
+ for (String alias : aliasToMeaningMap.keySet()){
+ for (String checkedAlias : allowedConfigs){
+ if (checkedAlias.equalsIgnoreCase(alias)){
+ filteredAliasList.add(alias);
+ break;
+ }
+ }
+ }
+
+ String configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, filteredAliasList);
+
+ for (String alias : filteredAliasList){
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, aliasToMeaningMap.get(alias), configQueryXML);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ }
+
+ } else if (SBSv2Utils.enableSBSv2Support()){
+ // Check and see if the filtered list has changed
+ boolean contextExists = false;
+ List<String> newContextsToQuery = new ArrayList<String>();
+ for (String aliasName : allowedConfigs){
+ for (ISymbianBuildContext context : sbsv2FilteredConetxts){
+ ISBSv2BuildContext sbsv2Context = (ISBSv2BuildContext)context;
+ if (sbsv2Context.getSBSv2Alias().equals(aliasName)){
+ contextExists = true;
+ continue;
+ }
+ }
+ if (!contextExists){
+ newContextsToQuery.add(aliasName);
+ }
+ contextExists = false;
+ }
+
+ String configQueryXML = SBSv2QueryUtils.getConfigQueryXML(sdk, newContextsToQuery);
+ for (String alias : newContextsToQuery){
+ if (aliasToMeaningMap.get(alias) == null){
+ continue; // This alias is not valid with this SDK, ignore
+ }
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, aliasToMeaningMap.get(alias), configQueryXML);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ }
+
}
- return filteredContexts;
+
+ // Now we need to remove any configs that should not be present per filtering preferences
+ List<ISymbianBuildContext> contextsToReturn = new ArrayList<ISymbianBuildContext>();
+ for (ISymbianBuildContext currentContext : sbsv2FilteredConetxts){
+ for (String alias : allowedConfigs){
+ if (alias.equals(((ISBSv2BuildContext)currentContext).getSBSv2Alias())){
+ contextsToReturn.add(currentContext);
+ }
+ }
+ }
+
+ return contextsToReturn;
}
public List<String> getPlatformMacros(String platform) {
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/internal/api/sdk/ui/SBSv2PlatformFilterComposite.java Wed Jun 16 11:49:20 2010 -0500
@@ -18,6 +18,7 @@
import java.util.ArrayList;
import java.util.Collections;
+import java.util.HashMap;
import java.util.List;
import org.eclipse.jface.viewers.ArrayContentProvider;
@@ -34,6 +35,7 @@
import org.eclipse.swt.widgets.TableItem;
import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
+import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2QueryUtils;
import com.nokia.carbide.cpp.internal.sdk.ui.Messages;
/**
@@ -86,36 +88,37 @@
public void performOk() {
// save the list of unchecked configs
- List<String> uncheckedConfigs = new ArrayList<String>();
+ List<String> checkedConfigs = new ArrayList<String>();
for (TableItem item : tableViewer.getTable().getItems()) {
- if (!tableViewer.getChecked(item.getData())) {
- uncheckedConfigs.add(item.getText());
+ if (tableViewer.getChecked(item.getData())) {
+ checkedConfigs.add(item.getText());
}
}
- SBSv2Utils.setSBSv2ConfigurationsToFilter(uncheckedConfigs.toArray(new String[uncheckedConfigs.size()]));
+ SBSv2Utils.setSBSv2FilteredConfigs(checkedConfigs.toArray(new String[checkedConfigs.size()]));
}
private void initTable(boolean refreshList) {
SBSv2Utils.initDefaultConfigsToFilter();
- Object[] keySet = SBSv2Utils.getUnfilteredSBSv2BuildConfigurations(refreshList).keySet().toArray();
+ // TODO: Aliases need to be the union of all SDKs
+ HashMap<String, String> aliasMap = SBSv2QueryUtils.getAliasesForSDK(null);
List<String> sbsAliases = new ArrayList<String>();
- for (Object key : keySet)
- sbsAliases.add((String)key);
+ for (String key : aliasMap.keySet())
+ sbsAliases.add(key);
Collections.sort(sbsAliases);
tableViewer.setInput(sbsAliases);
// check all configs
- tableViewer.setAllChecked(true);
+ tableViewer.setAllChecked(false);
- // now uncheck the ones from the store
- String[] uncheckedConfigs = SBSv2Utils.getSBSv2ConfigurationsToFilter();
+ // now check ones from the store
+ List<String> uncheckedConfigs = SBSv2Utils.getSBSv2FilteredConfigs();
for (String config : uncheckedConfigs) {
for (TableItem item : tableViewer.getTable().getItems()) {
if (item.getText().equals(config)) {
- tableViewer.setChecked(item.getData(), false);
+ tableViewer.setChecked(item.getData(), true);
break;
}
}
@@ -125,15 +128,15 @@
public void setDefaults(){
initTable(true);
for (TableItem item : tableViewer.getTable().getItems()) {
- if (item.getText().toLowerCase().startsWith("tool") ||
- item.getText().toLowerCase().startsWith("gccxml") ||
- item.getText().toLowerCase().startsWith("armv6") ||
- item.getText().toLowerCase().startsWith("armv7") ||
- item.getText().toLowerCase().startsWith("armv7") ||
- item.getText().toLowerCase().startsWith("armv9")) {
+ if (item.getText().toLowerCase().startsWith("armv5_udeb") ||
+ item.getText().toLowerCase().startsWith("armv5_urel") ||
+ item.getText().toLowerCase().startsWith("armv5_udeb_gcce") ||
+ item.getText().toLowerCase().startsWith("armv5_urel_gcce") ||
+ item.getText().toLowerCase().startsWith("winscw_udeb") ||
+ item.getText().toLowerCase().startsWith("winscw_urel")) {
+ tableViewer.setChecked(item.getData(), true);
+ } else {
tableViewer.setChecked(item.getData(), false);
- } else {
- tableViewer.setChecked(item.getData(), true);
}
}
}
--- a/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Tue Jun 15 23:12:37 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.ui/src/com/nokia/carbide/cpp/sdk/ui/shared/BuildTargetTreeNode.java Wed Jun 16 11:49:20 2010 -0500
@@ -56,9 +56,12 @@
super(value);
List<ISymbianBuildContext> configurations = sbsv2Project ?
- SBSv2Utils.getFilteredSBSv2BuildContexts(value) :
+ value.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER).getFilteredBuildConfigurations() :
value.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER).getFilteredBuildConfigurations();
-
+
+ if (configurations == null){
+ return;
+ }
TreeNode[] children = new TreeNode[configurations.size()];
int index = 0;
for (ISymbianBuildContext config : configurations) {