core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
author timkelly
Fri, 04 Jun 2010 16:34:02 -0500
branchC3_BUILDER_WORK
changeset 1433 1a693b01d107
parent 1425 7903a1588fd4
child 1434 79471fd1fd69
child 1437 8534c28043b9
permissions -rw-r--r--
1) Reworking cconfiguration 'id' to be separate from the config display name 2) For SBSv2, show configs that live in the project but are otherwise filtered out when managing configs (still needs cleanup) Support for building older 2.x SBSv2 projects not working yet.
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;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    24
	private ISymbianSDK sdk;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    25
	private String displayString;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    26
	private String configID;  // cconfiguration 'id' attribute from .cproject
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    27
	
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    28
	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
    29
		this.sdk = theSDK;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    30
		this.platform = thePlatform.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    31
		this.target = theTarget.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    32
		this.sbsv2Alias = theSBSv2Alias;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    33
		this.displayString = displayName;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    34
		this.configID = configID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    35
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    36
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    37
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    38
	public ISymbianSDK getSDK() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    39
		return sdk;
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
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    42
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    43
	public String getPlatformString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    44
		return platform;
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
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    47
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    48
	public String getTargetString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    49
		return target;
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
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    52
	public String getConfigID(){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    53
		return configID;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    54
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    55
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    56
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    57
	public String getDisplayString() {
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    58
		
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
    59
		
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    60
		// TODO: Still need to decide on how to set display string
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    61
		// and how it's used for legacy SBSv2 configs
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    62
		if (displayString != null && !displayString.equals(configID)){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    63
			return displayString;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    64
		}
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
    65
		
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    66
		// TODO: else fallback for old configs, we should convert
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    67
		String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    68
		String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    69
		String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    70
		String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    71
		String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    72
		String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$
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
    73
		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
    74
		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
    75
			// 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
    76
			// 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
    77
			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
    78
				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
    79
			} 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
    80
				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
    81
			}
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
			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
    84
				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
    85
			} 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
    86
				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
    87
			}
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    88
			
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    89
			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
    90
			
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    91
			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
    92
		}
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
    93
		return displayString;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    94
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    95
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    96
	@Override
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    97
	public String toString() {
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    98
		return getConfigID();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    99
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   100
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   101
	@Override
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   102
	public String getDefaultDefFileDirectoryName(boolean isASSP) {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   103
		// 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
   104
		// TODO: How the ASSP option affects the path?
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   105
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   106
		String dirName = getDefFileDirectoryNameForPlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   107
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   108
			// check BSF's
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   109
			IBSFCatalog catalog = getSDK().getBSFCatalog();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   110
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   111
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   112
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   113
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   114
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   115
	    					dirName = getDefFileDirectoryNameForPlatform(mainPlatform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   116
	    					if (dirName == null || dirName.length() < 1) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   117
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   118
			    				return "EABI"; //$NON-NLS-1$
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
	    			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   122
	    		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   123
	    	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   124
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   125
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   126
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   127
			// fallback for unknown cases
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   128
			dirName = platform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   129
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   130
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   131
		return dirName;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   132
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   133
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   134
	private String getDefFileDirectoryNameForPlatform(String platform) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   135
		// TODO: This is still ABLD stype stuff
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   136
		if (platform.equals(EMULATOR_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   137
			return "BWINS"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   138
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   139
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   140
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   141
					|| platform.equals(ARMV6_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   142
					|| platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   143
			return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   144
		}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   145
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   146
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   147
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   148
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   149
	public IPath getCompilerPrefixFile() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   150
		// 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
   151
		if (platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   152
			return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   153
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   154
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   155
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   156
					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   157
			return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   158
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   159
			// check BSF's
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   160
			IBSFCatalog catalog = getSDK().getBSFCatalog();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   161
	    	if (catalog != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   162
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   163
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   164
	    				String mainPlatform = catalog.getReleasePlatform(platform);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   165
	    				if (mainPlatform != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   166
	    					if (mainPlatform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   167
	    						return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   168
	    					} else if (mainPlatform.equals(ARMV5_PLATFORM) 
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   169
	    								|| mainPlatform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   170
	    								|| mainPlatform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   171
	    								|| mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   172
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   173
	    					} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   174
	    						// fallback - all BSF's should be EABI anyway
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   175
	    						return getRVCTPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   176
	    					}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   177
	    				}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   178
	    			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   179
	    		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   180
	    	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   181
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   182
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   183
		// fallback for WINSCW, MSVC, etc.
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   184
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   185
	}
1419
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
	private IPath getGCCEPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   188
		// TOOD: Should get from Raptor query when available
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   189
		return getSDK().getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   190
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   191
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   192
	private IPath getRVCTPrefixFilePath() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   193
		// TODO: Should get this from query mechanism
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   194
		IRVCTToolChainInfo[] installedRVCTTools = SDKCorePlugin.getSDKManager().getInstalledRVCTTools();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   195
		// use default in case tools aren't installed
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   196
		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   197
		if (installedRVCTTools.length > 0) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   198
			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   199
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   200
		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
   201
		if (prefixFilePath.toFile().exists()){
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   202
			return prefixFilePath;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   203
		} else {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   204
			// 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
   205
			// based on the default installation
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   206
			return getSDK().getIncludePath().append("rvct").append("rvct" + ".h");
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   207
		}
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
	
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   210
	private String getRVCTFragment(IRVCTToolChainInfo info) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   211
		// 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
   212
		int major = 0, minor = 0;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   213
		if (info != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   214
			Version rvctToolsVersion = info.getRvctToolsVersion();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   215
			if (rvctToolsVersion != null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   216
				major = info.getRvctToolsVersion().getMajor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   217
				minor = info.getRvctToolsVersion().getMinor();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   218
			}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   219
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   220
		return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   221
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   222
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   223
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   224
	public List<IDefine> getVariantHRHDefines() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   225
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   226
		return getCachedData().getVariantHRHDefines();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   227
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   228
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   229
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   230
	public List<File> getPrefixFileIncludes() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   231
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   232
		return getCachedData().getPrefixFileIncludes();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   233
	}
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   236
	public List<IDefine> getCompilerMacros() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   237
		// TODO: Should get from raptor query
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   238
		// 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
   239
		// 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
   240
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   241
		IPath prefixFile = getCompilerPrefixFile();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   242
		if (prefixFile == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   243
			return Collections.emptyList();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   244
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   245
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   246
		return getCachedData().getCompilerMacros(prefixFile);
1418
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
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   250
	public String getBuildVariationName() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   251
		// TODO: This should not be needed for Raptor
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   252
		return "";
1418
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
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   255
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   256
	public boolean isSymbianBinaryVariation() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   257
		// 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
   258
		// in the MPP for the featurevariant keyword perhaps
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   259
		return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   260
	}
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
	 * 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
   264
	 * @param displayName
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   265
	 * @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
   266
	 */
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   267
	private static String getSBSv2AliasFromConfigName(String displayName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   268
		int indexBegin = displayName.indexOf("(");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   269
		int indexEnd = displayName.indexOf(")");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   270
		if (indexBegin > 0 && indexEnd > 0){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   271
			String configPart =  displayName.substring(indexBegin+1, indexEnd);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   272
			if (configPart.split("_").length > 1){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   273
				return configPart;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   274
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   275
		} 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   276
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   277
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   278
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   279
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   280
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   281
	public String getSBSv2Alias() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   282
		return sbsv2Alias;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   283
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   284
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   285
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   286
	 * 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
   287
	 * A build context is subclassed by CarbideBuildConfiguration, which has multiple
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   288
	 * 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
   289
	 * @return cache, never <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   290
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   291
	private SymbianBuildContextDataCache getCachedData() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   292
		// 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
   293
		return SymbianBuildContextDataCache.getCache(this);
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   294
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   295
	
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   296
	/**
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   297
	 * Get the list of #include paths detected for this context.
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   298
	 * @return List or <code>null</code>
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   299
	 */
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   300
	public List<File> getCachedSystemIncludePaths() {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   301
		// 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
   302
		return getCachedData().getSystemIncludePaths();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   303
	}
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   304
	
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   305
	
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   306
	// 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
   307
	public static String getSDKIDFromConfigName(String configName) {
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   308
		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   309
		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   310
		if (indexBegin > 0 && indexEnd > 0){
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   311
			return configName.substring(indexBegin+1, indexEnd);
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   312
		} else {
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   313
			return ""; //$NON-NLS-1$
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   314
		}
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   315
	}
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
   316
	
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
	@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
   318
	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
   319
		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
   320
		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
   321
		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
   322
				+ ((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
   323
		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
   324
		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
   325
		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
   326
	}
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
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
	@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
   330
	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
   331
		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
   332
			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
   333
		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
   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 (!(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
   336
			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
   337
		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
   338
		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
   339
			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
   340
				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
   341
		} 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
   342
			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
   343
		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
   344
			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
   345
				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
   346
		} 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
   347
			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
   348
		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
   349
			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
   350
				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
   351
		} 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
   352
			return false;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   353
		} else if (!configID.equals(other.configID)){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   354
			// 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
   355
			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
   356
		}
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
   357
		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
   358
	}
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
   359
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   360
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   361
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   362
}