core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java
author timkelly
Thu, 05 Aug 2010 15:25:18 -0500
branchC3_BUILDER_WORK
changeset 1779 73303c546665
parent 1522 58667ad9656d
child 1820 5c955fcfdc3d
permissions -rw-r--r--
clean up some TODO comments
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     1
/*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     2
* Copyright (c) 2009 Nokia Corporation and/or its subsidiary(-ies). 
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     3
* All rights reserved.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     4
* This component and the accompanying materials are made available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     5
* under the terms of the License "Eclipse Public License v1.0"
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     6
* which accompanies this distribution, and is available
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     7
* at the URL "http://www.eclipse.org/legal/epl-v10.html".
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     8
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
     9
* Initial Contributors:
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    10
* Nokia Corporation - initial contribution.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    11
*
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    12
*/
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    13
package com.nokia.carbide.cpp.internal.api.sdk;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    14
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    15
import java.io.File;
693
2d475d296af4 Look for sbs or sbs.bat under SBS_HOME/bin first, instead of only looking at the PATH.
Ed Swartz <ed.swartz@nokia.com>
parents: 629
diff changeset
    16
import java.text.MessageFormat;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    17
import java.util.ArrayList;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    18
import java.util.Collections;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    19
import java.util.Comparator;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    20
import java.util.List;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    21
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    22
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    23
import org.eclipse.core.runtime.IPath;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    24
import org.eclipse.core.runtime.Path;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    25
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    26
import org.eclipse.core.runtime.preferences.InstanceScope;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import org.osgi.framework.Version;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    28
import org.osgi.service.prefs.BackingStoreException;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
    30
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    31
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    32
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    33
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    34
import com.nokia.cpp.internal.api.utils.core.HostOS;
176
11eeeeeb1733 clean up imports
timkelly
parents: 0
diff changeset
    35
import com.nokia.cpp.internal.api.utils.core.Logging;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    37
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    38
 * Utility class for SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    39
 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
public class SBSv2Utils {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
    43
	//private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
    44
	private static final String SBSV2_FILTERED_CONFIGS_STORE_V2 = "sbsv2FilteredConfigs_V2"; //$NON-NLS-1$
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
    45
	//private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
    46
	private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED_V2 = "sbsv2FilteredConfigsInited_V2"; //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    47
	private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
    48
	private static final long VALID_ABLD_SIZE = 1024;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    49
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    50
	/**
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    51
	 * Map of usable Raptor alias for -c parameter and base platform: <alise, base plat>
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    52
	 */
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
    53
//	private static Map<String, String> unfilteredSBSv2ConfigNames;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    55
	/** Path, to and including the SBS script */
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    56
	protected static IPath sbsPath;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    57
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    58
	private static boolean scannedSbsState = false;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
    59
	private static final String sbsScriptName = HostOS.IS_WIN32 ? "sbs.bat" : "sbs"; 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    61
	/**
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    62
     * Get the path to the SBSv2 bin directory, not including the sbs executable.  
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    63
     * May or may not actually exist.
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    64
     * @return absolute path to the bin directory, or null if sbs is not found
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    66
    public static IPath getSBSBinDirectory() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    67
    	String pathValue = EnvironmentReader.getEnvVar("PATH"); //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    68
    	IPath sbs = HostOS.findProgramOnPath(sbsScriptName, pathValue);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    69
    	if (sbs != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    70
    		sbs = sbs.removeLastSegments(1);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    71
    	}
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    72
    	return sbs;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    73
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    75
    /**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    76
     * Given a list of SDKs, returns the list of the SDK's supported by SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
     * @param sdks list of SDK's to check
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    78
     * @return list of SBSv2 supported SDK's, may be empty
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    80
    public static List<ISymbianSDK> getSupportedSDKs(List<ISymbianSDK> sdks) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    81
    	List<ISymbianSDK> supportedSDKs = new ArrayList<ISymbianSDK>();
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    82
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    83
    	// If there is no SBSv1 builder, then assume all SDKs are SBSv2 capable
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    84
    	if (!enableSBSv1Support()) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    85
    		supportedSDKs.addAll(sdks);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    86
    	} else {
1779
73303c546665 clean up some TODO comments
timkelly
parents: 1522
diff changeset
    87
	    	// Filter out anything older than 9.4
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    88
	    	for (ISymbianSDK sdk : sdks) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    89
	    		Version osVersion = sdk.getOSVersion();
1459
51ff67a50dee Create an SDK with a bad epocroot when a configuration is being loaded but where the SDK is not in the global list.
timkelly
parents: 1444
diff changeset
    90
	    		if (osVersion.getMajor() > 8 || osVersion.getMajor() == 0 ||
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
    91
	    				(osVersion.getMajor() == 9 && osVersion.getMinor() > 3)) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    92
	    			supportedSDKs.add(sdk);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    93
	    		}
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    94
	    	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    96
    	return supportedSDKs;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    98
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    99
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
	 * Returns the list of SBSv2 build configuration names that should
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   101
	 * INCLUDED in any UI. Only configs to be displayed are saved
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
	 */
1478
69015f2143b2 Fix some problems displaying broken configs and broken SDKs in the SDK/Config Tree for SBSv2
timkelly
parents: 1476
diff changeset
   103
	public static List<String> getSBSv2FilteredConfigPreferences() {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   104
		List<String> buildAliasList = new ArrayList<String>();
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   105
		IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
		if (prefs != null) {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   107
			String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, "");
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1478
diff changeset
   108
			if (configs.length() == 0){
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1478
diff changeset
   109
				initDefaultConfigsToFilter();
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1478
diff changeset
   110
				configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, "");
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1478
diff changeset
   111
			}
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   112
			String aliasesToInclude[] = configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   113
			for (String alias : aliasesToInclude){
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   114
				buildAliasList.add(alias);
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   115
			}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
		}
1522
58667ad9656d Clean up APIs/Tests around SBSv2 query mechanism (got rid of most all the original test API now that it's been moved into BuildContextSBSv2.
timkelly
parents: 1478
diff changeset
   117
		
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   118
		return buildAliasList;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   119
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   120
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   121
	/**
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   122
	 * Set the list of SBSv2 build configurations that should be included in a build config list
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   123
	 * All others will be filtered out
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
	 * @param configs configs to be filtered
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   125
	 */
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   126
	public static void setSBSv2FilteredConfigs(String[] configs) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   127
		IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   128
		if (prefs != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   129
			String store = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   130
			for (String config : configs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   131
				store = store + SBSV2_FILTERED_CONFIGS_DELIMETER + config;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   132
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   133
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   134
			// remove the leading delimeter
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
			if (store.length() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
				store = store.substring(1);
266
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 176
diff changeset
   137
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 176
diff changeset
   138
			if (store.length() >= 0){
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 176
diff changeset
   139
				// lenght of zero means there are not configs to filter (or show them all)
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   140
				prefs.put(SBSV2_FILTERED_CONFIGS_STORE_V2, store);
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   141
				try {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   142
					prefs.flush();
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   143
				} catch (BackingStoreException e) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   144
					Logging.log(SDKCorePlugin.getDefault(),
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   145
							Logging.newStatus(SDKCorePlugin.getDefault(), e));
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   146
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   147
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   148
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   149
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   150
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   151
	/**
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   152
	 * There are many build aliases presented by default from Raptor
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   153
	 * Filter out those that are less commonly used on new workspace creation.
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   154
	 */
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   155
	public static void initDefaultConfigsToFilter() {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   156
		IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId());
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   157
		String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, "");
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   158
		if (inited == null || inited.length() == 0){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   159
			List<String> defaultConfigsToFilter = new ArrayList<String>();
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   160
			
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   161
			defaultConfigsToFilter.add("armv5_udeb");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   162
			defaultConfigsToFilter.add("armv5_urel");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   163
			defaultConfigsToFilter.add("armv5_udeb_gcce");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   164
			defaultConfigsToFilter.add("armv5_urel_gcce");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   165
			defaultConfigsToFilter.add("winscw_urel");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   166
			defaultConfigsToFilter.add("winscw_udeb");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   167
			
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   168
			prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED_V2, "true");
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   169
			setSBSv2FilteredConfigs(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()]));
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   170
			
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   171
		}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   172
	}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   173
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   174
	/**
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   175
	 * Whether or not to display SBSv1 builder UI
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   176
	 * @return true if SBSv1 is available, false otherwise
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   177
	 */
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   178
	
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   179
	@SuppressWarnings("unused")
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   180
	public static boolean enableSBSv1Support() {
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   181
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   182
		if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER)
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   183
			return false;
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   184
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   185
		else if (!enableSBSv2Support())
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   186
			return true;
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   187
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   188
		else if (isSBSv1Supported())
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   189
			return true;
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   190
		
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   191
		return false;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   192
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   193
	
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   194
	/**
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   195
	 * Whether or not to display SBSv2 builder UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   196
	 * @return true if SBSv2 is installed, false otherwise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   197
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   198
	public static boolean enableSBSv2Support() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   199
		IPath sbsBinPath = getSBSBinDirectory();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   200
		if (sbsBinPath != null && sbsBinPath.toFile().exists()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   201
			return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   202
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   203
		return false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   204
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   205
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   206
	/**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   207
	 * (Re-)scan the SBSv2 / Raptor configuration
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   208
	 * @return message if error, else null
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   209
	 */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   210
	public static String scanSBSv2() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   211
		if (sbsPath != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   212
			return null;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   213
		}
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   214
		// do some basic checks
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   215
		IPath expectedPath = getSBSBinDirectory();
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   216
		if (expectedPath != null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   217
			expectedPath = expectedPath.append(sbsScriptName);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   218
			if (expectedPath.toFile().exists()) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   219
				sbsPath = expectedPath;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   220
			}
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   221
		} 
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   222
		
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   223
		if (sbsPath == null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   224
			return MessageFormat.format(Messages
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   225
					.getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   226
					sbsScriptName);
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   227
		}
693
2d475d296af4 Look for sbs or sbs.bat under SBS_HOME/bin first, instead of only looking at the PATH.
Ed Swartz <ed.swartz@nokia.com>
parents: 629
diff changeset
   228
		
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   229
		return null;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   230
	}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   231
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   232
    /**
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   233
     * Get the path to SBSv2 (sbs.bat or sbs)
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   234
     */
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   235
	public static IPath getSBSPath() {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   236
		if (!scannedSbsState) {
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   237
			scanSBSv2();
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   238
			scannedSbsState = true;
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   239
		}
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   240
		return sbsPath != null ? sbsPath : new Path(sbsScriptName);  // dummy
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   241
	}
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   242
	
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   243
	private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> contexts){ 
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   244
		Collections.sort(contexts, new Comparator<ISymbianBuildContext>() {
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   245
			public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   246
				return o2.getDisplayString().compareTo(o1.getDisplayString());
1138
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   247
			}
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   248
		});
352c0236f181 bug 10674. Sort sbsv2 configuration names with same platform_target alias prefix. ensure gcce error parser is used for sbsv2 GCCE4 build configs, add a project specific (sbsv2 only) edit box that allows user to append whatever they want to the -c parameter (the build alias). Also, fixed SDK support for TB kits now that TB92SF appears as a prefix rather than a suffix in the buildinfo.txt file.
timkelly
parents: 1134
diff changeset
   249
		
1476
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   250
		return contexts; 
09e768e53db5 first pass on implementing Raptor query mechanism to construct SBSv2 contexts. Will likely introduce some instability for SBSv2, but should have no impact on SBSv1: WIP.
timkelly
parents: 1459
diff changeset
   251
	}
1221
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   252
	
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   253
	/**
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   254
	 * If a variant is defined and it changes the output directory, return the directory name.
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   255
	 * For example, armv5_udeb.phone1 would return '.phone1'. If not variant that changes the release tree, then null
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   256
	 * NOTE: This method deals with variant text applied to the end of a build alias, specifically testing for
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   257
	 * variant text defined in the SBSv2 Build Configuration tab.
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   258
	 * @return null if not a variant or the value to append to the platform release tree directory
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   259
	 * @see com.nokia.carbide.cdt.internal.builder.ui#SBSv2BuildConfigTab
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   260
	 */
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   261
	public static String getVariantOutputDirModifier(String variantText) {
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   262
		
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   263
		String[] ignoredVariants =  { "generic", "tracecompiler", "trace", "test", "savespace", 
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   264
				"bfc", "smp", "rvct2_2", "rvct4_0", "rvct3_1", "gcce4_3_2", "remove_freeze" };
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   265
		
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   266
		String newOutputDir = null;
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   267
		if (variantText != null && variantText.length() > 1){
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   268
			String[] variantTok = variantText.split("\\.");
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   269
			if (variantTok.length > 1){
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   270
				for (String ignore : ignoredVariants){
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   271
					if (variantTok[1].toLowerCase().equals(ignore))
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   272
						return null;
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   273
				}
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   274
				newOutputDir = "." + variantTok[1];
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   275
			}
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   276
		}
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   277
		return newOutputDir;
f41fa762c65f Fix bug 11068 (part 2). Add dynamic text to dispaly -c command and release tree when variant is applied.
timkelly
parents: 1183
diff changeset
   278
	}
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   279
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   280
	private static boolean isSBSv1Supported() {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   281
		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   282
		for (ISymbianSDK sdk : sdkMgr.getSDKList()) {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   283
			File abld = new File(sdk.getEPOCROOT(), "epoc32/tools/abld.pl"); //$NON-NLS-1$
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   284
			if (abld.exists()) {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   285
				long size = abld.length();
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   286
				if (size >= VALID_ABLD_SIZE)
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   287
					return true;
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   288
			}
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   289
		}
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   290
		return false;
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   291
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   292
}