6 |
6 |
7 import org.eclipse.core.runtime.IPath; |
7 import org.eclipse.core.runtime.IPath; |
8 import org.osgi.framework.Version; |
8 import org.osgi.framework.Version; |
9 |
9 |
10 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; |
10 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; |
|
11 import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo; |
|
12 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; |
11 import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; |
13 import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; |
12 import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; |
14 import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; |
13 import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; |
15 import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; |
14 import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; |
16 import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; |
15 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
17 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
|
18 import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; |
16 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
19 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
17 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
20 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
18 import com.nokia.cpp.internal.api.utils.core.Check; |
21 import com.nokia.cpp.internal.api.utils.core.Check; |
19 |
22 |
20 public class BuildContextSBSv2 implements ISBSv2BuildContext { |
23 public class BuildContextSBSv2 implements ISBSv2BuildContext { |
58 public String getDisplayString() { |
61 public String getDisplayString() { |
59 Check.checkState(displayString != null); |
62 Check.checkState(displayString != null); |
60 return displayString; |
63 return displayString; |
61 } |
64 } |
62 |
65 |
|
66 private ISBSv2BuildInfo getBuildInfo() { |
|
67 ISBSv2BuildInfo buildInfo = (ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER); |
|
68 if (buildInfo == null) { |
|
69 buildInfo = new SBSv2BuildInfo(); |
|
70 ((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV2_BUILDER); |
|
71 } |
|
72 return buildInfo; |
|
73 } |
|
74 |
63 @Override |
75 @Override |
64 public String toString() { |
76 public String toString() { |
65 return getConfigID(); |
77 return getConfigID(); |
66 } |
78 } |
67 |
79 |
71 // TODO: How the ASSP option affects the path? |
83 // TODO: How the ASSP option affects the path? |
72 |
84 |
73 String dirName = getDefFileDirectoryNameForPlatform(platform); |
85 String dirName = getDefFileDirectoryNameForPlatform(platform); |
74 if (dirName == null) { |
86 if (dirName == null) { |
75 // check BSF's |
87 // check BSF's |
76 IBSFCatalog catalog = getSDK().getBSFCatalog(); |
88 IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK()); |
77 if (catalog != null) { |
89 if (catalog != null) { |
78 for (IBSFPlatform plat : catalog.getPlatforms()) { |
90 for (IBSFPlatform plat : catalog.getPlatforms()) { |
79 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
91 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
80 String mainPlatform = catalog.getReleasePlatform(platform); |
92 String mainPlatform = catalog.getReleasePlatform(platform); |
81 if (mainPlatform != null) { |
93 if (mainPlatform != null) { |
122 || platform.equals(ARMV6_PLATFORM) |
134 || platform.equals(ARMV6_PLATFORM) |
123 || platform.equals(ARMV6_ABIV2_PLATFORM)) { |
135 || platform.equals(ARMV6_ABIV2_PLATFORM)) { |
124 return getRVCTPrefixFilePath(); |
136 return getRVCTPrefixFilePath(); |
125 } else { |
137 } else { |
126 // check BSF's |
138 // check BSF's |
127 IBSFCatalog catalog = getSDK().getBSFCatalog(); |
139 IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK()); |
128 if (catalog != null) { |
140 if (catalog != null) { |
129 for (IBSFPlatform plat : catalog.getPlatforms()) { |
141 for (IBSFPlatform plat : catalog.getPlatforms()) { |
130 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
142 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
131 String mainPlatform = catalog.getReleasePlatform(platform); |
143 String mainPlatform = catalog.getReleasePlatform(platform); |
132 if (mainPlatform != null) { |
144 if (mainPlatform != null) { |
149 |
161 |
150 // fallback for WINSCW, MSVC, etc. |
162 // fallback for WINSCW, MSVC, etc. |
151 return null; |
163 return null; |
152 } |
164 } |
153 |
165 |
|
166 private IPath getIncludePath() { |
|
167 return getBuildInfo().getIncludePath(getSDK()); |
|
168 } |
|
169 |
154 private IPath getGCCEPrefixFilePath() { |
170 private IPath getGCCEPrefixFilePath() { |
155 // TOOD: Should get from Raptor query when available |
171 // TOOD: Should get from Raptor query when available |
156 return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ |
172 return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ |
157 } |
173 } |
158 |
174 |
159 private IPath getRVCTPrefixFilePath() { |
175 private IPath getRVCTPrefixFilePath() { |
160 // TODO: Should get this from query mechanism |
176 // TODO: Should get this from query mechanism |
161 IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); |
177 IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); |
162 // use default in case tools aren't installed |
178 // use default in case tools aren't installed |
163 String rvctFragment = "rvct2_2"; //$NON-NLS-1$ |
179 String rvctFragment = "rvct2_2"; //$NON-NLS-1$ |
164 if (installedRVCTTools.length > 0) { |
180 if (installedRVCTTools.length > 0) { |
165 rvctFragment = getRVCTFragment(installedRVCTTools[0]); |
181 rvctFragment = getRVCTFragment(installedRVCTTools[0]); |
166 } |
182 } |
167 IPath prefixFilePath = getSDK().getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ |
183 IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ |
168 if (prefixFilePath.toFile().exists()){ |
184 if (prefixFilePath.toFile().exists()){ |
169 return prefixFilePath; |
185 return prefixFilePath; |
170 } else { |
186 } else { |
171 // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones |
187 // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones |
172 // based on the default installation |
188 // based on the default installation |
173 return getSDK().getIncludePath().append("rvct").append("rvct" + ".h"); |
189 return getIncludePath().append("rvct").append("rvct" + ".h"); |
174 } |
190 } |
175 } |
191 } |
176 |
192 |
177 private String getRVCTFragment(IRVCTToolChainInfo info) { |
193 private String getRVCTFragment(IRVCTToolChainInfo info) { |
178 // TODO: This should not be needed when raptor query is complete |
194 // TODO: This should not be needed when raptor query is complete |