core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
author timkelly
Tue, 08 Jun 2010 10:25:02 -0500
branchC3_BUILDER_WORK
changeset 1439 8266d8737e89
parent 1438 03403c6a4740
parent 1434 79471fd1fd69
child 1462 b38491fd06da
permissions -rw-r--r--
merge commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     1
package com.nokia.carbide.cpp.internal.api.sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     2
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     3
import java.io.File;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
     4
import java.util.Collections;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     5
import java.util.List;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     6
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     7
import org.eclipse.core.runtime.IPath;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
     8
import org.osgi.framework.Version;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     9
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    10
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    11
import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    12
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    13
import com.nokia.carbide.cpp.sdk.core.IBSFCatalog;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    14
import com.nokia.carbide.cpp.sdk.core.IBSFPlatform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    15
import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    16
import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
    17
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    18
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    19
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    20
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
    21
import com.nokia.cpp.internal.api.utils.core.Check;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    22
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    23
public class BuildContextSBSv2 implements ISBSv2BuildContext {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    24
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    25
	private String platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    26
	private String target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    27
	private String sbsv2Alias;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    28
	private ISymbianSDK sdk;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    29
	private String displayString;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    30
	private String configID;  // cconfiguration 'id' attribute from .cproject
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    31
	
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    32
	public BuildContextSBSv2(ISymbianSDK theSDK, String thePlatform, String theTarget, String theSBSv2Alias, String displayName, String configID) {
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    33
		this.sdk = theSDK;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    34
		this.platform = thePlatform.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    35
		this.target = theTarget.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    36
		this.sbsv2Alias = theSBSv2Alias;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    37
		this.displayString = displayName;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    38
		this.configID = configID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    39
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    40
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    41
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    42
	public ISymbianSDK getSDK() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    43
		return sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    44
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    45
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    46
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    47
	public String getPlatformString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    48
		return platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    49
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    50
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    51
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    52
	public String getTargetString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    53
		return target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    54
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    55
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    56
	public String getConfigID(){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    57
		return configID;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    58
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    59
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    60
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    61
	public String getDisplayString() {
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
    62
		Check.checkState(displayString != null);
1423
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    63
		return displayString;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    64
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    65
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    66
	private ISBSv2BuildInfo getBuildInfo() {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    67
		ISBSv2BuildInfo buildInfo = (ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    68
		if (buildInfo == null) {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    69
			buildInfo = new SBSv2BuildInfo();
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    70
			((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV2_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    71
		}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    72
		return buildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    73
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    74
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    75
	@Override
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    76
	public String toString() {
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    77
		return getConfigID();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    78
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    79
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    80
	@Override
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    81
	public String getDefaultDefFileDirectoryName(boolean isASSP) {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    82
		// TOOD: THIS IS ABLD STUFF. isASSP does not belong with Raptor
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    83
		// TODO: How the ASSP option affects the path?
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    84
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    85
		String dirName = getDefFileDirectoryNameForPlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    86
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    87
			// check BSF's
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    88
			IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK());
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    89
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    90
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    91
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    92
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    93
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    94
	    					dirName = getDefFileDirectoryNameForPlatform(mainPlatform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    95
	    					if (dirName == null || dirName.length() < 1) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    96
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    97
			    				return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    98
	    					}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    99
	    				}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   100
	    			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   101
	    		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   102
	    	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   103
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   104
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   105
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   106
			// fallback for unknown cases
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   107
			dirName = platform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   108
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   109
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   110
		return dirName;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   111
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   112
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   113
	private String getDefFileDirectoryNameForPlatform(String platform) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   114
		// TODO: This is still ABLD stype stuff
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   115
		if (platform.equals(EMULATOR_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   116
			return "BWINS"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   117
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   118
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   119
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   120
					|| platform.equals(ARMV6_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   121
					|| platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   122
			return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   123
		}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   124
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   125
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   126
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   127
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   128
	public IPath getCompilerPrefixFile() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   129
		// TODO: This is ABLD hard-code mechanism. Should be able to get from Raptor query mechanism
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   130
		if (platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   131
			return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   132
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   133
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   134
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   135
					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   136
			return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   137
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   138
			// check BSF's
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   139
			IBSFCatalog catalog = getBuildInfo().getBSFCatalog(getSDK());
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   140
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   141
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   142
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   143
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   144
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   145
	    					if (mainPlatform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   146
	    						return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   147
	    					} else if (mainPlatform.equals(ARMV5_PLATFORM) 
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   148
	    								|| mainPlatform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   149
	    								|| mainPlatform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   150
	    								|| mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   151
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   152
	    					} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   153
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   154
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   155
	    					}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   156
	    				}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   157
	    			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   158
	    		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   159
	    	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   160
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   161
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   162
		// fallback for WINSCW, MSVC, etc.
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   163
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   164
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   165
	
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   166
	private IPath getIncludePath() {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   167
		return getBuildInfo().getIncludePath(getSDK());
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   168
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   169
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   170
	private IPath getGCCEPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   171
		// TOOD: Should get from Raptor query when available
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   172
		return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   173
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   174
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   175
	private IPath getRVCTPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   176
		// TODO: Should get this from query mechanism
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   177
		IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   178
		// use default in case tools aren't installed
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   179
		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   180
		if (installedRVCTTools.length > 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   181
			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   182
		}
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   183
		IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   184
		if (prefixFilePath.toFile().exists()){
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   185
			return prefixFilePath;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   186
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   187
			// SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   188
			// based on the default installation
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   189
			return getIncludePath().append("rvct").append("rvct" + ".h");
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   190
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   191
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   192
	
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   193
	private String getRVCTFragment(IRVCTToolChainInfo info) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   194
		// TODO: This should not be needed when raptor query is complete
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   195
		int major = 0, minor = 0;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   196
		if (info != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   197
			Version rvctToolsVersion = info.getRvctToolsVersion();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   198
			if (rvctToolsVersion != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   199
				major = info.getRvctToolsVersion().getMajor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   200
				minor = info.getRvctToolsVersion().getMinor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   201
			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   202
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   203
		return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   204
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   205
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   206
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   207
	public List<IDefine> getVariantHRHDefines() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   208
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   209
		return getCachedData().getVariantHRHDefines();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   210
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   211
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   212
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   213
	public List<File> getPrefixFileIncludes() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   214
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   215
		return getCachedData().getPrefixFileIncludes();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   216
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   217
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   218
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   219
	public List<IDefine> getCompilerMacros() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   220
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   221
		// we parse the compiler prefix file to gather macros.  this can be time consuming so do it
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   222
		// once and cache the values.  only reset the cache when the compiler prefix has changed.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   223
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   224
		IPath prefixFile = getCompilerPrefixFile();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   225
		if (prefixFile == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   226
			return Collections.emptyList();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   227
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   228
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   229
		return getCachedData().getCompilerMacros(prefixFile);
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   230
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   231
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   232
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   233
	public String getBuildVariationName() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   234
		// TODO: This should not be needed for Raptor
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   235
		return "";
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   236
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   237
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   238
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   239
	public boolean isSymbianBinaryVariation() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   240
		// This should not be needed for Raptor. We do need a check
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   241
		// in the MPP for the featurevariant keyword perhaps
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   242
		return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   243
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   244
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   245
	/**
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   246
	 * See if the build configuration is an SBSv2 alias, and if so get the build-able alias name 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   247
	 * @param displayName
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   248
	 * @return The full SBSv2 alias that can be used with -c, otherwise null if not SBSv2
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   249
	 */
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   250
	private static String getSBSv2AliasFromConfigName(String displayName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   251
		int indexBegin = displayName.indexOf("(");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   252
		int indexEnd = displayName.indexOf(")");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   253
		if (indexBegin > 0 && indexEnd > 0){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   254
			String configPart =  displayName.substring(indexBegin+1, indexEnd);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   255
			if (configPart.split("_").length > 1){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   256
				return configPart;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   257
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   258
		} 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   259
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   260
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   261
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   262
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   263
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   264
	public String getSBSv2Alias() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   265
		return sbsv2Alias;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   266
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   267
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   268
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   269
	 * Get the cache holding the data that applies to this build context globally.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   270
	 * A build context is subclassed by CarbideBuildConfiguration, which has multiple
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   271
	 * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   272
	 * @return cache, never <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   273
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   274
	private SymbianBuildContextDataCache getCachedData() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   275
		// TODO: Still need to consider this for SBSv2 refactoring / Raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   276
		return SymbianBuildContextDataCache.getCache(this);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   277
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   278
	
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   279
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   280
	 * Get the list of #include paths detected for this context.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   281
	 * @return List or <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   282
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   283
	public List<File> getCachedSystemIncludePaths() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   284
		// TODO: Still need to consider this for SBSv2 refactoring / Raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   285
		return getCachedData().getSystemIncludePaths();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   286
	}
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   287
	
1425
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   288
	@Override
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   289
	public int hashCode() {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   290
		final int prime = 31;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   291
		int result = 1;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   292
		result = prime * result
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   293
				+ ((platform == null) ? 0 : platform.hashCode());
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   294
		result = prime * result + ((getSDK() == null) ? 0 : getSDK().getEPOCROOT().hashCode());
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   295
		result = prime * result + ((target == null) ? 0 : target.hashCode());
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   296
		return result;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   297
	}
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   298
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   299
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   300
	@Override
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   301
	public boolean equals(Object obj) {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   302
		if (this == obj)
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   303
			return true;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   304
		if (obj == null)
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   305
			return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   306
		if (!(obj instanceof BuildContextSBSv2))
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   307
			return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   308
		final BuildContextSBSv2 other = (BuildContextSBSv2) obj;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   309
		if (sbsv2Alias == null) {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   310
			if (other.sbsv2Alias != null)
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   311
				return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   312
		} else if (!sbsv2Alias.equals(other.sbsv2Alias))
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   313
			return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   314
		if (getSDK() == null) {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   315
			if (other.getSDK() != null)
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   316
				return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   317
		} else if (!getSDK().getEPOCROOT().equals(other.getSDK().getEPOCROOT()))
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   318
			return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   319
		if (target == null) {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   320
			if (other.target != null)
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   321
				return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   322
		} else if (!target.equals(other.target)) {
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   323
			return false;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   324
		} else if (!configID.equals(other.configID)){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   325
			// TODO: Do we really need anything other than a config ID comparison?
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   326
			return false;
1425
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   327
		}
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   328
		return true;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   329
	}
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   330
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   331
	public static String getPlatformFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   332
		String[] tokens = displayString.split(" ");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   333
		String sdkIdToken = tokens[2];
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   334
		if (sdkIdToken.contains("_")){
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   335
			sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   336
			String[] aliasTokens = sdkIdToken.split("_");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   337
			return aliasTokens[0];
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   338
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   339
			return sdkIdToken.substring(1, sdkIdToken.length()-1);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   340
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   341
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   342
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   343
	public static String getTargetFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   344
		String[] tokens = displayString.split(" ");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   345
		if (tokens[1].compareTo("Debug") == 0) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   346
			return ISymbianBuildContext.DEBUG_TARGET;
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   347
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   348
			return ISymbianBuildContext.RELEASE_TARGET;
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   349
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   350
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   351
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   352
	public static String getBuildAliasFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   353
		String target = getTargetFromV1ConfigName(displayString);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   354
		String platform = getPlatformFromV1ConfigName(displayString);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   355
		return platform.toLowerCase() + "_" + target.toLowerCase();
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   356
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   357
	
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   358
	// Fall-back to get SDK id from old config name
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   359
	public static String getSDKIDFromV1ConfigName(String configName) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   360
		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   361
		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   362
		if (indexBegin > 0 && indexEnd > 0){
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   363
			return configName.substring(indexBegin+1, indexEnd);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   364
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   365
			return ""; //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   366
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   367
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   368
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   369
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   370
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   371
}