11 * |
11 * |
12 */ |
12 */ |
13 package com.nokia.carbide.cpp.internal.api.sdk; |
13 package com.nokia.carbide.cpp.internal.api.sdk; |
14 |
14 |
15 import java.io.File; |
15 import java.io.File; |
16 import java.util.*; |
16 import java.util.Collections; |
|
17 import java.util.List; |
17 |
18 |
18 import org.eclipse.core.runtime.IPath; |
19 import org.eclipse.core.runtime.IPath; |
19 import org.osgi.framework.Version; |
20 import org.osgi.framework.Version; |
20 |
21 |
21 import com.nokia.carbide.cpp.epoc.engine.preprocessor.*; |
22 import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine; |
|
23 import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv1BuildInfo; |
22 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; |
24 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory; |
23 import com.nokia.carbide.cpp.sdk.core.*; |
25 import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK; |
|
26 import com.nokia.carbide.cpp.sdk.core.IBSFCatalog; |
|
27 import com.nokia.carbide.cpp.sdk.core.IBSFPlatform; |
|
28 import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo; |
|
29 import com.nokia.carbide.cpp.sdk.core.ISBSv1BuildContext; |
|
30 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
|
31 import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID; |
|
32 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
|
33 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
24 |
34 |
25 public class BuildContextSBSv1 implements ISBSv1BuildContext { |
35 public class BuildContextSBSv1 implements ISBSv1BuildContext { |
26 |
36 |
27 private String sdkId; |
37 private String sdkId; |
28 private String platform; |
38 private String platform; |
198 |
208 |
199 public String toString() { |
209 public String toString() { |
200 return getDisplayString(); |
210 return getDisplayString(); |
201 } |
211 } |
202 |
212 |
|
213 private ISBSv1BuildInfo getBuildInfo() { |
|
214 ISBSv1BuildInfo buildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER); |
|
215 if (buildInfo == null) { |
|
216 buildInfo = new SBSv1BuildInfo(); |
|
217 ((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV1_BUILDER); |
|
218 } |
|
219 return buildInfo; |
|
220 } |
|
221 |
203 public String getDefaultDefFileDirectoryName(boolean isASSP) { |
222 public String getDefaultDefFileDirectoryName(boolean isASSP) { |
204 // TODO: How the ASSP option affects the path? |
223 // TODO: How the ASSP option affects the path? |
205 |
224 |
206 String dirName = getDefFileDirectoryNameForPlatform(platform); |
225 String dirName = getDefFileDirectoryNameForPlatform(platform); |
207 if (dirName == null) { |
226 if (dirName == null) { |
208 // check BSF's |
227 // check BSF's |
209 IBSFCatalog catalog = getSDK().getBSFCatalog(); |
228 IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK()); |
210 if (catalog != null) { |
229 if (catalog != null) { |
211 for (IBSFPlatform plat : catalog.getPlatforms()) { |
230 for (IBSFPlatform plat : catalog.getPlatforms()) { |
212 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
231 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
213 String mainPlatform = catalog.getReleasePlatform(platform); |
232 String mainPlatform = catalog.getReleasePlatform(platform); |
214 if (mainPlatform != null) { |
233 if (mainPlatform != null) { |
215 dirName = getDefFileDirectoryNameForPlatform(mainPlatform); |
234 dirName = getDefFileDirectoryNameForPlatform(mainPlatform); |
252 || platform.equals(ARMV6_PLATFORM) |
271 || platform.equals(ARMV6_PLATFORM) |
253 || platform.equals(ARMV6_ABIV2_PLATFORM)) { |
272 || platform.equals(ARMV6_ABIV2_PLATFORM)) { |
254 return getRVCTPrefixFilePath(); |
273 return getRVCTPrefixFilePath(); |
255 } else { |
274 } else { |
256 // check BSF's |
275 // check BSF's |
257 IBSFCatalog catalog = getSDK().getBSFCatalog(); |
276 IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK()); |
258 if (catalog != null) { |
277 if (catalog != null) { |
259 for (IBSFPlatform plat : catalog.getPlatforms()) { |
278 for (IBSFPlatform plat : catalog.getPlatforms()) { |
260 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
279 if (plat.getName().compareToIgnoreCase(platform) == 0) { |
261 String mainPlatform = catalog.getReleasePlatform(platform); |
280 String mainPlatform = catalog.getReleasePlatform(platform); |
262 if (mainPlatform != null) { |
281 if (mainPlatform != null) { |
279 |
298 |
280 // fallback for WINSCW, MSVC, etc. |
299 // fallback for WINSCW, MSVC, etc. |
281 return null; |
300 return null; |
282 } |
301 } |
283 |
302 |
|
303 private IPath getIncludePath() { |
|
304 return getBuildInfo().getIncludePath(getSDK()); |
|
305 } |
|
306 |
284 private IPath getGCCEPrefixFilePath() { |
307 private IPath getGCCEPrefixFilePath() { |
285 return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ |
308 return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$ |
286 } |
309 } |
287 |
310 |
288 private IPath getRVCTPrefixFilePath() { |
311 private IPath getRVCTPrefixFilePath() { |
289 IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); |
312 IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools(); |
290 // use default in case tools aren't installed |
313 // use default in case tools aren't installed |
291 String rvctFragment = "rvct2_2"; //$NON-NLS-1$ |
314 String rvctFragment = "rvct2_2"; //$NON-NLS-1$ |
292 if (installedRVCTTools.length > 0) { |
315 if (installedRVCTTools.length > 0) { |
293 rvctFragment = getRVCTFragment(installedRVCTTools[0]); |
316 rvctFragment = getRVCTFragment(installedRVCTTools[0]); |
294 } |
317 } |
295 IPath prefixFilePath = getSDK().getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ |
318 IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$ |
296 if (prefixFilePath.toFile().exists()){ |
319 if (prefixFilePath.toFile().exists()){ |
297 return prefixFilePath; |
320 return prefixFilePath; |
298 } else { |
321 } else { |
299 // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones |
322 // SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones |
300 // based on the default installation |
323 // based on the default installation |
301 return getSDK().getIncludePath().append("rvct").append("rvct" + ".h"); |
324 return getIncludePath().append("rvct").append("rvct" + ".h"); |
302 } |
325 } |
303 } |
326 } |
304 |
327 |
305 private String getRVCTFragment(IRVCTToolChainInfo info) { |
328 private String getRVCTFragment(IRVCTToolChainInfo info) { |
306 int major = 0, minor = 0; |
329 int major = 0, minor = 0; |