# HG changeset patch # User timkelly # Date 1242148780 18000 # Node ID 2bb08686aa3855fede7ad129fa005db2bab3b5f5 # Parent 8eed74449d218b270f9eb64b81f26941a98e8d41 add support to add BUILD_INCLUDE system paths defined from build variants to project configurations. diff -r 8eed74449d21 -r 2bb08686aa38 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 May 12 10:46:48 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Tue May 12 12:19:40 2009 -0500 @@ -20,15 +20,14 @@ package com.nokia.carbide.cdt.builder; import java.io.File; -import java.util.ArrayList; -import java.util.List; +import java.util.*; import org.eclipse.core.resources.IProject; import org.eclipse.core.runtime.IPath; import com.nokia.carbide.cdt.builder.project.ICarbideProjectInfo; -import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; -import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; +import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; +import com.nokia.carbide.cpp.sdk.core.*; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; public class DefaultIncludeFileLocator extends BasicIncludeFileLocator { @@ -60,16 +59,29 @@ File dir; // get additional include directories from BSF platform, if defined - IBSFPlatform platform = buildContext.getSDK().getBSFCatalog().findPlatform(buildContext.getPlatformString()); - if (platform != null) { - IPath[] systemIncludePaths = platform.getSystemIncludePaths(); + IBSFPlatform bsfplatform = buildContext.getSDK().getBSFCatalog().findPlatform(buildContext.getPlatformString()); + ISBVPlatform sbvPlatform = buildContext.getSDK().getSBVCatalog().findPlatform(buildContext.getPlatformString()); + if (bsfplatform != null) { + IPath[] systemIncludePaths = bsfplatform.getSystemIncludePaths(); for (IPath path : systemIncludePaths) { dir = path.toFile(); if (dir.exists() && dir.isDirectory()) { systemPaths.add(dir); } } - } else { + } else if (sbvPlatform != null){ + + Map platPaths = sbvPlatform.getBuildIncludePaths(); + Set 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)){ + dir = path.toFile(); + systemPaths.add(dir); + } + } + } + else { // legacy behavior if (buildContext.getPlatformString().equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { dir = new File(includeDir, "wins"); //$NON-NLS-1$ @@ -87,6 +99,20 @@ // and finally the normal include dir systemPaths.add(includeDir); + + // and finally, finally, if this is an SBV add any paths with the append flag + if (sbvPlatform != null){ + + Map platPaths = sbvPlatform.getBuildIncludePaths(); + Set set = platPaths.keySet(); + for (IPath path : set) { + String pathType = platPaths.get(path); + if (pathType.equalsIgnoreCase(ISBVView.INCLUDE_FLAG_APPEND)){ + dir = path.toFile(); + systemPaths.add(dir); + } + } + } } // also search files in same folder as variant.hrh diff -r 8eed74449d21 -r 2bb08686aa38 builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java --- a/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Tue May 12 10:46:48 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Tue May 12 12:19:40 2009 -0500 @@ -17,40 +17,24 @@ package com.nokia.carbide.cdt.internal.builder; import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.HashSet; -import java.util.List; -import java.util.Map; -import java.util.Set; +import java.util.*; import org.eclipse.cdt.core.CCorePlugin; import org.eclipse.cdt.core.model.CoreModel; -import org.eclipse.cdt.core.settings.model.CIncludePathEntry; -import org.eclipse.cdt.core.settings.model.CMacroEntry; -import org.eclipse.cdt.core.settings.model.CMacroFileEntry; -import org.eclipse.cdt.core.settings.model.ICConfigurationDescription; -import org.eclipse.cdt.core.settings.model.ICLanguageSettingEntry; -import org.eclipse.cdt.core.settings.model.ICProjectDescription; -import org.eclipse.cdt.core.settings.model.ICSettingEntry; -import org.eclipse.cdt.core.settings.model.ICStorageElement; +import org.eclipse.cdt.core.settings.model.*; import org.eclipse.cdt.core.settings.model.extension.CLanguageData; import org.eclipse.core.resources.IProject; import org.eclipse.core.resources.ProjectScope; -import org.eclipse.core.runtime.CoreException; -import org.eclipse.core.runtime.IPath; -import org.eclipse.core.runtime.NullProgressMonitor; -import org.eclipse.core.runtime.Path; -import org.eclipse.core.runtime.Platform; -import org.eclipse.core.runtime.content.IContentType; -import org.eclipse.core.runtime.content.IContentTypeManager; -import org.eclipse.core.runtime.content.IContentTypeSettings; +import org.eclipse.core.runtime.*; +import org.eclipse.core.runtime.content.*; import com.nokia.carbide.cdt.builder.CarbideBuilderPlugin; import com.nokia.carbide.cdt.builder.EpocEngineHelper; import com.nokia.carbide.cdt.builder.project.ICarbideBuildConfiguration; +import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; +import com.nokia.carbide.cpp.sdk.core.ISBVPlatform; import com.nokia.cpp.internal.api.utils.core.FileUtils; /** * Part of the new CDT 4.0 project model requirements. All this class @@ -186,13 +170,25 @@ // add platform includes first IBSFPlatform platform = carbideBuildConfig.getSDK().getBSFCatalog().findPlatform(carbideBuildConfig.getPlatformString()); + ISBVPlatform sbvPlat = carbideBuildConfig.getSDK().getSBVCatalog().findPlatform(carbideBuildConfig.getPlatformString()); if (platform != null) { IPath[] systemIncludePaths = platform.getSystemIncludePaths(); for (IPath path : systemIncludePaths) { includeEntries.add(new CIncludePathEntry(path, 0)); } } - + else if (sbvPlat != null){ + + Map platPaths = sbvPlat.getBuildIncludePaths(); + Set 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)){ + includeEntries.add(new CIncludePathEntry(path, 0)); + } + } + } + // get the user and system includes List userIncludes = new ArrayList(); List systemIncludes = new ArrayList(); diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java --- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Tue May 12 12:19:40 2009 -0500 @@ -18,7 +18,8 @@ package com.nokia.carbide.cpp.sdk.core.test; import java.net.URL; -import java.util.List; +import java.util.Map; +import java.util.Set; import junit.framework.TestCase; @@ -110,9 +111,12 @@ assertNotNull(platform); assertEquals(4, platform.getBuildIncludePaths().size()); - List incPaths = platform.getBuildIncludePaths(); - for (IPath path : incPaths){ - System.out.println("Include path for dino79 bianry variant: " + path.toOSString()); + Map systemPaths = platform.getBuildIncludePaths(); + Set set = systemPaths.keySet(); + for (IPath path : set) { + String pathType = systemPaths.get(path); + assertNotNull(pathType); + System.out.println("BUILD_INCLUDE = " + path.toOSString() + " Type = " + pathType); } assertEquals(16, platform.getROMBuildIncludePaths().size()); diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Tue May 12 12:19:40 2009 -0500 @@ -13,25 +13,15 @@ package com.nokia.carbide.cpp.internal.api.sdk; import java.io.File; -import java.util.ArrayList; -import java.util.HashMap; -import java.util.List; -import java.util.Map; +import java.util.*; import org.eclipse.core.runtime.IPath; import org.osgi.framework.Version; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultModelDocumentProvider; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefaultTranslationUnitProvider; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.DefineFactory; -import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; +import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; +import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; -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.ISymbianBuildContext; -import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; -import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; +import com.nokia.carbide.cpp.sdk.core.*; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.BasicIncludeFileLocator; import com.nokia.carbide.internal.api.cpp.epoc.engine.preprocessor.MacroScanner; @@ -384,13 +374,23 @@ File prefixFile = getSDK().getPrefixFile(); if (prefixFile != null) { - // add any BSF includes so the headers are picked up from the correct location + // add any BSF/SBV includes so the headers are picked up from the correct location List systemPaths = new ArrayList(); - IBSFPlatform plat = getSDK().getBSFCatalog().findPlatform(platform); - if (plat != null) { - for (IPath path : plat.getSystemIncludePaths()) { + IBSFPlatform bsfPlat = getSDK().getBSFCatalog().findPlatform(platform); + ISBVPlatform sbvPlat = getSDK().getSBVCatalog().findPlatform(platform); + if (bsfPlat != null) { + for (IPath path : bsfPlat.getSystemIncludePaths()) { systemPaths.add(path.toFile()); } + } else if (sbvPlat != null) { + Map platPaths = sbvPlat.getBuildIncludePaths(); + Set 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( diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVCatalog.java Tue May 12 12:19:40 2009 -0500 @@ -74,8 +74,16 @@ * @see com.nokia.carbide.cpp.sdk.core.ISBVCatalog#findPlatform(java.lang.String) */ public ISBVPlatform findPlatform(String platformName) { + + // The platform name for a symbian binary variant should be . + //So we will only care about the second part to find the actual SBV platform + String searchName = platformName; + String[] token = platformName.split("\\."); + if (token.length == 2){ + searchName = token[1]; + } for (ISBVPlatform platform : platforms) { - if (platform.getName().equalsIgnoreCase(platformName)) + if (platform.getName().equalsIgnoreCase(searchName)) return platform; } return null; diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Tue May 12 12:19:40 2009 -0500 @@ -36,8 +36,8 @@ private IPath path; private ISBVPlatform extendedPlatform; private String extendedPlatName; - private List systemBuildIncludePaths = new ArrayList(); - private List romBuildIncludePaths = new ArrayList(); + private Map systemBuildIncludePaths = new HashMap(); + private Map romBuildIncludePaths = new HashMap(); private IPath sdkIncludePath; private IPath bldVarintHRH; private ISBVCatalog catalog; @@ -189,20 +189,21 @@ Set set = incPaths.keySet(); for (String currPath : set) { IPath path = new Path(getEPOCRoot() + currPath); - systemBuildIncludePaths.add(path); + String pathProperty = incPaths.get(currPath); + systemBuildIncludePaths.put(path, pathProperty); } } } - protected List getBuildIncludePathsFromParents(){ + protected Map getBuildIncludePathsFromParents(){ - List parentBuildIncludes = new ArrayList(); + Map parentBuildIncludes = new HashMap(); ISBVPlatform platform = getExtendedVariant(); ISBVPlatform prevPlat; while (platform != null) { - parentBuildIncludes.addAll(platform.getBuildIncludePaths()); + parentBuildIncludes.putAll(platform.getBuildIncludePaths()); prevPlat = platform; platform = getExtendedVariant(); if (prevPlat.getName().equalsIgnoreCase(platform.getName())){ @@ -213,25 +214,26 @@ return parentBuildIncludes; } - protected void setROMBuildIncludePaths(Map incPaths){ + protected void setROMBuildIncludePaths(Map romPaths){ synchronized (this) { - Set set = incPaths.keySet(); - for (String currPath : set){ + Set set = romPaths.keySet(); + for (String currPath : set) { IPath path = new Path(getEPOCRoot() + currPath); - romBuildIncludePaths.add(path); + String pathProperty = romPaths.get(currPath); + romBuildIncludePaths.put(path, pathProperty); } } } - protected List getROMBuildIncludePathsFromParents(){ + protected Map getROMBuildIncludePathsFromParents(){ - List parentROMBuildIncludes = new ArrayList(); + Map parentROMBuildIncludes = new HashMap(); ISBVPlatform platform = getExtendedVariant(); ISBVPlatform prevPlat; while (platform != null) { - parentROMBuildIncludes.addAll(platform.getROMBuildIncludePaths()); + parentROMBuildIncludes.putAll(platform.getROMBuildIncludePaths()); prevPlat = platform; platform = getExtendedVariant(); if (prevPlat.getName().equalsIgnoreCase(platform.getName())){ @@ -252,22 +254,23 @@ return sdkIncludePath.toOSString(); } - public List getBuildIncludePaths(){ - List fullList = new ArrayList(); + public Map getBuildIncludePaths(){ + + Map fullPathMap = new HashMap(); - fullList.addAll(systemBuildIncludePaths); - fullList.addAll(getBuildIncludePathsFromParents()); + fullPathMap.putAll(systemBuildIncludePaths); + fullPathMap.putAll(getBuildIncludePathsFromParents()); - return fullList; + return fullPathMap; } - public List getROMBuildIncludePaths(){ - List fullList = new ArrayList(); + public Map getROMBuildIncludePaths(){ + Map fullPathMap = new HashMap(); - fullList.addAll(romBuildIncludePaths); - fullList.addAll(getROMBuildIncludePathsFromParents()); + fullPathMap.putAll(romBuildIncludePaths); + fullPathMap.putAll(getROMBuildIncludePathsFromParents()); - return fullList; + return fullPathMap; } diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Tue May 12 12:19:40 2009 -0500 @@ -13,6 +13,7 @@ package com.nokia.carbide.cpp.sdk.core; import java.util.List; +import java.util.Map; import org.eclipse.core.runtime.IPath; @@ -75,15 +76,15 @@ public IPath getBuildVariantHRHFile(); /** - * The list of BUILD_INCLUDE paths from the variant and all it's parents - * @return list of paths + * The MAP of BUILD_INCLUDE paths from the variant and all it's parents + * @return Map of IPaths and the operation to perform (set, prepend, append) */ - List getBuildIncludePaths(); + Map getBuildIncludePaths(); /** - * The list of ROM_INCLUDE paths from the variant and all it's parents + * The MAP of ROM_INCLUDE paths from the variant and all it's parents * @return list of paths */ - List getROMBuildIncludePaths(); + Map getROMBuildIncludePaths(); } diff -r 8eed74449d21 -r 2bb08686aa38 core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java --- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java Tue May 12 10:46:48 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDK.java Tue May 12 12:19:40 2009 -0500 @@ -359,4 +359,9 @@ * Get the BSF catalog for the SDK. */ IBSFCatalog getBSFCatalog(); + + /** + * Get the Symbian Binary Variation (SBV) catalog for the SDK. + */ + ISBVCatalog getSBVCatalog(); }