core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
branchC3_BUILDER_WORK
changeset 1434 79471fd1fd69
parent 1433 1a693b01d107
child 1439 8266d8737e89
equal deleted inserted replaced
1433:1a693b01d107 1434:79471fd1fd69
     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 
    21 
    19 public class BuildContextSBSv2 implements ISBSv2BuildContext {
    22 public class BuildContextSBSv2 implements ISBSv2BuildContext {
    20 	
    23 	
    91 			displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
    94 			displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
    92 		}
    95 		}
    93 		return displayString;
    96 		return displayString;
    94 	}
    97 	}
    95 
    98 
       
    99 	private ISBSv2BuildInfo getBuildInfo() {
       
   100 		ISBSv2BuildInfo buildInfo = (ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
       
   101 		if (buildInfo == null) {
       
   102 			buildInfo = new SBSv2BuildInfo();
       
   103 			((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV2_BUILDER);
       
   104 		}
       
   105 		return buildInfo;
       
   106 	}
       
   107 
    96 	@Override
   108 	@Override
    97 	public String toString() {
   109 	public String toString() {
    98 		return getConfigID();
   110 		return getConfigID();
    99 	}
   111 	}
   100 
   112 
   104 		// TODO: How the ASSP option affects the path?
   116 		// TODO: How the ASSP option affects the path?
   105 
   117 
   106 		String dirName = getDefFileDirectoryNameForPlatform(platform);
   118 		String dirName = getDefFileDirectoryNameForPlatform(platform);
   107 		if (dirName == null) {
   119 		if (dirName == null) {
   108 			// check BSF's
   120 			// check BSF's
   109 			IBSFCatalog catalog = getSDK().getBSFCatalog();
   121 			IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK());
   110 	    	if (catalog != null) {
   122 	    	if (catalog != null) {
   111 	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
   123 	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
   112 	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
   124 	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
   113 	    				String mainPlatform = catalog.getReleasePlatform(platform);
   125 	    				String mainPlatform = catalog.getReleasePlatform(platform);
   114 	    				if (mainPlatform != null) {
   126 	    				if (mainPlatform != null) {
   155 					|| platform.equals(ARMV6_PLATFORM)
   167 					|| platform.equals(ARMV6_PLATFORM)
   156 					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
   168 					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
   157 			return getRVCTPrefixFilePath();
   169 			return getRVCTPrefixFilePath();
   158 		} else {
   170 		} else {
   159 			// check BSF's
   171 			// check BSF's
   160 			IBSFCatalog catalog = getSDK().getBSFCatalog();
   172 			IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK());
   161 	    	if (catalog != null) {
   173 	    	if (catalog != null) {
   162 	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
   174 	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
   163 	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
   175 	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
   164 	    				String mainPlatform = catalog.getReleasePlatform(platform);
   176 	    				String mainPlatform = catalog.getReleasePlatform(platform);
   165 	    				if (mainPlatform != null) {
   177 	    				if (mainPlatform != null) {
   182 
   194 
   183 		// fallback for WINSCW, MSVC, etc.
   195 		// fallback for WINSCW, MSVC, etc.
   184 		return null;
   196 		return null;
   185 	}
   197 	}
   186 	
   198 	
       
   199 	private IPath getIncludePath() {
       
   200 		return getBuildInfo().getIncludePath(getSDK());
       
   201 	}
       
   202 
   187 	private IPath getGCCEPrefixFilePath() {
   203 	private IPath getGCCEPrefixFilePath() {
   188 		// TOOD: Should get from Raptor query when available
   204 		// TOOD: Should get from Raptor query when available
   189 		return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
   205 		return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
   190 	}
   206 	}
   191 
   207 
   192 	private IPath getRVCTPrefixFilePath() {
   208 	private IPath getRVCTPrefixFilePath() {
   193 		// TODO: Should get this from query mechanism
   209 		// TODO: Should get this from query mechanism
   194 		IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
   210 		IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
   195 		// use default in case tools aren't installed
   211 		// use default in case tools aren't installed
   196 		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
   212 		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
   197 		if (installedRVCTTools.length > 0) {
   213 		if (installedRVCTTools.length > 0) {
   198 			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
   214 			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
   199 		}
   215 		}
   200 		IPath prefixFilePath = getSDK().getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
   216 		IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
   201 		if (prefixFilePath.toFile().exists()){
   217 		if (prefixFilePath.toFile().exists()){
   202 			return prefixFilePath;
   218 			return prefixFilePath;
   203 		} else {
   219 		} else {
   204 			// SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones
   220 			// SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones
   205 			// based on the default installation
   221 			// based on the default installation
   206 			return getSDK().getIncludePath().append("rvct").append("rvct" + ".h");
   222 			return getIncludePath().append("rvct").append("rvct" + ".h");
   207 		}
   223 		}
   208 	}
   224 	}
   209 	
   225 	
   210 	private String getRVCTFragment(IRVCTToolChainInfo info) {
   226 	private String getRVCTFragment(IRVCTToolChainInfo info) {
   211 		// TODO: This should not be needed when raptor query is complete
   227 		// TODO: This should not be needed when raptor query is complete