# HG changeset patch # User timkelly # Date 1242923911 18000 # Node ID a0a675250e30b132e7931d747f3286a665bf3bd1 # Parent 758f05682b77c231b9ecb419400b44cb41b9fa99 Use LinkedHashMap instead of Map to preserve build include order. Add test to insure expected order diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/builder/DefaultIncludeFileLocator.java Thu May 21 11:38:31 2009 -0500 @@ -72,7 +72,7 @@ } } else if (sbvPlatform != null){ - Map platPaths = sbvPlatform.getBuildIncludePaths(); + LinkedHashMap platPaths = sbvPlatform.getBuildIncludePaths(); Set set = platPaths.keySet(); for (IPath path : set) { String pathType = platPaths.get(path); diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/builder/com.nokia.carbide.cdt.builder/src/com/nokia/carbide/cdt/internal/builder/CarbideLanguageData.java Thu May 21 11:38:31 2009 -0500 @@ -179,7 +179,7 @@ } else if (sbvPlat != null){ - Map platPaths = sbvPlat.getBuildIncludePaths(); + LinkedHashMap platPaths = sbvPlat.getBuildIncludePaths(); Set set = platPaths.keySet(); for (IPath path : set) { String pathType = platPaths.get(path); diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/SBVCatalogTest.java Thu May 21 11:38:31 2009 -0500 @@ -18,8 +18,7 @@ package com.nokia.carbide.cpp.sdk.core.test; import java.net.URL; -import java.util.Map; -import java.util.Set; +import java.util.*; import junit.framework.TestCase; @@ -106,12 +105,38 @@ platform = catalog.findPlatform("wilma88"); assertNull(platform); + } + + /** + * Test the number and order of build include paths + * @throws Exception + */ + public void testBuildIncludePaths() throws Exception { + setupForSDK(new Path("Data/var/group1")); + ISBVPlatform[] platforms = catalog.getPlatforms(); + assertEquals(7, platforms.length); + + ISBVPlatform platform; + // test build include paths platform = catalog.findPlatform("dino79"); assertNotNull(platform); assertEquals(4, platform.getBuildIncludePaths().size()); - Map systemPaths = platform.getBuildIncludePaths(); + LinkedHashMap systemPaths = platform.getBuildIncludePaths(); + + Set pathSet = systemPaths.keySet(); + Object[] paths = pathSet.toArray(); + IPath p; + p = (IPath)paths[0]; + assertTrue("Variant build include Paths possibly in wrong order", p.toPortableString().contains("epoc32/include/config/flintstone500/dino79")); + p = (IPath)paths[1]; + assertTrue("Variant build include Paths possibly in wrong order", p.toPortableString().contains("/epoc32/include/config/flintstone500")); + p = (IPath)paths[2]; + assertTrue("Variant build include Paths possibly in wrong order", p.toPortableString().contains("/epoc32/include/config")); + p = (IPath)paths[3]; + assertTrue("Variant build include Paths possibly in wrong order", p.toPortableString().contains("/epoc32/include")); + Set set = systemPaths.keySet(); for (IPath path : set) { String pathType = systemPaths.get(path); @@ -121,7 +146,8 @@ assertEquals(16, platform.getROMBuildIncludePaths().size()); - } + + } /** * @param built diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SymbianBuildContext.java Thu May 21 11:38:31 2009 -0500 @@ -383,7 +383,7 @@ systemPaths.add(path.toFile()); } } else if (sbvPlat != null) { - Map platPaths = sbvPlat.getBuildIncludePaths(); + LinkedHashMap platPaths = sbvPlat.getBuildIncludePaths(); Set set = platPaths.keySet(); for (IPath path : set) { String pathType = platPaths.get(path); diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SBVPlatform.java Thu May 21 11:38:31 2009 -0500 @@ -197,9 +197,9 @@ } - protected Map getBuildIncludePathsFromParents(){ + protected LinkedHashMap getBuildIncludePathsFromParents(){ - Map parentBuildIncludes = new HashMap(); + LinkedHashMap parentBuildIncludes = new LinkedHashMap(); ISBVPlatform platform = getExtendedVariant(); ISBVPlatform prevPlat; @@ -255,9 +255,9 @@ return sdkIncludePath.toOSString(); } - public Map getBuildIncludePaths(){ + public LinkedHashMap getBuildIncludePaths(){ - Map fullPathMap = new HashMap(); + LinkedHashMap fullPathMap = new LinkedHashMap(); fullPathMap.putAll(systemBuildIncludePaths); fullPathMap.putAll(getBuildIncludePathsFromParents()); @@ -265,8 +265,8 @@ return fullPathMap; } - public Map getROMBuildIncludePaths(){ - Map fullPathMap = new HashMap(); + public LinkedHashMap getROMBuildIncludePaths(){ + LinkedHashMap fullPathMap = new LinkedHashMap(); fullPathMap.putAll(romBuildIncludePaths); fullPathMap.putAll(getROMBuildIncludePathsFromParents()); diff -r 758f05682b77 -r a0a675250e30 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 Thu May 21 11:06:02 2009 -0500 +++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISBVPlatform.java Thu May 21 11:38:31 2009 -0500 @@ -12,12 +12,12 @@ */ package com.nokia.carbide.cpp.sdk.core; -import java.util.List; -import java.util.Map; +import java.util.LinkedHashMap; import org.eclipse.core.runtime.IPath; import com.nokia.carbide.cpp.epoc.engine.EpocEnginePlugin; +import com.nokia.carbide.cpp.epoc.engine.model.sbv.ISBVView; /** * This interface defines a single Symbian Binary Variation (SBV) platform. @@ -81,12 +81,12 @@ * 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) */ - Map getBuildIncludePaths(); + LinkedHashMap getBuildIncludePaths(); /** * The MAP of ROM_INCLUDE paths from the variant and all it's parents * @return list of paths */ - Map getROMBuildIncludePaths(); + LinkedHashMap getROMBuildIncludePaths(); }