core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv2.java
author timkelly
Wed, 16 Jun 2010 12:09:43 -0500
branchC3_BUILDER_WORK
changeset 1477 f4dfa2236dcf
parent 1476 09e768e53db5
child 1478 69015f2143b2
permissions -rw-r--r--
fix problem with sbsv2 context equals (ignore case on platform and target)
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;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
     4
import java.io.StringReader;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
     5
import java.util.ArrayList;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
     6
import java.util.Collections;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     7
import java.util.List;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     8
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
     9
import javax.xml.parsers.DocumentBuilder;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    10
import javax.xml.parsers.DocumentBuilderFactory;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    11
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    12
import org.eclipse.core.runtime.IPath;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    13
import org.eclipse.core.runtime.Path;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    14
import org.osgi.framework.Version;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    15
import org.w3c.dom.Element;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    16
import org.w3c.dom.NamedNodeMap;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    17
import org.w3c.dom.Node;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    18
import org.w3c.dom.NodeList;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    19
import org.xml.sax.InputSource;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    20
import org.xml.sax.helpers.DefaultHandler;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    21
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    22
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    23
import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv2BuildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    24
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    25
import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    26
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
    27
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
    28
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    29
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
    30
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
    31
import com.nokia.cpp.internal.api.utils.core.Check;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    32
import com.nokia.cpp.internal.api.utils.core.Logging;
1418
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
public class BuildContextSBSv2 implements ISBSv2BuildContext {
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
	private String platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    37
	private String target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    38
	private String sbsv2Alias;
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    39
	private String meaning;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    40
	private ISymbianSDK sdk;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    41
	private String displayString;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    42
	private String configID;  // cconfiguration 'id' attribute from .cproject
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    43
	
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    44
	// Raptor config query data
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    45
	String outputPathString;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    46
	List<String> metaDataMacros = new ArrayList<String>();  // macros to parse the INF/MMPs files (these do not contain values)
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    47
	List<String> metaDataIncludes = new ArrayList<String>();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    48
	String metaDataVariantHRH;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    49
	String configParseErrorMessage = null;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    50
	
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    51
	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
    52
		this.sdk = theSDK;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    53
		this.platform = thePlatform.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    54
		this.target = theTarget.toUpperCase();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    55
		this.sbsv2Alias = theSBSv2Alias;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    56
		this.displayString = displayName;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
    57
		this.configID = configID;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    58
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    59
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    60
	public BuildContextSBSv2(ISymbianSDK sdk, String alias, String meaning, String contextQueryXML) {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    61
		this.sdk = sdk;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    62
		this.sbsv2Alias = alias;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    63
		this.meaning = meaning;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    64
		this.configID = ISBSv2BuildContext.BUILDER_ID + "." + sbsv2Alias + "." + sdk.getUniqueId();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    65
		parseQueryConfigResults(contextQueryXML);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    66
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    67
		this.displayString = getPlatformString().toUpperCase() + " " + getTargetString().toUpperCase(); 
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    68
	}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    69
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    70
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    71
	public ISymbianSDK getSDK() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    72
		return sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    73
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    74
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    75
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    76
	public String getPlatformString() {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    77
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    78
		if (platform == null){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    79
			return configParseErrorMessage;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    80
		}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    81
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    82
		if (platform.contains(".")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    83
			return platform.split(".")[0];
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    84
		}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    85
		return platform;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    86
	}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    87
	
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    88
	public String getPlatformReleaseDirName() {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    89
		return platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    90
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    91
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    92
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    93
	public String getTargetString() {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    94
		if (target == null){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    95
			return configParseErrorMessage;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
    96
		}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    97
		return target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    98
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    99
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   100
	public String getConfigID(){
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   101
		return configID;
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   102
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   103
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   104
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   105
	public String getDisplayString() {
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   106
		Check.checkState(displayString != null);
1423
17dfd1c1fef1 return proper display name for SBSv2 configs until we start using project .cproject data to store config names
timkelly
parents: 1420
diff changeset
   107
		return displayString;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   108
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   109
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   110
	private ISBSv2BuildInfo getBuildInfo() {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   111
		ISBSv2BuildInfo buildInfo = (ISBSv2BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   112
		if (buildInfo == null) {
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1439
diff changeset
   113
			buildInfo = new SBSv2BuildInfo(getSDK());
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   114
			((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV2_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   115
		}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   116
		return buildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   117
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   118
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   119
	@Override
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   120
	public String toString() {
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   121
		return getConfigID();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   122
	}
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   123
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   124
	@Override
1471
62024a5fa81d Refactor out BSF/SBV support from SBSv2 Builder data. Create new package for SBSv2Query APIs (moved from builder tests).
timkelly
parents: 1462
diff changeset
   125
	public String getDefaultDefFileDirectoryName() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   126
		// 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
   127
		// TODO: How the ASSP option affects the path?
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   128
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   129
		String dirName = getDefFileDirectoryNameForPlatform(platform);
1471
62024a5fa81d Refactor out BSF/SBV support from SBSv2 Builder data. Create new package for SBSv2Query APIs (moved from builder tests).
timkelly
parents: 1462
diff changeset
   130
		// TODO: Previously BSF's folder was EABI? What is it for SBSv2 variants?
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   131
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   132
		if (dirName == null) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   133
			// fallback for unknown cases
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   134
			dirName = platform;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   135
		}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   136
		
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   137
		return dirName;
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   138
	}
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   139
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   140
	private String getDefFileDirectoryNameForPlatform(String platform) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   141
		// TODO: This is still ABLD stype stuff
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   142
		if (platform.equals(EMULATOR_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   143
			return "BWINS"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   144
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   145
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   146
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   147
					|| platform.equals(ARMV6_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   148
					|| platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   149
			return "EABI"; //$NON-NLS-1$
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   150
		}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   151
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   152
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   153
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   154
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   155
	public IPath getCompilerPrefixFile() {
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   156
		// 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
   157
		if (platform.equals(GCCE_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   158
			return getGCCEPrefixFilePath();
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   159
		} else if (platform.equals(ARMV5_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   160
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   161
					|| platform.equals(ARMV6_PLATFORM)
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   162
					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   163
			return getRVCTPrefixFilePath();
1471
62024a5fa81d Refactor out BSF/SBV support from SBSv2 Builder data. Create new package for SBSv2Query APIs (moved from builder tests).
timkelly
parents: 1462
diff changeset
   164
		} 
1419
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
		// fallback for WINSCW, MSVC, etc.
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   167
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   168
	}
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   169
	
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   170
	private IPath getIncludePath() {
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1439
diff changeset
   171
		return getSDK().getIncludePath();
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   172
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   173
1419
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
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   176
		return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
1419
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
		}
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   187
		IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
1419
ab555eecf681 some work to keep SBSv2 alive while refactoring
timkelly
parents: 1418
diff changeset
   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
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1433
diff changeset
   193
			return getIncludePath().append("rvct").append("rvct" + ".h");
1419
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
	
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
   292
	@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
   293
	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
   294
		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
   295
		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
   296
		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
   297
				+ ((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
   298
		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
   299
		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
   300
		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
   301
	}
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   302
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 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
   306
		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
   307
			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
   308
		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
   309
			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
   310
		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
   311
			return false;
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   312
		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
   313
		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
   314
			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
   315
				return false;
1477
f4dfa2236dcf fix problem with sbsv2 context equals (ignore case on platform and target)
timkelly
parents: 1476
diff changeset
   316
		} else if (!sbsv2Alias.equalsIgnoreCase(other.sbsv2Alias))
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
   317
			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
   318
		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
   319
			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
   320
				return false;
1477
f4dfa2236dcf fix problem with sbsv2 context equals (ignore case on platform and target)
timkelly
parents: 1476
diff changeset
   321
		} else if (!getSDK().getEPOCROOT().equalsIgnoreCase(other.getSDK().getEPOCROOT()))
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
   322
			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
   323
		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
   324
			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
   325
				return false;
1477
f4dfa2236dcf fix problem with sbsv2 context equals (ignore case on platform and target)
timkelly
parents: 1476
diff changeset
   326
		} else if (!target.equalsIgnoreCase(other.target)) {
1425
7903a1588fd4 more work to keep SBSv2 and SBSV1 working after refactoring. I think we are back to functional parity as before the refactoring now.
timkelly
parents: 1423
diff changeset
   327
			return false;
1477
f4dfa2236dcf fix problem with sbsv2 context equals (ignore case on platform and target)
timkelly
parents: 1476
diff changeset
   328
		} else if (!configID.equalsIgnoreCase(other.configID)){
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1425
diff changeset
   329
			// 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
   330
			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
   331
		}
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
	}
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
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   335
	public static String getPlatformFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   336
		String[] tokens = displayString.split(" ");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   337
		String sdkIdToken = tokens[2];
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   338
		if (sdkIdToken.contains("_")){
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   339
			sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   340
			String[] aliasTokens = sdkIdToken.split("_");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   341
			return aliasTokens[0];
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   342
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   343
			return sdkIdToken.substring(1, sdkIdToken.length()-1);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   344
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   345
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   346
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   347
	public static String getTargetFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   348
		String[] tokens = displayString.split(" ");
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   349
		if (tokens[1].compareTo("Debug") == 0) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   350
			return ISymbianBuildContext.DEBUG_TARGET;
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   351
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   352
			return ISymbianBuildContext.RELEASE_TARGET;
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   353
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   354
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   355
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   356
	public static String getBuildAliasFromV1ConfigName(String displayString) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   357
		String target = getTargetFromV1ConfigName(displayString);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   358
		String platform = getPlatformFromV1ConfigName(displayString);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   359
		return platform.toLowerCase() + "_" + target.toLowerCase();
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   360
	}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   361
	
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   362
	// Fall-back to get SDK id from old config name
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   363
	public static String getSDKIDFromV1ConfigName(String configName) {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   364
		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   365
		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   366
		if (indexBegin > 0 && indexEnd > 0){
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   367
			return configName.substring(indexBegin+1, indexEnd);
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   368
		} else {
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   369
			return ""; //$NON-NLS-1$
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   370
		}
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   371
	}
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   372
	
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   373
	
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   374
	private void parseQueryConfigResults(String queryResult) {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   375
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   376
		try {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   377
    		Element root = null;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   378
    		DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   379
    		parser.setErrorHandler(new DefaultHandler());
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   380
    		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   381
    		StringReader reader = new StringReader( queryResult );
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   382
    		InputSource inputSource = new InputSource( reader );
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   383
    		root = parser.parse(inputSource).getDocumentElement();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   384
    		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   385
    		NodeList children = root.getChildNodes();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   386
    		for (int i=0; i< children.getLength(); i++) {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   387
    			Node configNode = children.item(i);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   388
    			if (configNode.getNodeName().equals("config")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   389
    				NamedNodeMap aliasAttribs = configNode.getAttributes();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   390
    				String dottedName = aliasAttribs.getNamedItem("meaning").getNodeValue();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   391
    				if (!dottedName.equalsIgnoreCase(meaning)){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   392
    					continue;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   393
    				}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   394
    				if (configNode.getTextContent() != null&& configNode.getTextContent().length() > 0){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   395
    					// The config failed, likely due to envrionment set up issue.
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   396
    					// Save the error message
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   397
    					configParseErrorMessage = configNode.getTextContent();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   398
    					break;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   399
    				}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   400
    				
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   401
    				String outputpath = aliasAttribs.getNamedItem("outputpath").getNodeValue();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   402
    				if (outputpath != null){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   403
    					outputPathString = outputpath;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   404
    				}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   405
    				
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   406
    				// get <metadata>
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   407
    				NodeList configChillens = configNode.getChildNodes();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   408
    				for (int ii = 0; ii < configChillens.getLength(); ii++){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   409
    					Node metaDataNode = configChillens.item(ii);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   410
    					if (metaDataNode.getNodeName().equals("metadata")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   411
    						NodeList metaDataChillens = metaDataNode.getChildNodes();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   412
    						for (int iii = 0; iii < metaDataChillens.getLength(); iii++){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   413
    							Node metaChild = metaDataChillens.item(iii);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   414
    							NamedNodeMap attribs = metaChild.getAttributes();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   415
    							try {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   416
									if (metaChild.getNodeName().equals("macro")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   417
										String name = attribs.getNamedItem("name").getNodeValue();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   418
										metaDataMacros.add(name);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   419
									} else if (metaChild.getNodeName().equals("include")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   420
										String path = attribs.getNamedItem("path").getNodeValue();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   421
										metaDataIncludes.add(path);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   422
									} else if (metaChild.getNodeName().equals("preinclude")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   423
										metaDataVariantHRH = attribs.getNamedItem("file").getNodeValue();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   424
									}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   425
								} catch (Exception e) {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   426
									// skip it
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   427
									e.printStackTrace();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   428
								}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   429
    						}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   430
    						
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   431
    					} else if (metaDataNode.getNodeName().equals("compilerinfo")){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   432
    						// TODO: Placeholder for future cpp preprocessor macros and compiler prefix
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   433
    						// Not sure what it will be called yet.
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   434
    					}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   435
    				}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   436
    				
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   437
    				break;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   438
    			}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   439
    		}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   440
    		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   441
    	} catch (Exception e) {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   442
    		e.printStackTrace();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   443
    		Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   444
    	}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   445
    	
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   446
    	setPlatformAndTargetFromOutputPath();
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   447
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   448
	}
1438
03403c6a4740 Fixing up bug 11025 to load SBSv2 build contexts for older config names (no project config conversions done).
timkelly
parents: 1437
diff changeset
   449
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   450
	private void setPlatformAndTargetFromOutputPath() {
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   451
		if (outputPathString == null) return;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   452
		
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   453
		IPath releasePath = new Path(outputPathString);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   454
		int epoc32SegmentIndex = 0;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   455
		for (String segment : releasePath.segments()){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   456
			if (segment.toLowerCase().equals("epoc32"))
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   457
				break;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   458
			epoc32SegmentIndex++;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   459
		}
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   460
		// assuming /epoc32/<release>/<target>/
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   461
		platform = releasePath.segment(epoc32SegmentIndex+2);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   462
		target = releasePath.segment(epoc32SegmentIndex+3);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   463
	}
1420
9dfc6e3dc4b9 more ISymbianBuildCOntext refactoring to get SBSv1 & SBSv2 working to origianl state
timkelly
parents: 1419
diff changeset
   464
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   465
	/**
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   466
	 * Error message, if any.
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   467
	 * @return An error message if a problem occurred while trying to get config info from Raptor. Null if no error.
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   468
	 */
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   469
	public String getConfigurationErrorMessage(){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   470
		return configParseErrorMessage;
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1471
diff changeset
   471
	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   472
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   473
}