Raptor scanner discovery on top of new Raptor Query API.
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Thu Jul 01 16:36:11 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/EpocEngineHelper.java Thu Jul 15 23:28:04 2010 -0500
@@ -76,7 +76,6 @@
import com.nokia.carbide.cpp.epoc.engine.preprocessor.AllNodesViewFilter;
import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1;
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
-import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
import com.nokia.carbide.cpp.internal.api.sdk.SymbianBuildContextDataCache;
import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext;
import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
@@ -753,16 +752,13 @@
}
ISymbianSDK sdk = buildConfig.getSDK();
- String releasePlatform;
+ ISymbianBuildContext context = buildConfig.getBuildContext();
IPath path;
- if (buildConfig.getBuildContext() instanceof ISBSv2BuildContext) {
- ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
- // TODO: This will need to be the release folder name from the SBSv2Context. Could fail for a variant
- releasePlatform = buildConfig.getPlatformString();
- path = sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(buildConfig.getTargetString().toLowerCase());
+ if (context instanceof ISBSv2BuildContext) {
+ path = new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString());
} else {
ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
- releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString());
+ String releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(buildConfig.getPlatformString());
path = sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(buildConfig.getTargetString().toLowerCase());
}
--- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Thu Jul 01 16:36:11 2010 -0500
+++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideBuildConfiguration.java Thu Jul 15 23:28:04 2010 -0500
@@ -49,7 +49,6 @@
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1;
import com.nokia.carbide.cpp.internal.api.sdk.ISBSv1BuildInfo;
-import com.nokia.carbide.cpp.internal.api.sdk.SBSv2Utils;
import com.nokia.carbide.cpp.internal.api.sdk.SDKManagerInternalAPI;
import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext;
import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
@@ -457,20 +456,15 @@
}
public IPath getTargetOutputDirectory() {
- String releasePlatform = "";
- ISymbianSDK sdk = getSDK();
- if (context instanceof ISBSv1BuildContext){
+ if (context instanceof ISBSv2BuildContext){
+ return new Path(((ISBSv2BuildContext)context).getConfigQueryData().getOutputPathString());
+ } else {
+ ISymbianSDK sdk = getSDK();
ISBSv1BuildContext v1Context = (ISBSv1BuildContext)context;
ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
- releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(v1Context.getBasePlatformForVariation());
- } else if (CarbideBuilderPlugin.getBuildManager().isCarbideSBSv2Project(getCarbideProject().getProject())){
- // Test is this is an SBSv2 build binary variant (changes the output directory)
- ISBSv2BuildConfigInfo sbsv2Info = getSBSv2BuildConfigInfo();
- if ( sbsv2Info != null && SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT)) != null && !releasePlatform.contains(".") ){
- releasePlatform = releasePlatform + SBSv2Utils.getVariantOutputDirModifier(sbsv2Info.getSBSv2Setting(ISBSv2BuildConfigInfo.ATTRIB_SBSV2_VARIANT));
- }
- }
- return sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(getTargetString().toLowerCase());
+ String releasePlatform = sbsv1BuildInfo.getBSFCatalog().getReleasePlatform(v1Context.getBasePlatformForVariation());
+ return sdk.getReleaseRoot().append(releasePlatform.toLowerCase()).append(getTargetString().toLowerCase());
+ }
}
public boolean getRebuildNeeded() {
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Thu Jul 15 23:28:04 2010 -0500
@@ -34,6 +34,7 @@
suite.addTestSuite(TestSDKChangeListener.class);
suite.addTestSuite(TestDevicesXMLListener.class);
suite.addTestSuite(TestCarbideSDKCache.class);
+ suite.addTestSuite(TestSBSv2BuildContext.class);
//$JUnit-END$
return suite;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestSBSv2BuildContext.java Thu Jul 15 23:28:04 2010 -0500
@@ -0,0 +1,89 @@
+package com.nokia.carbide.cpp.sdk.core.test;
+
+import java.io.File;
+import java.util.Iterator;
+import java.util.List;
+
+import junit.framework.TestCase;
+
+import com.nokia.carbide.cpp.internal.api.sdk.ISBSv2BuildInfo;
+import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISDKBuildInfo;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
+import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+
+public class TestSBSv2BuildContext extends TestCase {
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testBuildContextsInSDKs() throws Exception {
+ List<ISymbianSDK> sdkList = SDKCorePlugin.getSDKManager().getSDKList();
+ for (Iterator<ISymbianSDK> sdkItr = sdkList.iterator(); sdkItr.hasNext();) {
+ ISymbianSDK sdk = sdkItr.next();
+ ISDKBuildInfo buildInfo = sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
+ if (buildInfo != null) {
+ assertTrue(buildInfo instanceof ISBSv2BuildInfo);
+ List<ISymbianBuildContext> contextList = buildInfo.getFilteredBuildConfigurations();
+ if (contextList != null && contextList.size() > 0) {
+ for (Iterator<ISymbianBuildContext> cItr = contextList.iterator(); cItr.hasNext();) {
+ ISymbianBuildContext context = cItr.next();
+ assertTrue(context instanceof ISBSv2BuildContext);
+ testBuildContext((ISBSv2BuildContext)context);
+ }
+ }
+ }
+ }
+ }
+
+ private void testBuildContext(ISBSv2BuildContext context) {
+ // getConfigQueryData()
+ assertNotNull(context.getConfigQueryData());
+
+ // getConfigID()
+ assertNotNull(context.getConfigID());
+
+ // getDisplayString()
+ assertNotNull(context.getDisplayString());
+
+ // getDefaultDefFileDirectoryName()
+ assertNotNull(context.getDefaultDefFileDirectoryName());
+
+ // getPlatformString()
+ assertNotNull(context.getPlatformString());
+
+ // getSBSv2Alias()
+ assertNotNull(context.getSBSv2Alias());
+ String sbsv2Alias = context.getSBSv2Alias();
+
+ // getTargetString()
+ assertNotNull(context.getTargetString());
+
+ // getCompilerPrefixFile()
+ if (sbsv2Alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_GCCE) ||
+ sbsv2Alias.toUpperCase().contains(ISBSv2BuildContext.TOOLCHAIN_ARM)) {
+ assertNotNull(context.getCompilerPrefixFile());
+ }
+
+ // getVariantHRHDefines()
+ assertNotNull(context.getVariantHRHDefines());
+
+ // getPrefixFileIncludes()
+ assertNotNull(context.getPrefixFileIncludes());
+ for (Iterator<File> itr = context.getPrefixFileIncludes().iterator(); itr.hasNext();) {
+ File includeFile = itr.next();
+ assertTrue(includeFile.exists());
+ }
+
+ // getCompilerMacros()
+ assertNotNull(context.getCompilerMacros());
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Thu Jul 15 23:28:04 2010 -0500
@@ -1,21 +1,30 @@
package com.nokia.carbide.cpp.internal.api.sdk;
import java.io.File;
+import java.text.MessageFormat;
+import java.util.ArrayList;
import java.util.Collections;
import java.util.List;
+import java.util.Map;
import org.eclipse.core.runtime.IPath;
+import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Path;
-import org.osgi.framework.Version;
+import org.eclipse.jface.dialogs.MessageDialog;
+import org.eclipse.ui.PlatformUI;
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
-import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
+import com.nokia.carbide.cpp.internal.api.sdk.sbsv2.SBSv2ConfigQueryData;
+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.ISBSv2ConfigQueryData;
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.Check;
+import com.nokia.cpp.internal.api.utils.core.Logging;
+import com.nokia.cpp.internal.api.utils.ui.WorkbenchUtils;
public class BuildContextSBSv2 implements ISBSv2BuildContext {
@@ -36,6 +45,7 @@
this.sbsv2Alias = alias;
this.displayString = displayString;
this.configID = configID;
+ this.configQueryData = setConfigQueryData(sdk, alias);
}
public BuildContextSBSv2(ISymbianSDK sdk, String alias, ISBSv2ConfigQueryData configData) {
@@ -118,74 +128,29 @@
@Override
public IPath getCompilerPrefixFile() {
- if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_GCCE)) {
- return getGCCEPrefixFilePath();
- } else if (sbsv2Alias.toUpperCase().contains((TOOLCHAIN_ARM))) {
- return getRVCTPrefixFilePath();
+ if (sbsv2Alias.toUpperCase().contains(TOOLCHAIN_GCCE) ||
+ sbsv2Alias.toUpperCase().contains(TOOLCHAIN_ARM)) {
+ if (configQueryData != null) {
+ return new Path(configQueryData.getBuildPrefix());
+ }
}
// fallback for WINSCW, MSVC, etc.
return null;
}
- private IPath getIncludePath() {
- return getSDK().getIncludePath();
- }
-
- private IPath getGCCEPrefixFilePath() {
- // TOOD: Should get from Raptor query when available
- return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
- }
-
- private IPath getRVCTPrefixFilePath() {
- // TODO: Should get this from query mechanism
- IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
- // use default in case tools aren't installed
- String rvctFragment = "rvct2_2"; //$NON-NLS-1$
- if (installedRVCTTools.length > 0) {
- rvctFragment = getRVCTFragment(installedRVCTTools[0]);
- }
- IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
- if (prefixFilePath.toFile().exists()){
- return prefixFilePath;
- } else {
- // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones
- // based on the default installation
- return getIncludePath().append("rvct").append("rvct" + ".h");
- }
- }
-
- private String getRVCTFragment(IRVCTToolChainInfo info) {
- // TODO: This should not be needed when raptor query is complete
- int major = 0, minor = 0;
- if (info != null) {
- Version rvctToolsVersion = info.getRvctToolsVersion();
- if (rvctToolsVersion != null) {
- major = info.getRvctToolsVersion().getMajor();
- minor = info.getRvctToolsVersion().getMinor();
- }
- }
- return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$
- }
-
@Override
public List<IDefine> getVariantHRHDefines() {
- // TODO: Should get from raptor query
return getCachedData().getVariantHRHDefines();
}
@Override
public List<File> getPrefixFileIncludes() {
- // TODO: Should get from raptor query
return getCachedData().getPrefixFileIncludes();
}
@Override
public List<IDefine> getCompilerMacros() {
- // TODO: Should get from raptor query
- // we parse the compiler prefix file to gather macros. this can be time consuming so do it
- // once and cache the values. only reset the cache when the compiler prefix has changed.
-
IPath prefixFile = getCompilerPrefixFile();
if (prefixFile == null) {
return Collections.emptyList();
@@ -219,7 +184,6 @@
* @return cache, never <code>null</code>
*/
private SymbianBuildContextDataCache getCachedData() {
- // TODO: Still need to consider this for SBSv2 refactoring / Raptor query
return SymbianBuildContextDataCache.getCache(this);
}
@@ -228,7 +192,6 @@
* @return List or <code>null</code>
*/
public List<File> getCachedSystemIncludePaths() {
- // TODO: Still need to consider this for SBSv2 refactoring / Raptor query
return getCachedData().getSystemIncludePaths();
}
@@ -253,26 +216,10 @@
if (!(obj instanceof BuildContextSBSv2))
return false;
final BuildContextSBSv2 other = (BuildContextSBSv2) obj;
- if (sbsv2Alias == null) {
- if (other.sbsv2Alias != null)
- return false;
- } else if (!sbsv2Alias.equalsIgnoreCase(other.sbsv2Alias))
- return false;
- if (getSDK() == null) {
- if (other.getSDK() != null)
- return false;
- } else if (!getSDK().getEPOCROOT().equalsIgnoreCase(other.getSDK().getEPOCROOT()))
- return false;
- if (target == null) {
- if (other.target != null)
- return false;
- } else if (!target.equalsIgnoreCase(other.target)) {
- return false;
- } else if (!configID.equalsIgnoreCase(other.configID)){
- // TODO: Do we really need anything other than a config ID comparison?
+ if (!configID.equalsIgnoreCase(other.configID)){
return false;
}
- return true;
+ return true;
}
public static String getPlatformFromV1ConfigName(String displayString) {
@@ -314,7 +261,11 @@
}
private void setPlatformAndTargetFromOutputPath() {
- if (configQueryData.getOutputPathString() == null) return;
+ if (configQueryData.getOutputPathString() == null) {
+ platform = "";
+ target = "";
+ return;
+ }
IPath releasePath = new Path(configQueryData.getOutputPathString());
int epoc32SegmentIndex = 0;
@@ -324,12 +275,37 @@
epoc32SegmentIndex++;
}
// assuming /epoc32/<release>/<target>/
- platform = releasePath.segment(epoc32SegmentIndex+2);
- target = releasePath.segment(epoc32SegmentIndex+3);
+ platform = releasePath.segment(epoc32SegmentIndex+2).toUpperCase();
+ target = releasePath.segment(epoc32SegmentIndex+3).toUpperCase();
+ }
+
+ private ISBSv2ConfigQueryData setConfigQueryData(ISymbianSDK sdk, String alias) {
+ SBSv2ConfigQueryData configQueryData = null;
+ try {
+ configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
+ if (configQueryData == null) {
+ Map<String, String> aliasToMeaningMap = SBSv2QueryUtils.getAliasesForSDK(sdk);
+ List<String> aliasList = new ArrayList<String>();
+ aliasList.add(alias);
+ String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, aliasList);
+ if (aliasToMeaningMap.get(alias) != null){
+ configQueryData = new SBSv2ConfigQueryData(alias, aliasToMeaningMap.get(alias), configQueryXML);
+ }
+ }
+ } catch (final SBSv2MinimumVersionException e) {
+ PlatformUI.getWorkbench().getDisplay().asyncExec(new Runnable() {
+ public void run() {
+ MessageDialog.openError(WorkbenchUtils.getSafeShell(), "Minimum sbs version not met.", e.getMessage());
+ }
+ });
+ Logging.log(SDKCorePlugin.getDefault(), Logging.newSimpleStatus(0, IStatus.ERROR,
+ MessageFormat.format(e.getMessage(), ""), e));
+ }
+
+ return configQueryData;
}
public ISBSv2ConfigQueryData getConfigQueryData() {
return configQueryData;
}
-
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/ISBSv2BuildInfo.java Thu Jul 15 23:28:04 2010 -0500
@@ -26,8 +26,6 @@
*/
public interface ISBSv2BuildInfo extends ISDKBuildInfo {
- void clearPlatformMacros();
-
/**
* Returns the list of all platform macros for a SDK.
* <p>
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SDKCacheUtils.java Thu Jul 15 23:28:04 2010 -0500
@@ -0,0 +1,58 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Nokia and others.
+ * All rights reserved. This program and the accompanying materials
+ * are made available under the terms of the Eclipse Public License v1.0
+ * which accompanies this distribution, and is available at
+ * http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Nokia - Initial API and implementation
+ *******************************************************************************/
+
+package com.nokia.carbide.cpp.internal.api.sdk;
+
+import java.io.FileInputStream;
+import java.io.IOException;
+import java.io.ObjectInputStream;
+import java.io.ObjectStreamClass;
+
+import org.eclipse.core.runtime.IPath;
+
+import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.cpp.internal.api.utils.core.CacheUtils;
+
+public class SDKCacheUtils extends CacheUtils {
+
+ public SDKCacheUtils(IPath defaultLocation) {
+ super(defaultLocation);
+ }
+
+ protected CacheEntry loadCachedData(IPath location, String cacheIdentifier) {
+ IPath flushPath = location.append(Integer.toString(cacheIdentifier.hashCode())).addFileExtension("txt");
+
+ if (flushPath.toFile().exists()) {
+ try {
+ final ClassLoader classLoader = SDKCorePlugin.getDefault().getClass().getClassLoader();
+ FileInputStream fis = new FileInputStream(flushPath.toFile());
+ ObjectInputStream ois = new ObjectInputStream(fis) {
+
+ @Override
+ protected Class<?> resolveClass(ObjectStreamClass desc)
+ throws IOException, ClassNotFoundException {
+ String name = desc.getName();
+ try {
+ return classLoader.loadClass(name);
+ } catch (ClassNotFoundException e) {
+ return super.resolveClass(desc);
+ }
+ }};
+ return new CacheEntry(ois);
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ return null;
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContextDataCache.java Thu Jul 15 23:28:04 2010 -0500
@@ -102,6 +102,7 @@
private ExternalFileInfoCollection compilerPrefixFileInfo = null;
private List<File> systemIncludes;
private ISymbianSDK sdk;
+ private ISymbianBuildContext context;
private IPath compilerPrefixFile;
private String platformString;
@@ -118,6 +119,7 @@
private SymbianBuildContextDataCache(ISymbianBuildContext context) {
if (DEBUG) System.out.println("Creating cache for " + context.getDisplayString());
+ this.context = context;
this.platformString = context.getPlatformString();
this.displayString = context.getDisplayString();
this.sdk = context.getSDK();
@@ -174,11 +176,11 @@
List<IDefine> macros = new ArrayList<IDefine>();
Map<String, IDefine> namedMacros = new HashMap<String, IDefine>();
File prefixFile = sdk.getPrefixFile(builderId);
+ ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId);
if (prefixFile == null){
// Check that the prefix file may have become available since the SDK was scanned last.
// This can happen, for e.g., if the user opens the IDE _then_ does a subst on a drive that already has an SDK entry.
- ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId);
IPath prefixCheck = buildInfo.getPrefixFromVariantCfg();
if (prefixCheck != null){
prefixFile = prefixCheck.toFile();
@@ -194,30 +196,28 @@
// Always add epoc32/include to the search path as this is implicit for includes in the HRH
systemPaths.add(new File(sdk.getEPOCROOT() + "epoc32/include"));
- // add any BSF/SBV includes so the headers are picked up from the correct location
- IBSFPlatform bsfPlat = null;
- ISBVPlatform sbvPlat = null;
- ISDKBuildInfo buildInfo = sdk.getBuildInfo(builderId);
if (buildInfo instanceof ISBSv1BuildInfo) {
+ // add any BSF/SBV includes so the headers are picked up from the correct location
// SBSv1 only
ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)buildInfo;
- bsfPlat = sbsv1BuildInfo.getBSFCatalog().findPlatform(platformString);
- sbvPlat = sbsv1BuildInfo.getSBVCatalog().findPlatform(platformString);
- }
- if (bsfPlat != null) {
- for (IPath path : bsfPlat.getSystemIncludePaths()) {
- systemPaths.add(path.toFile());
- }
- } else if (sbvPlat != null) {
- LinkedHashMap<IPath, String> platPaths = sbvPlat.getBuildIncludePaths();
- Set<IPath> set = platPaths.keySet();
- for (IPath path : set) {
- String pathType = platPaths.get(path);
- if (pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_PREPEND) || pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_SET)){
+ IBSFPlatform bsfPlat = sbsv1BuildInfo.getBSFCatalog().findPlatform(platformString);
+ ISBVPlatform sbvPlat = sbsv1BuildInfo.getSBVCatalog().findPlatform(platformString);
+
+ if (bsfPlat != null) {
+ for (IPath path : bsfPlat.getSystemIncludePaths()) {
systemPaths.add(path.toFile());
}
+ } else if (sbvPlat != null) {
+ LinkedHashMap<IPath, String> platPaths = sbvPlat.getBuildIncludePaths();
+ Set<IPath> set = platPaths.keySet();
+ for (IPath path : set) {
+ String pathType = platPaths.get(path);
+ if (pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_PREPEND) || pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_SET)){
+ systemPaths.add(path.toFile());
+ }
+ }
}
- }
+ }
MacroScanner scanner = new MacroScanner(
new BasicIncludeFileLocator(null, systemPaths.toArray(new File[systemPaths.size()])),
@@ -339,6 +339,19 @@
compilerPrefixFileInfo.setFiles(files);
}
+ if (context instanceof ISBSv2BuildContext) {
+ // add macros from raptor query
+ ISBSv2BuildContext v2Context = (ISBSv2BuildContext) context;
+ Map<String, String> buildMacros = v2Context.getConfigQueryData().getBuildMacros();
+ if (buildMacros != null) {
+ for (Iterator<String> itr = buildMacros.keySet().iterator(); itr.hasNext(); ) {
+ String name = itr.next();
+ String value = buildMacros.get(name);
+ macros.add(DefineFactory.createDefine(name, value));
+ }
+ }
+ }
+
compilerPrefixMacros = macros;
saveCacheFile();
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2ConfigQueryData.java Thu Jul 15 23:28:04 2010 -0500
@@ -22,49 +22,96 @@
public class SBSv2ConfigQueryData implements ISBSv2ConfigQueryData {
+ private static final long serialVersionUID = 3358697901364441158L;
+
+ private String alias = "";
+ private String meaning = "";
+
// Raptor config query data
private Map<String, String> buildMacros = new HashMap<String, String>(); // cpp preprocessor macros
private Map<String, String> metaDataMacros = new HashMap<String, String>(); // macros to parse the INF/MMPs files (these do not contain values)
private List<String> metaDataIncludes = new ArrayList<String>();
- private String buildPrefix;
- private String metaDataVariantHRH;
- private String meaning;
- private String outputPathString;
- private String configurationErrorMessage = null;
+ private String buildPrefix = "";
+ private String metaDataVariantHRH = "";
+ private String outputPathString = "";
+ private String configurationErrorMessage = "";
- public SBSv2ConfigQueryData(String meaning, String queryResult) {
+ public SBSv2ConfigQueryData() {
+ this.alias = "";
+ this.meaning = "";
+ }
+
+ public SBSv2ConfigQueryData(String alias, String meaning, String queryResult) {
+ this.alias = alias;
this.meaning = meaning;
parseQueryConfigResults(queryResult);
}
+ @Override
+ public String getAlias() {
+ return alias;
+ }
+
+ @Override
public String getBuildPrefix() {
return buildPrefix;
}
+ @Override
public Map<String, String> getBuildMacros() {
return buildMacros;
}
+ @Override
public String getConfigurationErrorMessage() {
return configurationErrorMessage;
}
+ @Override
public Map<String, String> getMetaDataMacros() {
return metaDataMacros;
}
+ @Override
public List<String> getMetaDataIncludes() {
return metaDataIncludes;
}
+ @Override
public String getMetaDataVariantHRH() {
return metaDataVariantHRH;
}
+ @Override
public String getOutputPathString() {
return outputPathString;
}
+ @Override
+ public int hashCode() {
+ final int prime = 31;
+ int result = 1;
+ result = prime * result + ((alias == null) ? 0 : alias.hashCode());
+ return result;
+ }
+
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj)
+ return true;
+ if (obj == null)
+ return false;
+ if (getClass() != obj.getClass())
+ return false;
+ SBSv2ConfigQueryData other = (SBSv2ConfigQueryData) obj;
+ if (alias == null) {
+ if (other.alias != null)
+ return false;
+ } else if (!alias.equals(other.alias))
+ return false;
+ return true;
+ }
+
private void parseQueryConfigResults(String queryResult) {
try {
Element root = null;
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/sbsv2/SBSv2QueryUtils.java Thu Jul 15 23:28:04 2010 -0500
@@ -107,26 +107,55 @@
return products;
}
- @SuppressWarnings("unchecked")
public static String getConfigQueryXMLforSDK(ISymbianSDK sdk, List<String> aliasOrMeaningArray) throws SBSv2MinimumVersionException {
- String configs;
- Map<String, String> configsMap = SDKCorePlugin.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0);
- SBSv2SDKKey key = new SBSv2SDKKey(sdk);
-
- if (configsMap == null) {
- configsMap = new HashMap<String, String>();
+
+ checkForMinimumRaptorVersion();
+
+ List<String> argListConfigQuery = new ArrayList<String>();
+ for (String alias : aliasOrMeaningArray){
+ argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]");
}
- else {
- configs = configsMap.get(key.toString());
- if (configs != null) {
- return configs;
+
+ Properties envVars = null;
+ if (sdk != null){
+ File epocRoot = new File(sdk.getEPOCROOT());
+ if (epocRoot.exists()){
+ envVars = EnvironmentReader.getEnvVars();
+ envVars.setProperty("EPOCROOT", sdk.getEPOCROOT());
}
}
- configs = getConfigurations(sdk, aliasOrMeaningArray);
- configsMap.put(key.toString(), configs);
- SDKCorePlugin.getCache().putCachedData(CONFIG_CACHE_KEY, (Serializable)configsMap, 0);
- return configs;
+ return getSBSQueryOutput(argListConfigQuery, createEnvStringList(envVars));
+ }
+
+ @SuppressWarnings("unchecked")
+ public static SBSv2ConfigQueryData getConfigQueryDataForSDK(ISymbianSDK sdk, String alias) {
+ SBSv2ConfigQueryData configQueryData = null;
+ Map<String, SBSv2ConfigQueryData> configsMap = SDKCorePlugin.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0);
+ String key = (new SBSv2SDKKey(sdk)).toString() + "[" + alias + "]";
+
+ if (configsMap != null) {
+ configQueryData = configsMap.get(key);
+ }
+ return configQueryData;
+ }
+
+ @SuppressWarnings("unchecked")
+ public static void storeConfigQueryDataForSDK(ISymbianSDK sdk, String alias, SBSv2ConfigQueryData configQueryData) {
+ Map<String, SBSv2ConfigQueryData> configsMap = SDKCorePlugin.getCache().getCachedData(CONFIG_CACHE_KEY, Map.class, 0);
+ String key = (new SBSv2SDKKey(sdk)).toString() + "[" + alias + "]";
+
+ if (configsMap == null) {
+ configsMap = new HashMap<String, SBSv2ConfigQueryData>();
+ } else {
+ if (configsMap.get(key) != null) {
+ // configQueryData already exist in cache
+ return;
+ }
+ }
+
+ configsMap.put(key, configQueryData);
+ SDKCorePlugin.getCache().putCachedData(CONFIG_CACHE_KEY, (Serializable)configsMap, 0);
}
public static HashMap<String, String> queryConfigTargetInfo(ISymbianSDK sdk, List<String> aliasOrMeaningArray) throws SBSv2MinimumVersionException{
@@ -217,27 +246,6 @@
return parseQueryProductsResults(queryResult);
}
- private static String getConfigurations(ISymbianSDK sdk, List<String> aliasOrMeaningArray) throws SBSv2MinimumVersionException {
-
- checkForMinimumRaptorVersion();
-
- List<String> argListConfigQuery = new ArrayList<String>();
- for (String alias : aliasOrMeaningArray){
- argListConfigQuery.add(QUERY_CONFIG_COMMAND + "[" + alias + "]");
- }
-
- 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));
- }
-
private static String getSBSQueryOutput(List<String> queryCommandList, String[] env) {
String overallOutput = "";
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBSv2BuildInfo.java Thu Jul 15 23:28:04 2010 -0500
@@ -60,12 +60,6 @@
}
@Override
- public void clearPlatformMacros() {
- // TODO Auto-generated method stub
-
- }
-
- @Override
public List<ISymbianBuildContext> getAllBuildConfigurations() {
// TODO: Will get rid of this method. Only filtered configs will apply
return sbsv2FilteredConetxts;
@@ -145,22 +139,33 @@
contextExists = false;
}
- String configQueryXML = "";
- try {
- configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, newContextsToQuery);
- } catch (SBSv2MinimumVersionException e) {
- // ignore, previous exception would have caught the error
+ List<String> processedAliasList = new ArrayList<String>();
+ for (String alias : newContextsToQuery) {
+ SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
+ if (configQueryData != null) {
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ processedAliasList.add(alias);
+ }
+ }
+
+ if (!processedAliasList.isEmpty()) {
+ newContextsToQuery.removeAll(processedAliasList);
}
- for (String alias : newContextsToQuery){
- // TODO: Need to test for variants. Right now variants are not added
- if (aliasToMeaningMap.get(alias) == null){
- continue; // This alias is not valid with this SDK, ignore
+
+ if (!newContextsToQuery.isEmpty()) {
+ String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, newContextsToQuery);
+
+ for (String alias : newContextsToQuery){
+ // TODO: Need to test for variants. Right now variants are not added
+ if (aliasToMeaningMap.get(alias) == null){
+ continue; // This alias is not valid with this SDK, ignore
+ }
+ ISBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, aliasToMeaningMap.get(alias), configQueryXML);
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
+ sbsv2FilteredConetxts.add(sbsv2Context);
}
- ISBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(aliasToMeaningMap.get(alias), configQueryXML);
- ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
- sbsv2FilteredConetxts.add(sbsv2Context);
- }
-
+ }
}
private void initSBSv2BuildContextList(List<String> allowedConfigs) throws SBSv2MinimumVersionException {
@@ -188,22 +193,39 @@
}
}
}
-
- String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, filteredAliasList);
+ List<String> processedAliasList = new ArrayList<String>();
for (String alias : filteredAliasList) {
- String meaning = "";
- if (alias.contains(".")){
- meaning = getMeaningForVariant(alias);
- } else {
- meaning = aliasToMeaningMap.get(alias);
+ SBSv2ConfigQueryData configQueryData = SBSv2QueryUtils.getConfigQueryDataForSDK(sdk, alias);
+ if (configQueryData != null) {
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ processedAliasList.add(alias);
}
- if (meaning == null){
- continue; // TODO: How to handle this scenario
+ }
+
+ if (!processedAliasList.isEmpty()) {
+ filteredAliasList.removeAll(processedAliasList);
+ }
+
+ if (!filteredAliasList.isEmpty()) {
+ String configQueryXML = SBSv2QueryUtils.getConfigQueryXMLforSDK(sdk, filteredAliasList);
+
+ for (String alias : filteredAliasList) {
+ String meaning = "";
+ if (alias.contains(".")){
+ meaning = getMeaningForVariant(alias);
+ } else {
+ meaning = aliasToMeaningMap.get(alias);
+ }
+ if (meaning == null){
+ continue; // TODO: How to handle this scenario
+ }
+ SBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(alias, meaning, configQueryXML);
+ ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
+ sbsv2FilteredConetxts.add(sbsv2Context);
+ SBSv2QueryUtils.storeConfigQueryDataForSDK(sdk, alias, configQueryData);
}
- ISBSv2ConfigQueryData configQueryData = new SBSv2ConfigQueryData(meaning, configQueryXML);
- ISBSv2BuildContext sbsv2Context = new BuildContextSBSv2(sdk, alias, configQueryData);
- sbsv2FilteredConetxts.add(sbsv2Context);
}
}
@@ -223,7 +245,7 @@
}
public Map<String, String> getPlatformMacros(String platform) {
- Map<String, String> platformMacros = cachedPlatformMacros.get(platform.toUpperCase());
+ Map<String, String> platformMacros = cachedPlatformMacros.get(platform);
if (platformMacros == null) {
platformMacros = new HashMap<String, String>();
synchronized (cachedPlatformMacros) {
@@ -233,11 +255,10 @@
if (sbsv2FilteredConetxts.size() > 0) {
for (ISymbianBuildContext context : sbsv2FilteredConetxts) {
if (context.getPlatformString().equalsIgnoreCase(platform)) {
- platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getBuildMacros());
platformMacros.putAll(((ISBSv2BuildContext)context).getConfigQueryData().getMetaDataMacros());
}
}
- cachedPlatformMacros.put(platform.toUpperCase(), platformMacros);
+ cachedPlatformMacros.put(platform, platformMacros);
}
}
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SymbianSDK.java Thu Jul 15 23:28:04 2010 -0500
@@ -359,7 +359,6 @@
ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
sbsv1BuildInfo.clearPlatformMacros();
- sbsv2BuildInfo.clearPlatformMacros();
if (!setDataFromManifestXML()){
//need to scan SDK files for OS and SDK version
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBSv2ConfigQueryData.java Thu Jul 15 23:28:04 2010 -0500
@@ -1,9 +1,11 @@
package com.nokia.carbide.cpp.sdk.core;
+import java.io.Serializable;
import java.util.List;
import java.util.Map;
-public interface ISBSv2ConfigQueryData {
+public interface ISBSv2ConfigQueryData extends Serializable {
+ public String getAlias();
public String getBuildPrefix();
public Map<String, String> getBuildMacros();
public String getConfigurationErrorMessage();
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/SDKCorePlugin.java Thu Jul 15 23:28:04 2010 -0500
@@ -17,10 +17,10 @@
import org.eclipse.core.runtime.Plugin;
import org.osgi.framework.BundleContext;
+import com.nokia.carbide.cpp.internal.api.sdk.SDKCacheUtils;
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManagerRaptorOnly;
import com.nokia.cpp.internal.api.utils.core.HostOS;
-import com.nokia.cpp.internal.api.utils.core.CacheUtils;
/**
@@ -41,7 +41,7 @@
private static ISDKManager sdkManager;
- private static CacheUtils cache;
+ private static SDKCacheUtils cache;
/**
* The constructor
@@ -106,11 +106,11 @@
* Get the persistent cache this plugin.
* @return PersistentCache instance
*/
- public static CacheUtils getCache() {
+ public static SDKCacheUtils getCache() {
if (cache == null)
{
IPath path = new Path(System.getProperty("user.home"));
- cache = new CacheUtils(path.append(CACHE_FOLDER_NAME));
+ cache = new SDKCacheUtils(path.append(CACHE_FOLDER_NAME));
}
return cache;
}
--- a/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java Thu Jul 01 16:36:11 2010 -0500
+++ b/core/com.nokia.cpp.utils.core/src/com/nokia/cpp/internal/api/utils/core/CacheUtils.java Thu Jul 15 23:28:04 2010 -0500
@@ -30,7 +30,7 @@
public class CacheUtils {
- private class CacheEntry {
+ protected class CacheEntry {
private String identifier;
private long freshness;
@@ -129,7 +129,7 @@
return null;
}
- private CacheEntry loadCachedData(IPath location, String cacheIdentifier) {
+ protected CacheEntry loadCachedData(IPath location, String cacheIdentifier) {
IPath flushPath = location.append(Integer.toString(cacheIdentifier.hashCode())).addFileExtension("txt");
if (flushPath.toFile().exists()) {
@@ -149,7 +149,9 @@
}
}};
return new CacheEntry(ois);
- } catch (Exception e) {}
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
}
return null;