core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/BuildContextSBSv1.java
author timkelly
Tue, 10 Aug 2010 19:18:52 -0500
branchC3_BUILDER_WORK
changeset 1802 7e50573a0115
parent 1801 1d73a4591cf8
parent 1799 ee7381872847
child 1803 9482220f0b7b
permissions -rw-r--r--
merge commit
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     1
/*
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     3
* All rights reserved.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     4
* This component and the accompanying materials are made available
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     6
* which accompanies this distribution, and is available
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     8
*
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
     9
* Initial Contributors:
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    11
*
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    12
*/
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    13
package com.nokia.carbide.cpp.internal.api.sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    14
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    15
import java.io.File;
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    16
import java.io.FileReader;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    17
import java.io.IOException;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    18
import java.io.Reader;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    19
import java.util.ArrayList;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    20
import java.util.Collections;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    21
import java.util.List;
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    22
import java.util.regex.Matcher;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    23
import java.util.regex.Pattern;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    24
1755
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
    25
import org.eclipse.cdt.core.settings.model.ICStorageElement;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    26
import org.eclipse.core.runtime.IPath;
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    27
import org.eclipse.core.runtime.Path;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    28
import org.osgi.framework.Version;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    29
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    30
import com.nokia.carbide.cpp.epoc.engine.preprocessor.IDefine;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    31
import com.nokia.carbide.cpp.internal.sdk.core.model.SBSv1BuildInfo;
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1770
diff changeset
    32
import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    33
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianMissingSDKFactory;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    34
import com.nokia.carbide.cpp.internal.sdk.core.model.SymbianSDK;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    35
import com.nokia.carbide.cpp.sdk.core.IBSFCatalog;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    36
import com.nokia.carbide.cpp.sdk.core.IBSFPlatform;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    37
import com.nokia.carbide.cpp.sdk.core.IRVCTToolChainInfo;
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1770
diff changeset
    38
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    39
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    40
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    41
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
    42
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    43
1799
ee7381872847 mark abld-specific methods as deprecated
timkelly
parents: 1779
diff changeset
    44
/**
ee7381872847 mark abld-specific methods as deprecated
timkelly
parents: 1779
diff changeset
    45
 * @deprecated - Temporary support exists for abld on Symbian^2 but will be removed, vFuture
ee7381872847 mark abld-specific methods as deprecated
timkelly
parents: 1779
diff changeset
    46
 *
ee7381872847 mark abld-specific methods as deprecated
timkelly
parents: 1779
diff changeset
    47
 */
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    48
public class BuildContextSBSv1 implements ISBSv1BuildContext {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    49
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    50
	private String sdkId;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    51
	private String platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    52
	private String target;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    53
	private String displayString = null;
1479
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
    54
		
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    55
	private static String EMULATOR_DISPLAY_TEXT = "Emulator"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    56
	private static String PHONE_DISPLAY_TEXT = "Phone"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    57
	private static String DEBUG_DISPLAY_TEXT = "Debug"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    58
	private static String RELEASE_DISPLAY_TEXT = "Release"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    59
	private static String SPACE_DISPLAY_TEXT = " "; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    60
	private static String SDK_NOT_INSTALLED = "SDK not installed"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    61
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    62
	// a copy of bad SDK default to fall back
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    63
	private static ISymbianSDK fallbackForBadSdk = SymbianMissingSDKFactory.createInstance("dummy_ID"); //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    64
	
1755
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
    65
	// Preference data
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
    66
	protected BuildArgumentsInfo buildArgumentsInfo;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
    67
	protected final static String ARGUMENTS_DATA_ID = "ARGUMENTS_DATA_ID"; //$NON-NLS-1$
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
    68
	
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    69
	// --> variant.cfg info
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    70
	// greedy match means the filename is in the last group
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    71
	public static Pattern VARIANT_HRH_LINE_PATTERN = Pattern.compile("(?i)(.*)(/|\\\\)(.*hrh)");
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    72
	private IPath variantFilePath;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    73
	public static final String VARIANT_CFG_FILE = "epoc32/tools/variant/variant.cfg"; //$NON-NLS-1$
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    74
	public static final String SPP_VARIANT_CFG_FILE = "epoc32/tools/variant/spp_variant.cfg"; //$NON-NLS-1$
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    75
	// <--
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
    76
	
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    77
	public BuildContextSBSv1(ISymbianSDK theSDK, String thePlatform, String theTarget) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    78
		sdkId = theSDK.getUniqueId();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    79
		platform = thePlatform.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    80
		target = theTarget.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    81
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    82
		getDisplayString();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    83
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    84
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    85
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    86
	public int hashCode() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    87
		final int prime = 31;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    88
		int result = 1;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    89
		result = prime * result
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    90
				+ ((platform == null) ? 0 : platform.hashCode());
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    91
		result = prime * result + ((getSDK() == null) ? 0 : getSDK().getEPOCROOT().hashCode());
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    92
		result = prime * result + ((target == null) ? 0 : target.hashCode());
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    93
		return result;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    94
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    95
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    96
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    97
	@Override
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    98
	public boolean equals(Object obj) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
    99
		if (this == obj)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   100
			return true;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   101
		if (obj == null)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   102
			return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   103
		if (!(obj instanceof BuildContextSBSv1))
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   104
			return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   105
		final BuildContextSBSv1 other = (BuildContextSBSv1) obj;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   106
		if (platform == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   107
			if (other.platform != null)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   108
				return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   109
		} else if (!platform.equals(other.platform))
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   110
			return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   111
		if (getSDK() == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   112
			if (other.getSDK() != null)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   113
				return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   114
		} else if (!getSDK().getEPOCROOT().equals(other.getSDK().getEPOCROOT()))
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   115
			return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   116
		if (target == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   117
			if (other.target != null)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   118
				return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   119
		} else if (!target.equals(other.target)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   120
			return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   121
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   122
		return true;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   123
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   124
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   125
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   126
	public ISymbianSDK getSDK() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   127
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   128
		ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   129
		if (sdk == null){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   130
			sdk = fallbackForBadSdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   131
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   132
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   133
		return sdk;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   134
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   135
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   136
	public String getPlatformString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   137
		return platform.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   138
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   139
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   140
	public String getTargetString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   141
		return target.toUpperCase();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   142
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   143
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   144
	public String getDisplayString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   145
		if (displayString == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   146
			// in the form Emulation Debug (WINSCW) [S60_3rd_MR] or
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   147
			// Phone Release (GCCE) [S60_3rd_MR]
1479
a654857ddb87 refactor out ABLD-style platform constants into ISBSv1BuildContext from ISymbianBuildContext
timkelly
parents: 1471
diff changeset
   148
			if (platform.compareTo(EMULATOR_PLATFORM) == 0) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   149
				displayString = EMULATOR_DISPLAY_TEXT;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   150
			} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   151
				displayString = PHONE_DISPLAY_TEXT;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   152
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   153
			
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   154
			if (target.compareTo(ISymbianBuildContext.DEBUG_TARGET) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   155
				displayString = displayString + SPACE_DISPLAY_TEXT + DEBUG_DISPLAY_TEXT;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   156
			} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   157
				displayString = displayString + SPACE_DISPLAY_TEXT + RELEASE_DISPLAY_TEXT;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   158
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   159
			
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   160
			String basePlatform = platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   161
			
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   162
			displayString = displayString + " (" + basePlatform + ") [" + getSDK().getUniqueId() + "]"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   163
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   164
		return displayString;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   165
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   166
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   167
	public static ISymbianBuildContext getBuildContextFromDisplayName(String displayName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   168
		if (isValidConfigName(displayName)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   169
			String sdkId = getSDKIDFromConfigName(displayName);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   170
			ISymbianSDK sdk = SDKCorePlugin.getSDKManager().getSDK(sdkId, true);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   171
			if (sdk == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   172
				// add a dummy should a build context ask for a removed SDK
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   173
				sdk = SDKManagerInternalAPI.addMissingSdk(sdkId);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   174
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   175
						
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   176
			return new BuildContextSBSv1(sdk, 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   177
						getPlatformFromBuildConfigName(displayName), 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   178
						getTargetFromBuildConfigName(displayName));
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   179
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   180
		return new BuildContextSBSv1(fallbackForBadSdk, SDK_NOT_INSTALLED, SDK_NOT_INSTALLED);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   181
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   182
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   183
	private static String getPlatformFromBuildConfigName(String configName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   184
		String[] tokens = configName.split(SPACE_DISPLAY_TEXT);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   185
		String sdkIdToken = tokens[2];
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   186
		if (sdkIdToken.contains("_")){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   187
			sdkIdToken = sdkIdToken.substring(1, sdkIdToken.length()-1);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   188
			String[] aliasTokens = sdkIdToken.split("_");
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   189
			return aliasTokens[0];
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   190
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   191
			return sdkIdToken.substring(1, sdkIdToken.length()-1);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   192
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   193
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   194
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   195
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   196
	public static String getSDKIDFromConfigName(String configName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   197
		int indexBegin = configName.indexOf("[");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   198
		int indexEnd = configName.indexOf("]");  //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   199
		if (indexBegin > 0 && indexEnd > 0){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   200
			return configName.substring(indexBegin+1, indexEnd);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   201
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   202
			return ""; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   203
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   204
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   205
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   206
	private static String getTargetFromBuildConfigName(String configName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   207
		String[] tokens = configName.split(SPACE_DISPLAY_TEXT);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   208
		if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   209
			return ISymbianBuildContext.DEBUG_TARGET;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   210
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   211
			return ISymbianBuildContext.RELEASE_TARGET;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   212
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   213
	}
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
	private static boolean isValidConfigName(String configName) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   216
		// <Phone | Emulator> <Target> (<Platform>) [<SDK ID>]
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   217
		if (configName != null && !configName.equals("")) { //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   218
			String[] tokens = configName.split(SPACE_DISPLAY_TEXT);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   219
			if (tokens.length >= 4) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   220
				if (tokens[0].compareTo(EMULATOR_DISPLAY_TEXT) == 0 || tokens[0].compareTo(PHONE_DISPLAY_TEXT) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   221
					if (tokens[1].compareTo(DEBUG_DISPLAY_TEXT) == 0 || tokens[1].compareTo(RELEASE_DISPLAY_TEXT) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   222
						if (tokens[2].matches("(.*)")) { //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   223
							if (tokens[3].matches("\\[.*")) { //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   224
								return true;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   225
							}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   226
						}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   227
					}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   228
				}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   229
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   230
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   231
		return false;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   232
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   233
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   234
	public String toString() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   235
		return getDisplayString();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   236
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   237
	
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   238
	private ISBSv1BuildInfo getBuildInfo() {
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   239
		ISBSv1BuildInfo buildInfo = (ISBSv1BuildInfo)getSDK().getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   240
		if (buildInfo == null) {
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   241
			buildInfo = new SBSv1BuildInfo(getSDK());
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   242
			((SymbianSDK)getSDK()).setBuildInfo(buildInfo, ISymbianBuilderID.SBSV1_BUILDER);
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   243
		}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   244
		return buildInfo;
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   245
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   246
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
   247
	public String getDefaultDefFileDirectoryName() {
1418
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
		String dirName = getDefFileDirectoryNameForPlatform(platform);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   250
		if (dirName == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   251
			// check BSF's
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   252
			IBSFCatalog catalog = getBuildInfo().getBSFCatalog();
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   253
			if (catalog != null) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   254
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   255
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   256
	    				String mainPlatform = catalog.getReleasePlatform(platform);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   257
	    				if (mainPlatform != null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   258
	    					dirName = getDefFileDirectoryNameForPlatform(mainPlatform);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   259
	    					if (dirName == null || dirName.length() < 1) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   260
	    						// fallback - all BSF's should be EABI anyway
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   261
			    				return "EABI"; //$NON-NLS-1$
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
	    			}
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
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   268
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   269
		if (dirName == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   270
			// fallback for unknown cases
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   271
			dirName = platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   272
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   273
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   274
		return dirName;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   275
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   276
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   277
	private String getDefFileDirectoryNameForPlatform(String platform) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   278
		if (platform.equals(EMULATOR_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   279
			return "BWINS"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   280
		} else if (platform.equals(ARMV5_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   281
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   282
					|| platform.equals(ARMV6_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   283
					|| platform.equals(ARMV6_ABIV2_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   284
					|| platform.equals(GCCE_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   285
			return "EABI"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   286
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   287
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   288
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   289
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   290
	public IPath getCompilerPrefixFile() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   291
		if (platform.equals(GCCE_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   292
			return getGCCEPrefixFilePath();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   293
		} else if (platform.equals(ARMV5_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   294
					|| platform.equals(ARMV5_ABIV2_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   295
					|| platform.equals(ARMV6_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   296
					|| platform.equals(ARMV6_ABIV2_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   297
			return getRVCTPrefixFilePath();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   298
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   299
			// check BSF's
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   300
			IBSFCatalog catalog = getBuildInfo().getBSFCatalog();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   301
	    	if (catalog != null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   302
	    		for (IBSFPlatform plat : catalog.getPlatforms()) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   303
	    			if (plat.getName().compareToIgnoreCase(platform) == 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   304
	    				String mainPlatform = catalog.getReleasePlatform(platform);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   305
	    				if (mainPlatform != null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   306
	    					if (mainPlatform.equals(GCCE_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   307
	    						return getGCCEPrefixFilePath();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   308
	    					} else if (mainPlatform.equals(ARMV5_PLATFORM) 
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   309
	    								|| mainPlatform.equals(ARMV5_ABIV2_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   310
	    								|| mainPlatform.equals(ARMV6_PLATFORM)
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   311
	    								|| mainPlatform.equals(ARMV6_ABIV2_PLATFORM)) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   312
	    						return getRVCTPrefixFilePath();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   313
	    					} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   314
	    						// fallback - all BSF's should be EABI anyway
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   315
	    						return getRVCTPrefixFilePath();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   316
	    					}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   317
	    				}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   318
	    			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   319
	    		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   320
	    	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   321
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   322
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   323
		// fallback for WINSCW, MSVC, etc.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   324
		return null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   325
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   326
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   327
	private IPath getIncludePath() {
1462
b38491fd06da More ISymbianSDK refactoring.
stechong
parents: 1434
diff changeset
   328
		return getSDK().getIncludePath();
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   329
	}
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   330
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   331
	private IPath getGCCEPrefixFilePath() {
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   332
		return getIncludePath().append("gcce/gcce.h"); //$NON-NLS-1$
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   333
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   334
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   335
	private IPath getRVCTPrefixFilePath() {
1776
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1770
diff changeset
   336
		ISDKManager sdkManager = SDKCorePlugin.getSDKManager();
ad19bba5eef8 refactoring ISDKManager - removing unnecessary API
timkelly
parents: 1770
diff changeset
   337
		IRVCTToolChainInfo[] installedRVCTTools = ((SDKManager)sdkManager).getInstalledRVCTTools();
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   338
		// use default in case tools aren't installed
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   339
		String rvctFragment = "rvct2_2"; //$NON-NLS-1$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   340
		if (installedRVCTTools.length > 0) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   341
			rvctFragment = getRVCTFragment(installedRVCTTools[0]);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   342
		}
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   343
		IPath prefixFilePath = getIncludePath().append(rvctFragment).append(rvctFragment + ".h"); //$NON-NLS-1$
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   344
		if (prefixFilePath.toFile().exists()){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   345
			return prefixFilePath;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   346
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   347
			// SF kits around SF^3 started to only use a single rvct.h header instead of specific versioned ones
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   348
			// based on the default installation
1434
79471fd1fd69 First pass refactoring ISymbianSDK.
stechong
parents: 1418
diff changeset
   349
			return getIncludePath().append("rvct").append("rvct" + ".h");
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   350
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   351
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   352
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   353
	private String getRVCTFragment(IRVCTToolChainInfo info) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   354
		int major = 0, minor = 0;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   355
		if (info != null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   356
			Version rvctToolsVersion = info.getRvctToolsVersion();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   357
			if (rvctToolsVersion != null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   358
				major = info.getRvctToolsVersion().getMajor();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   359
				minor = info.getRvctToolsVersion().getMinor();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   360
			}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   361
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   362
		return "rvct" + major + "_" + minor; //$NON-NLS-1$ //$NON-NLS-2$
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   363
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   364
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   365
	public List<IDefine> getVariantHRHDefines() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   366
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   367
		return getCachedData().getVariantHRHDefines();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   368
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   369
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   370
	public List<File> getVariantHRHIncludes() {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   371
		return getCachedData().getPrefixFileIncludes();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   372
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   373
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   374
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   375
	public List<IDefine> getCompilerPreincludeDefines() {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   376
		// we parse the compiler prefix file to gather macros.  this can be time consuming so do it
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   377
		// once and cache the values.  only reset the cache when the compiler prefix has changed.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   378
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   379
		IPath prefixFile = getCompilerPrefixFile();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   380
		if (prefixFile == null) {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   381
			return Collections.emptyList();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   382
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   383
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   384
		return getCachedData().getCompilerMacros(prefixFile);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   385
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   386
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   387
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   388
	public String getBuildVariationName() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   389
		String varName = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   390
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   391
		String[] tokens = getPlatformString().split("\\.");
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   392
		if (tokens.length == 2){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   393
			varName = tokens[1];
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   394
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   395
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   396
		return varName;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   397
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   398
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   399
//	public boolean isSymbianBinaryVariation() {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   400
//		if (getPlatformString().split("\\.").length == 2){
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   401
//			return true;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   402
//		} else {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   403
//			return false;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   404
//		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   405
//	}
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   406
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   407
	/**
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   408
	 * Get the cache holding the data that applies to this build context globally.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   409
	 * A build context is subclassed by CarbideBuildConfiguration, which has multiple
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   410
	 * instances at runtime, thus, a SymbianBuildContext instance should not hold a cache itself.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   411
	 * @return cache, never <code>null</code>
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   412
	 */
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   413
	private SymbianBuildContextDataCache getCachedData() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   414
		return SymbianBuildContextDataCache.getCache(this);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   415
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   416
	
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   417
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   418
	public String getBasePlatformForVariation() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   419
		String plat = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   420
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   421
		String[] tokens = getPlatformString().split("\\.");
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   422
		if (tokens.length == 2){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   423
			plat = tokens[0];
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   424
		} else {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   425
			return platform;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   426
		}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   427
		
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   428
		return plat;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   429
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   430
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   431
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   432
	/**
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   433
	 * Get the list of #include paths detected for this context.
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   434
	 * @return List or <code>null</code>
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   435
	 */
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   436
	public List<File> getCachedSystemIncludePaths() {
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   437
		return getCachedData().getSystemIncludePaths();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   438
	}
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   439
1755
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   440
	@Override
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   441
	public void loadConfigurationSettings(ICStorageElement se) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   442
		if (se.getName().equals(ARGUMENTS_DATA_ID)) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   443
			loadBuildArgsFromStorage(se);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   444
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   445
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   446
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   447
	@Override
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   448
	public IBuildArgumentsInfo getBuildArgumentsInfo() {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   449
		return (IBuildArgumentsInfo)buildArgumentsInfo;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   450
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   451
	
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   452
	@Override
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   453
	public BuildArgumentsInfo getBuildArgumentsInfoCopy() {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   454
		return new BuildArgumentsInfo(buildArgumentsInfo);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   455
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   456
	
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   457
	@Override
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   458
	public void setBuildArgumentsInfo(BuildArgumentsInfo buildArgumentsInfo) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   459
		this.buildArgumentsInfo = buildArgumentsInfo;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   460
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   461
	
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   462
	@SuppressWarnings("deprecation")
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   463
	private void loadBuildArgsFromStorage(ICStorageElement rootStorage) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   464
		buildArgumentsInfo = new BuildArgumentsInfo(getSDK());
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   465
		String value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   466
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   467
			buildArgumentsInfo.bldmakeBldFilesArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   468
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   469
		
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   470
		value = rootStorage.getAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   471
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   472
			buildArgumentsInfo.bldmakeCleanArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   473
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   474
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   475
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   476
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   477
			buildArgumentsInfo.abldBuildArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   478
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   479
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   480
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   481
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   482
			buildArgumentsInfo.abldExportArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   483
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   484
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   485
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   486
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   487
			buildArgumentsInfo.abldMakefileArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   488
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   489
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   490
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   491
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   492
			buildArgumentsInfo.abldLibraryArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   493
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   494
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   495
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   496
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   497
			buildArgumentsInfo.abldResourceArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   498
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   499
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   500
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   501
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   502
			buildArgumentsInfo.abldTargetArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   503
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   504
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   505
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   506
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   507
			buildArgumentsInfo.abldFinalArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   508
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   509
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   510
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   511
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   512
			buildArgumentsInfo.abldCleanArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   513
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   514
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   515
		value = rootStorage.getAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   516
		if (value != null) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   517
			buildArgumentsInfo.abldFreezeArgs = value;
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   518
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   519
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   520
	
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   521
	public void saveBuildArgsToStorage(ICStorageElement rootStorage) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   522
		if (buildArgumentsInfo == null){
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   523
			buildArgumentsInfo = new BuildArgumentsInfo(getSDK());
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   524
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   525
		
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   526
		if (buildArgumentsInfo.bldmakeBldFilesArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   527
			rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKEBLDFILESARGSSTORAGE, buildArgumentsInfo.bldmakeBldFilesArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   528
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   529
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   530
		if (buildArgumentsInfo.bldmakeCleanArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   531
			rootStorage.setAttribute(BuildArgumentsInfo.BLDMAKECLEANARGSSTORAGE, buildArgumentsInfo.bldmakeCleanArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   532
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   533
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   534
		if (buildArgumentsInfo.abldBuildArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   535
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDBUILDARGSSTORAGE, buildArgumentsInfo.abldBuildArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   536
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   537
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   538
		if (buildArgumentsInfo.abldExportArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   539
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDEXPORTARGSSTORAGE, buildArgumentsInfo.abldExportArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   540
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   541
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   542
		if (buildArgumentsInfo.abldMakefileArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   543
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDMAKEFILEARGSSTORAGE, buildArgumentsInfo.abldMakefileArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   544
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   545
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   546
		if (buildArgumentsInfo.abldLibraryArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   547
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDLIBRARYARGSSTORAGE, buildArgumentsInfo.abldLibraryArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   548
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   549
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   550
		if (buildArgumentsInfo.abldResourceArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   551
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDRESOURCEARGSSTORAGE, buildArgumentsInfo.abldResourceArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   552
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   553
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   554
		if (buildArgumentsInfo.abldTargetArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   555
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDTARGETARGSSTORAGE, buildArgumentsInfo.abldTargetArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   556
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   557
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   558
		if (buildArgumentsInfo.abldFinalArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   559
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDFINALARGSSTORAGE, buildArgumentsInfo.abldFinalArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   560
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   561
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   562
		if (buildArgumentsInfo.abldCleanArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   563
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDCLEANARGSSTORAGE, buildArgumentsInfo.abldCleanArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   564
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   565
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   566
		if (buildArgumentsInfo.abldFreezeArgs.trim().length() > 0) {
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   567
			rootStorage.setAttribute(BuildArgumentsInfo.ABLDFREEZEARGSSTORAGE, buildArgumentsInfo.abldFreezeArgs);
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   568
		}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   569
	}
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   570
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   571
	@Override
1764
df8e072f8f71 refactoring sbsv2 configuration specific data under ISBSv2BuildContext interfaces (fixes some glitches with prior attempt)
timkelly
parents: 1755
diff changeset
   572
	public void saveConfigurationSettings(ICStorageElement se, ISymbianBuildContext context) {
1755
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   573
		saveBuildArgsToStorage(se.createChild(ARGUMENTS_DATA_ID)); 
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   574
	}
1770
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   575
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   576
	@Override
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   577
	/**
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   578
	 * Get the unique ID for this build configuration.
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   579
	 * For ABLD it is the display name, for SBSv2, it is the builder ID
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   580
	 * @return
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   581
	 */
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   582
	public String getConfigurationID() {
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   583
		return getDisplayString();
fa990cb697f7 refactor out some items from ICarbideBuildConfiguration that should just be under ISymbianBuildContext
timkelly
parents: 1764
diff changeset
   584
	}
1801
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   585
	
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   586
	/**
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   587
	 * Get the full path to the prefix file defined under \epoc32\tools\variant\variant.cfg
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   588
	 * @return A path object, or null if the variant.cfg does not exist. This routine does not check to see if the returned path exists.
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   589
	 */
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   590
	public IPath getPrefixFromVariantCfg(){
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   591
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   592
		if (variantFilePath != null){
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   593
			return variantFilePath;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   594
		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   595
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   596
		File epocRoot = new File(getSDK().getEPOCROOT());
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   597
		File variantCfg;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   598
		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   599
		if (!variantCfg.exists()) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   600
			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   601
			if (!variantCfg.exists())
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   602
				return null;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   603
		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   604
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   605
		String variantDir = null;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   606
		String variantFile = null;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   607
		try {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   608
			char[] cbuf = new char[(int) variantCfg.length()];
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   609
			Reader reader = new FileReader(variantCfg);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   610
			reader.read(cbuf);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   611
			reader.close();
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   612
			String[] lines = new String(cbuf).split("\r\n|\r|\n");
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   613
			for (int i = 0; i < lines.length; i++) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   614
				// skip comments and blank lines
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   615
				String line = SymbianSDK.removeComments(lines[i]);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   616
				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   617
					continue;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   618
				
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   619
				// parse the variant line, which is an EPOCROOT-relative
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   620
				// path to a bldvariant.hrh file
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   621
				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   622
				if (matcher.matches()) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   623
					variantDir = matcher.group(1);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   624
					variantFile = matcher.group(3); 
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   625
					File variantFullPathFile = new File(epocRoot, variantDir + File.separator + variantFile);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   626
					variantFilePath = new Path(PathUtils.convertPathToUnix(variantFullPathFile.getAbsolutePath()));
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   627
					return variantFilePath;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   628
				}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   629
			}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   630
		} catch (IOException e) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   631
		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   632
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   633
		return null; // can't find the file...
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   634
	}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   635
	
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   636
	@SuppressWarnings("unchecked")
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   637
	public List<String> getVariantCFGMacros(){
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   638
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   639
		List<String> variantCFGMacros = new ArrayList<String>();
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   640
		File epocRoot = new File(getSDK().getEPOCROOT());
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   641
		File variantCfg;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   642
		variantCfg = new File(epocRoot, SPP_VARIANT_CFG_FILE);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   643
		if (!variantCfg.exists()) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   644
			variantCfg = new File(epocRoot, VARIANT_CFG_FILE);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   645
			if (!variantCfg.exists())
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   646
				return Collections.EMPTY_LIST;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   647
		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   648
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   649
		try {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   650
			char[] cbuf = new char[(int) variantCfg.length()];
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   651
			Reader reader = new FileReader(variantCfg);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   652
			reader.read(cbuf);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   653
			reader.close();
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   654
			String[] lines = new String(cbuf).split("\r\n|\r|\n");
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   655
			for (int i = 0; i < lines.length; i++) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   656
				// skip comments and blank lines
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   657
				String line = SymbianSDK.removeComments(lines[i]);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   658
				if (line.matches("\\s*#.*") || line.trim().length() == 0) 
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   659
					continue;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   660
				
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   661
				// parse the variant line, which is an EPOCROOT-relative
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   662
				// path to a bldvariant.hrh file
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   663
				Matcher matcher = VARIANT_HRH_LINE_PATTERN.matcher(line);
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   664
				if (matcher.matches()) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   665
					continue; // Skip this it's the file
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   666
				} else {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   667
					// all other patterns are assumed to be macro
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   668
					variantCFGMacros.add(line.trim());
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   669
				}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   670
			}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   671
		} catch (IOException e) {
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   672
		}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   673
		
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   674
		return variantCFGMacros;
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   675
	}
1d73a4591cf8 refactoring usage for getting variant.hrh and compiler preinclude macros. Now should use ISymbianContext both for preprocessed results and getting the IPath to the file.
timkelly
parents: 1779
diff changeset
   676
	
1755
e65ffeef96f7 refactor abld arguments tab settings under ISBSV1BuildContext API. WIP to push builder specific settings under their respective ISymbianBuildContext implementation.
timkelly
parents: 1739
diff changeset
   677
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents:
diff changeset
   678
}