core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
author timkelly
Thu, 03 Jun 2010 09:58:29 -0500
branchC3_BUILDER_WORK
changeset 1425 7903a1588fd4
parent 1423 17dfd1c1fef1
child 1433 1a693b01d107
permissions -rw-r--r--
more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
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;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    11
import com.nokia.carbide.cpp.sdk.core.IBSFCatalog;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    12
import com.nokia.carbide.cpp.sdk.core.IBSFPlatform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    13
import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    14
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
    15
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    16
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    17
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    18
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    19
public class BuildContextSBSv2 implements ISBSv2BuildContext {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    20
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    21
	private String platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    22
	private String target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    23
	private String sbsv2Alias;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    24
	ISymbianSDK sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    25
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    26
	public BuildContextSBSv2(ISymbianSDK theSDK, String thePlatform, String theTarget, String theSBSv2Alias) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    27
		sdk = theSDK;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    28
		platform = thePlatform.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    29
		target = theTarget.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    30
		sbsv2Alias = theSBSv2Alias;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    31
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    32
		getDisplayString();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    33
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    34
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    35
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    36
	public ISymbianSDK getSDK() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    37
		return sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    38
	}
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    41
	public String getPlatformString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    42
		return platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    43
	}
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    46
	public String getTargetString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    47
		return target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    48
	}
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    51
	public String getDisplayString() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    52
		// TODO We will need to cobble up proper display names
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
    53
		//return "(" + sbsv2Alias + ") " + "[" + sdk.getUniqueId() + "]" ;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    54
		
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    55
		// TODO: This is temporary to support the old configs where
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    56
		// The display name and id were the same thing. Need to work on supporting both
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    57
		// as we migrate the display name to the settings and use a truly unique ID for configs.
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    58
		
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    59
		  String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    60
		  String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    61
		  String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    62
		  String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$
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
		  String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    64
		  String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    65
		String displayString = null;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    66
		if (displayString == null) {
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    67
			// in the form Emulation Debug (WINSCW) [S60_3rd_MR] or
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    68
			// Phone Release (GCCE) [S60_3rd_MR]
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    69
			if (platform.compareTo(ISymbianBuildContext.EMULATOR_PLATFORM) == 0) {
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    70
				displayString = EMULATOR_DISPLAY_TEXT;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    71
			} else {
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    72
				displayString = PHONE_DISPLAY_TEXT;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    73
			}
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    74
			
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    75
			if (target.compareTo(ISymbianBuildContext.DEBUG_TARGET) == 0) {
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    76
				displayString = displayString + SPACE_DISPLAY_TEXT + DEBUG_DISPLAY_TEXT;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    77
			} else {
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    78
				displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    79
			}
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    80
			
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    81
			String basePlatform = sbsv2Alias;
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    82
			
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    83
			displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    84
		}
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    85
		return displayString;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    86
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    87
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    88
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    89
	public String getDefaultDefFileDirectoryName(boolean isASSP) {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    90
		// 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
    91
		// TODO: How the ASSP option affects the path?
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    92
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    93
		String dirName = getDefFileDirectoryNameForPlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    94
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    95
			// check BSF's
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    96
			IBSFCatalog catalog = getSDK().getBSFCatalog();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    97
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    98
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    99
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   100
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   101
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   102
	    					dirName = getDefFileDirectoryNameForPlatform(mainPlatform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   103
	    					if (dirName == null || dirName.length() < 1) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   104
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   105
			    				return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   106
	    					}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   107
	    				}
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
	    	}
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
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   114
			// fallback for unknown cases
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   115
			dirName = platform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   116
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   117
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   118
		return dirName;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   119
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   120
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   121
	private String getDefFileDirectoryNameForPlatform(String platform) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   122
		// TODO: This is still ABLD stype stuff
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   123
		if (platform.equals(EMULATOR_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   124
			return "BWINS"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   125
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   126
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   127
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   128
					|| platform.equals(ARMV6_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   129
					|| platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   130
			return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   131
		}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   132
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   133
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   134
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   135
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   136
	public IPath getCompilerPrefixFile() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   137
		// 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
   138
		if (platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   139
			return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   140
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   141
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   142
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   143
					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   144
			return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   145
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   146
			// check BSF's
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   147
			IBSFCatalog catalog = getSDK().getBSFCatalog();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   148
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   149
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   150
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   151
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   152
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   153
	    					if (mainPlatform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   154
	    						return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   155
	    					} else if (mainPlatform.equals(ARMV5_PLATFORM) 
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   156
	    								|| mainPlatform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   157
	    								|| mainPlatform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   158
	    								|| mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   159
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   160
	    					} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   161
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   162
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   163
	    					}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   164
	    				}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   165
	    			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   166
	    		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   167
	    	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   168
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   169
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   170
		// fallback for WINSCW, MSVC, etc.
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   171
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   172
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   173
	
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   174
	private IPath getGCCEPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   175
		// TOOD: Should get from Raptor query when available
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   176
		return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   177
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   178
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   179
	private IPath getRVCTPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   180
		// TODO: Should get this from query mechanism
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   181
		IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   182
		// use default in case tools aren't installed
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   183
		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   184
		if (installedRVCTTools.length > 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   185
			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   186
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   187
		IPath prefixFilePath = getSDK().getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   188
		if (prefixFilePath.toFile().exists()){
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   189
			return prefixFilePath;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   190
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   191
			// 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
   192
			// based on the default installation
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   193
			return getSDK().getIncludePath().append("rvct").append("rvct" + ".h");
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   194
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   195
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   196
	
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   197
	private String getRVCTFragment(IRVCTToolChainInfo info) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   198
		// 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
   199
		int major = 0, minor = 0;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   200
		if (info != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   201
			Version rvctToolsVersion = info.getRvctToolsVersion();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   202
			if (rvctToolsVersion != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   203
				major = info.getRvctToolsVersion().getMajor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   204
				minor = info.getRvctToolsVersion().getMinor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   205
			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   206
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   207
		return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   208
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   209
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   210
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   211
	public List<IDefine> getVariantHRHDefines() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   212
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   213
		return getCachedData().getVariantHRHDefines();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   214
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   215
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   216
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   217
	public List<File> getPrefixFileIncludes() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   218
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   219
		return getCachedData().getPrefixFileIncludes();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   220
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   221
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   222
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   223
	public List<IDefine> getCompilerMacros() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   224
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   225
		// 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
   226
		// 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
   227
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   228
		IPath prefixFile = getCompilerPrefixFile();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   229
		if (prefixFile == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   230
			return Collections.emptyList();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   231
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   232
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   233
		return getCachedData().getCompilerMacros(prefixFile);
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   234
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   235
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   236
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   237
	public String getBuildVariationName() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   238
		// TODO: This should not be needed for Raptor
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   239
		return "";
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   240
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   241
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   242
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   243
	public boolean isSymbianBinaryVariation() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   244
		// 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
   245
		// in the MPP for the featurevariant keyword perhaps
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   246
		return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   247
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   248
	
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
	 * 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
   251
	 * @param displayName
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   252
	 * @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
   253
	 */
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   254
	private static String getSBSv2AliasFromConfigName(String displayName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   255
		int indexBegin = displayName.indexOf("(");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   256
		int indexEnd = displayName.indexOf(")");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   257
		if (indexBegin > 0 && indexEnd > 0){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   258
			String configPart =  displayName.substring(indexBegin+1, indexEnd);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   259
			if (configPart.split("_").length > 1){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   260
				return configPart;
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
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   264
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   265
	}
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   268
	public String getSBSv2Alias() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   269
		return sbsv2Alias;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   270
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   271
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   272
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   273
	 * 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
   274
	 * A build context is subclassed by CarbideBuildConfiguration, which has multiple
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   275
	 * 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
   276
	 * @return cache, never <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   277
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   278
	private SymbianBuildContextDataCache getCachedData() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   279
		// 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
   280
		return SymbianBuildContextDataCache.getCache(this);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   281
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   282
	
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   283
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   284
	 * Get the list of #include paths detected for this context.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   285
	 * @return List or <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   286
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   287
	public List<File> getCachedSystemIncludePaths() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   288
		// 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
   289
		return getCachedData().getSystemIncludePaths();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   290
	}
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   291
	
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   292
	
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   293
	// Fall-back to get SDK id from old config name
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   294
	public static String getSDKIDFromConfigName(String configName) {
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   295
		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   296
		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   297
		if (indexBegin > 0 && indexEnd > 0){
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   298
			return configName.substring(indexBegin+1, indexEnd);
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   299
		} else {
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   300
			return ""; //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   301
		}
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   302
	}
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
   303
	
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
	@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
   305
	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
   306
		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
   307
		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
   308
		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
   309
				+ ((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
   310
		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
   311
		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
   312
		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
   313
	}
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
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
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
	@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
   317
	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
   318
		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
   319
			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
   320
		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
   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
		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
   323
			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
   324
		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
   325
		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
   326
			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
   327
				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
   328
		} 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
   329
			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
   330
		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
   331
			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
   332
				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
   333
		} 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
   334
			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
   335
		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
   336
			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
   337
				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
   338
		} 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
   339
			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
   340
		}
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
   341
		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
   342
	}
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
   343
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   344
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   345
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   346
}