Get SBSv2 macros via Raptor query.
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Mon Jun 21 17:09:18 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Tue Jun 22 14:07:42 2010 -0500
@@ -460,4 +460,14 @@
return configParseErrorMessage;
}
+ @Override
+ public List<String> getMetaDataMacros() {
+ return metaDataMacros;
+ }
+
+ @Override
+ public String getmetaDataVariantHRH() {
+ return metaDataVariantHRH;
+ }
+
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Mon Jun 21 17:09:18 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Tue Jun 22 14:07:42 2010 -0500
@@ -13,17 +13,11 @@
package com.nokia.carbide.cpp.internal.sdk.core.model;
-import java.io.File;
-import java.io.FileReader;
-import java.io.IOException;
-import java.io.Reader;
import java.text.MessageFormat;
import java.util.ArrayList;
-import java.util.Collection;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
-import java.util.regex.Matcher;
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
@@ -35,12 +29,10 @@
import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2MinimumVersionException;
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;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
import com.nokia.cpp.internal.api.utils.core.Logging;
-import com.nokia.cpp.internal.api.utils.core.PathUtils;
/**
* SBSv2 specific build information.
@@ -55,6 +47,7 @@
private Map<String, String> aliasToMeaningMap = new HashMap<String, String>();
private List<String> productList = null;
+ private IPath cachedVariantHRHFile = null;
public SBSv2BuildInfo(ISymbianSDK sdk) {
this.sdk = sdk;
@@ -213,15 +206,26 @@
}
public List<String> getPlatformMacros(String platform) {
- // TODO: Need to get from Raptor Query
- // TODO: Are these the metadata macros or compiler macros? I presume these are the metadata macros
- // but double check on how the CPP macros are applied (e.g. adding '__" prefix to the name.
List<String> platformMacros = cachedPlatformMacros.get(platform.toUpperCase());
if (platformMacros == null) {
+ platformMacros = new ArrayList<String>();
synchronized (cachedPlatformMacros) {
- ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
- platformMacros = sdkMgr.getSymbianMacroStore().getPlatformMacros(sdk.getOSVersion(), "", null, platform);
- cachedPlatformMacros.put(platform.toUpperCase(), platformMacros);
+ if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) {
+ getFilteredBuildConfigurations();
+ }
+ if (sbsv2FilteredConetxts.size() > 0) {
+ for (ISymbianBuildContext context : sbsv2FilteredConetxts) {
+ if (context.getPlatformString().equalsIgnoreCase(platform)) {
+ List<String> macros = ((ISBSv2BuildContext)context).getMetaDataMacros();
+ for (String macro : macros) {
+ if (!platformMacros.contains(macro)) {
+ platformMacros.add(macro);
+ }
+ }
+ }
+ }
+ cachedPlatformMacros.put(platform.toUpperCase(), platformMacros);
+ }
}
}
return platformMacros;
@@ -232,44 +236,21 @@
* @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
*/
public IPath getPrefixFromVariantCfg(){
- File epocRoot = new File(sdk.getEPOCROOT());
- File variantCfg;
- variantCfg = new File(epocRoot, SymbianSDK.SPP_VARIANT_CFG_FILE);
- if (!variantCfg.exists()) {
- variantCfg = new File(epocRoot, SymbianSDK.VARIANT_CFG_FILE);
- if (!variantCfg.exists())
- return null;
- }
-
- String variantDir = null;
- String variantFile = null;
- try {
- char[] cbuf = new char[(int) variantCfg.length()];
- Reader reader = new FileReader(variantCfg);
- reader.read(cbuf);
- reader.close();
- String[] lines = new String(cbuf).split("\r\n|\r|\n");
- for (int i = 0; i < lines.length; i++) {
- // skip comments and blank lines
- String line = SymbianSDK.removeComments(lines[i]);
- if (line.matches("\\s*#.*") || line.trim().length() == 0)
- continue;
-
- // parse the variant line, which is an EPOCROOT-relative
- // path to a bldvariant.hrh file
- Matcher matcher = SymbianSDK.VARIANT_HRH_LINE_PATTERN.matcher(line);
- if (matcher.matches()) {
- variantDir = matcher.group(1);
- variantFile = matcher.group(3);
- File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile);
- IPath variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath()));
- return variantFilePath;
+ if (cachedVariantHRHFile == null) {
+ if (sbsv2FilteredConetxts == null || sbsv2FilteredConetxts.size() == 0) {
+ getFilteredBuildConfigurations();
+ }
+ if (sbsv2FilteredConetxts.size() > 0) {
+ for (ISymbianBuildContext context : sbsv2FilteredConetxts) {
+ String vStr = ((ISBSv2BuildContext)context).getmetaDataVariantHRH();
+ if (vStr != null) {
+ cachedVariantHRHFile = new Path(vStr);
+ break;
+ }
}
}
- } catch (IOException e) {
}
-
- return null; // can't find the file...
+ return cachedVariantHRHFile;
}
public List<String> getTargetTypeMacros(String targettype) {
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java Mon Jun 21 17:09:18 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2BuildContext.java Tue Jun 22 14:07:42 2010 -0500
@@ -1,5 +1,7 @@
package com.nokia.carbide.cpp.sdk.core;
+import java.util.List;
+
public interface ISBSv2BuildContext extends ISymbianBuildContext {
public static final String BUILDER_ID = "com.nokia.carbide.builder.raptor";
@@ -29,4 +31,7 @@
public String getConfigurationErrorMessage();
+ public List<String> getMetaDataMacros();
+
+ public String getmetaDataVariantHRH();
}