# HG changeset patch # User timkelly # Date 1275498123 18000 # Node ID ab555eecf68122660a058b6e17d01c0f1416228f # Parent 8ca7cf978139e3e264fa4cb812038a62e98aa7b6 some work to keep SBSv2 alive while refactoring diff -r 8ca7cf978139 -r ab555eecf681 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Tue Jun 01 15:23:53 2010 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Wed Jun 02 12:02:03 2010 -0500 @@ -27,6 +27,7 @@ import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv1; +import com.nokia.carbide.cpp.internal.api.sdk.BuildContextSBSv2; import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; import com.nokia.cpp.internal.api.utils.core.Check; @@ -54,9 +55,13 @@ // get info from context // TODO: HACK HACK. Hard coded build context to get working.... - Check.checkState(buildContext instanceof BuildContextSBSv1); + Check.checkState(buildContext instanceof BuildContextSBSv1 || buildContext instanceof BuildContextSBSv2); - systemPaths.addAll(((BuildContextSBSv1) buildContext).getCachedSystemIncludePaths()); + if (buildContext instanceof BuildContextSBSv1){ + systemPaths.addAll(((BuildContextSBSv1) buildContext).getCachedSystemIncludePaths()); + } else if (buildContext instanceof BuildContextSBSv2){ + systemPaths.addAll(((BuildContextSBSv2) buildContext).getCachedSystemIncludePaths()); + } } setPaths(null, (File[]) systemPaths.toArray(new File[systemPaths.size()])); } diff -r 8ca7cf978139 -r ab555eecf681 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Tue Jun 01 15:23:53 2010 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java Wed Jun 02 12:02:03 2010 -0500 @@ -1,13 +1,19 @@ package com.nokia.carbide.cpp.internal.api.sdk; import java.io.File; +import java.util.Collections; import java.util.List; import org.eclipse.core.runtime.IPath; +import org.osgi.framework.Version; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +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.ISymbianSDK; +import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; public class BuildContextSBSv2 implements ISBSv2BuildContext { @@ -42,49 +48,168 @@ @Override public String getDisplayString() { - // TODO Auto-generated method stub - return sbsv2Alias; + // TODO We will need to cobble up proper display names + return "(" + sbsv2Alias + ") " + "[" + sdk.getUniqueId() + "]" ; } @Override public String getDefaultDefFileDirectoryName(boolean isASSP) { - // TODO Auto-generated method stub + // TOOD: THIS IS ABLD STUFF. isASSP does not belong with Raptor + // TODO: How the ASSP option affects the path? + + String dirName = getDefFileDirectoryNameForPlatform(platform); + if (dirName == null) { + // check BSF's + IBSFCatalog catalog = getSDK().getBSFCatalog(); + if (catalog != null) { + for (IBSFPlatform plat : catalog.getPlatforms()) { + if (plat.getName().compareToIgnoreCase(platform) == 0) { + String mainPlatform = catalog.getReleasePlatform(platform); + if (mainPlatform != null) { + dirName = getDefFileDirectoryNameForPlatform(mainPlatform); + if (dirName == null || dirName.length() < 1) { + // fallback - all BSF's should be EABI anyway + return "EABI"; //$NON-NLS-1$ + } + } + } + } + } + } + + if (dirName == null) { + // fallback for unknown cases + dirName = platform; + } + + return dirName; + } + + private String getDefFileDirectoryNameForPlatform(String platform) { + // TODO: This is still ABLD stype stuff + if (platform.equals(EMULATOR_PLATFORM)) { + return "BWINS"; //$NON-NLS-1$ + } else if (platform.equals(ARMV5_PLATFORM) + || platform.equals(ARMV5_ABIV2_PLATFORM) + || platform.equals(ARMV6_PLATFORM) + || platform.equals(ARMV6_ABIV2_PLATFORM) + || platform.equals(GCCE_PLATFORM)) { + return "EABI"; //$NON-NLS-1$ + } return null; } - + @Override public IPath getCompilerPrefixFile() { - // TODO Auto-generated method stub + // TODO: This is ABLD hard-code mechanism. Should be able to get from Raptor query mechanism + if (platform.equals(GCCE_PLATFORM)) { + return getGCCEPrefixFilePath(); + } else if (platform.equals(ARMV5_PLATFORM) + || platform.equals(ARMV5_ABIV2_PLATFORM) + || platform.equals(ARMV6_PLATFORM) + || platform.equals(ARMV6_ABIV2_PLATFORM)) { + return getRVCTPrefixFilePath(); + } else { + // check BSF's + IBSFCatalog catalog = getSDK().getBSFCatalog(); + if (catalog != null) { + for (IBSFPlatform plat : catalog.getPlatforms()) { + if (plat.getName().compareToIgnoreCase(platform) == 0) { + String mainPlatform = catalog.getReleasePlatform(platform); + if (mainPlatform != null) { + if (mainPlatform.equals(GCCE_PLATFORM)) { + return getGCCEPrefixFilePath(); + } else if (mainPlatform.equals(ARMV5_PLATFORM) + || mainPlatform.equals(ARMV5_ABIV2_PLATFORM) + || mainPlatform.equals(ARMV6_PLATFORM) + || mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) { + return getRVCTPrefixFilePath(); + } else { + // fallback - all BSF's should be EABI anyway + return getRVCTPrefixFilePath(); + } + } + } + } + } + } + + // fallback for WINSCW, MSVC, etc. return null; } + + private IPath getGCCEPrefixFilePath() { + // TOOD: Should get from Raptor query when available + return getSDK().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 = getSDK().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 getSDK().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 getVariantHRHDefines() { - // TODO Auto-generated method stub - return null; + // TODO: Should get from raptor query + return getCachedData().getVariantHRHDefines(); } @Override public List getPrefixFileIncludes() { - // TODO Auto-generated method stub - return null; + // TODO: Should get from raptor query + return getCachedData().getPrefixFileIncludes(); } @Override public List getCompilerMacros() { - // TODO Auto-generated method stub - return null; + // 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(); + } + + return getCachedData().getCompilerMacros(prefixFile); } @Override public String getBuildVariationName() { - // TODO Auto-generated method stub - return null; + // TODO: This should not be needed for Raptor + return ""; } @Override public boolean isSymbianBinaryVariation() { - // TODO Auto-generated method stub + // This should not be needed for Raptor. We do need a check + // in the MPP for the featurevariant keyword perhaps return false; } @@ -111,6 +236,24 @@ return sbsv2Alias; } + /** + * Get the cache holding the data that applies to this build context globally. + * A build context is subclassed by CarbideBuildConfiguration, which has multiple + * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself. + * @return cache, never null + */ + private SymbianBuildContextDataCache getCachedData() { + // TODO: Still need to consider this for SBSv2 refactoring / Raptor query + return SymbianBuildContextDataCache.getCache(this); + } + /** + * Get the list of #include paths detected for this context. + * @return List or null + */ + public List getCachedSystemIncludePaths() { + // TODO: Still need to consider this for SBSv2 refactoring / Raptor query + return getCachedData().getSystemIncludePaths(); + } }