core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java
author timkelly
Fri, 23 Apr 2010 11:41:51 -0500
changeset 1270 ad41cb5ef65f
parent 1239 668d819e9f59
child 1288 7f5308d16da0
permissions -rw-r--r--
fix bug 11077 and bug 11033
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;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    16
import java.io.FileFilter;
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
    17
import java.text.MessageFormat;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    18
import java.util.ArrayList;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    19
import java.util.Collections;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    20
import java.util.Comparator;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    21
import java.util.HashMap;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    22
import java.util.Iterator;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    23
import java.util.List;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    24
import java.util.Map;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    25
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    26
import javax.xml.parsers.DocumentBuilder;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    27
import javax.xml.parsers.DocumentBuilderFactory;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    28
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    29
import org.eclipse.cdt.utils.spawner.EnvironmentReader;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    30
import org.eclipse.core.filesystem.URIUtil;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    31
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
    32
import org.eclipse.core.runtime.Path;
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
    33
import org.eclipse.core.runtime.Preferences;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    34
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    35
import org.eclipse.core.runtime.preferences.InstanceScope;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    36
import org.osgi.framework.Version;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    37
import org.osgi.service.prefs.BackingStoreException;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    38
import org.w3c.dom.Element;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    39
import org.w3c.dom.Node;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    40
import org.w3c.dom.NodeList;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
import org.xml.sax.InputSource;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
import org.xml.sax.helpers.DefaultHandler;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    43
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    44
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
    45
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
    46
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
176
11eeeeeb1733 clean up imports
timkelly
parents: 0
diff changeset
    47
import com.nokia.cpp.internal.api.utils.core.FileUtils;
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
    48
import com.nokia.cpp.internal.api.utils.core.HostOS;
176
11eeeeeb1733 clean up imports
timkelly
parents: 0
diff changeset
    49
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
    50
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    51
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
 * Utility class for SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
public class SBSv2Utils {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
	private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
    58
	private static final String SBSV2_FILTERED_CONFIGS_STORE_INITED = "sbsv2FilteredConfigsInited"; //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    59
	private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    60
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    61
	/**
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    62
	 * 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
    63
	 */
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    64
	private static Map<String, String> unfilteredSBSv2ConfigNames;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    65
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    66
	/** 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
    67
	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
    68
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
    69
	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
    70
	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
    71
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    72
	/**
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    73
     * 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
    74
     * May or may not actually exist.
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    75
     * @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
    76
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    77
    public static IPath getSBSBinDirectory() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    78
    	String pathValue = EnvironmentReader.getEnvVar("PATH"); //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    79
    	IPath sbs = HostOS.findProgramOnPath(sbsScriptName, pathValue);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    80
    	if (sbs != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    81
    		sbs = sbs.removeLastSegments(1);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    82
    	}
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    83
    	return sbs;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    85
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    86
    /**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    87
     * Get the build configurations supported by SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
     * @param refreshList whether or not to parse the configuration xml files again
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    89
     * @return A map of raptor aliases (key) to base build platform. Never null;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
     */
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    91
    public static Map<String, String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    92
    	
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    93
    	if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    94
    		unfilteredSBSv2ConfigNames = new HashMap<String, String>();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    95
    		
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    96
        	// parse the xml files in <sbs-install>/lib/config/ to get SBSv2 configs
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
    		try {
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
    			IPath configPath = getSBSBinDirectory();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
    			if (configPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   101
    				configPath = configPath.removeLastSegments(1).append("lib/config"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
    				File configDir = configPath.toFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
    				if (configDir.exists() && configDir.isDirectory()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   104
    					File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
    						public boolean accept(File arg0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
    							if (arg0.isDirectory()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
    								return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
    							}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
    							return arg0.getName().toLowerCase().endsWith("xml"); //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   111
    						}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   112
    						
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   113
    					}, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   114
    					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   115
    					for (File file : configFiles) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
    						getConfigsForFile(file);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
    					}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
    				}
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
    		} catch (Exception e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
        		e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
        		Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   125
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   126
    	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   127
    	return unfilteredSBSv2ConfigNames;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   128
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   129
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   130
    /**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   131
     * 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
   132
     * @param sdks list of SDK's to check
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   133
     * @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
   134
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
    public static List<ISymbianSDK> getSupportedSDKs(List<ISymbianSDK> sdks) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   136
    	List<ISymbianSDK> supportedSDKs = new ArrayList<ISymbianSDK>();
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   137
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   138
    	// 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
   139
    	if (!enableSBSv1Support()) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   140
    		supportedSDKs.addAll(sdks);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   141
    	} else {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   142
	    	//TODO need a better way to do this from Symbian.
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   143
	    	// For now, just filter out anything older than 9.4
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   144
	    	for (ISymbianSDK sdk : sdks) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   145
	    		Version osVersion = sdk.getOSVersion();
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   146
	    		if (osVersion.getMajor() > 8 ||
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   147
	    				(osVersion.getMajor() == 8 && osVersion.getMinor() > 3)) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   148
	    			supportedSDKs.add(sdk);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   149
	    		}
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   150
	    	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   151
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   152
    	return supportedSDKs;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   153
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   154
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   155
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   156
	 * Returns the list of SBSv2 build configuration names that should
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   157
	 * be filtered out of any UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   158
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   159
	public static String[] getSBSv2ConfigurationsToFilter() {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   160
		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
   161
		if (prefs != null) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   162
			String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE, "");
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   163
			return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   164
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   165
		return new String[0];
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   166
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   167
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   168
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   169
	 * Set the list of SBSv2 build configurations that should be filtered
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   170
	 * out of any UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   171
	 * @param configs configs to be filtered
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   172
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   173
	public static void setSBSv2ConfigurationsToFilter(String[] configs) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   174
		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
   175
		if (prefs != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   176
			String store = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   177
			for (String config : configs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   178
				store = store + SBSV2_FILTERED_CONFIGS_DELIMETER + config;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   179
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   180
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   181
			// remove the leading delimeter
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   182
			if (store.length() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   183
				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
   184
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 176
diff changeset
   185
			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
   186
				// lenght of zero means there are not configs to filter (or show them all)
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   187
				prefs.put(SBSV2_FILTERED_CONFIGS_STORE, store);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   188
				try {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   189
					prefs.flush();
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   190
				} catch (BackingStoreException e) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   191
					Logging.log(SDKCorePlugin.getDefault(),
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   192
							Logging.newStatus(SDKCorePlugin.getDefault(), e));
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   193
				}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   194
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   195
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   196
	}
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
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   199
	 * Gets the list of SBSv2 build contexts for the given SDK
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   200
	 * @param sdk the SDK to get the build contexts for
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   201
	 * @return the list of SBSv2 build contexts.  the list may be empty
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
	public static List<ISymbianBuildContext> getFilteredSBSv2BuildContexts(ISymbianSDK sdk) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   204
		List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   205
		
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   206
		initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   207
		
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   208
		Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator();
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   209
		
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   210
		while (it.hasNext()){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   211
			
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   212
			Map.Entry buildConfigPair = (Map.Entry)it.next();
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   213
			String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias 
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   214
			String basePlat = (String)buildConfigPair.getValue();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   215
			boolean addConfig = true;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   216
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   217
			for (String filteredConfig : getSBSv2ConfigurationsToFilter()) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   218
				if (filteredConfig.compareTo(alias) == 0) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   219
					addConfig = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   220
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   221
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   222
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   223
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   224
			if (addConfig) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   225
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   226
				// only support configs that fall into something we can make a build context
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   227
				// out of.  They must have a platform and a target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   228
				String targetString = null;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   229
				String[] configTokens = alias.split("_"); // $//$NON-NLS-N$
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   230
				// We presume that aliases have the second token as the "target". 
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   231
		    	if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ //$NON-NLS-2$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   232
		    		targetString = ISymbianBuildContext.DEBUG_TARGET;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   233
		    	} else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ //$NON-NLS-2$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   234
		    		targetString = ISymbianBuildContext.RELEASE_TARGET;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   235
		    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   236
		    	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   237
		    	if (targetString != null) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   238
		    		SymbianBuildContext context = null;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   239
		    		context = new SymbianBuildContext(sdk, basePlat, targetString, alias);
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   240
		    		if (context != null) 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   241
		    			contexts.add(context);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   242
		    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   243
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   244
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   245
		
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
   246
		return sortContexts(contexts);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   247
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   248
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   249
	/**
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   250
	 * There are many build aliases presented by default from Raptor
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   251
	 * Filter out those that are less commonly used on new workspace creation.
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   252
	 */
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   253
	public static void initDefaultConfigsToFilter() {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   254
		IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId());
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   255
		String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED, "");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   256
		if (inited == null || inited.length() == 0){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   257
			Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   258
			List<String> defaultConfigsToFilter = new ArrayList<String>();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   259
			while (it.hasNext()){ 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   260
				Map.Entry buildConfigPair = (Map.Entry)it.next();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   261
				String buildAlias = (String)buildConfigPair.getKey();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   262
				if (buildAlias.toLowerCase().startsWith("armv6") ||
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   263
					buildAlias.toLowerCase().startsWith("armv7") ||
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   264
					buildAlias.toLowerCase().startsWith("armv9")){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   265
					defaultConfigsToFilter.add(buildAlias);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   266
				}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   267
			}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   268
			prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   269
			setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()]));
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   270
			
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   271
		}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   272
	}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   273
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   274
	/**
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
   275
	 * 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
   276
	 * @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
   277
	 */
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
   278
	public static boolean enableSBSv1Support() {
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
   279
		if (!enableSBSv2Support())
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
   280
			return 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
   281
		
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
   282
		// TODO LINUX: more accurate check
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
   283
		if (HostOS.IS_WIN32)
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
   284
			return 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
   285
		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
   286
	}
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
   287
	
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
   288
	/**
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   289
	 * Whether or not to display SBSv2 builder UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   290
	 * @return true if SBSv2 is installed, false otherwise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   291
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   292
	public static boolean enableSBSv2Support() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   293
		IPath sbsBinPath = getSBSBinDirectory();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   294
		if (sbsBinPath != null && sbsBinPath.toFile().exists()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   295
			return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   296
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   297
		return false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   298
	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   299
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   300
	private static void getConfigsForFile(File file) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   301
    	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   302
    	try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   303
    		Element root = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   304
    		DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   305
    		parser.setErrorHandler(new DefaultHandler());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   306
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   307
    		InputSource source = new InputSource(URIUtil.toURI(file.getAbsolutePath()).getPath());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   308
    		root = parser.parse(source).getDocumentElement();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   309
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   310
    		NodeList children = root.getChildNodes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   311
    		for (int i=0; i< children.getLength(); i++) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   312
    			getConfigsForNode(children.item(i), root);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   313
    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   314
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   315
    	} catch (Exception e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   316
    		e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   317
    		Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e));
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   318
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   319
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   320
    
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   321
    private static void getConfigsForNode(Node node, Node parentNode) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   322
		if (node.getNodeName().equals("config")) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   323
			Node abstractNode = node.getAttributes().getNamedItem("abstract");  //$NON-NLS-1$
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   324
			Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   325
			if (abstractNode == null || abstractNode.getNodeValue().equals("false")) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   326
				if (namedNode != null) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   327
					
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   328
					// Get the parent base build platform
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   329
					String baseBuildPlatform = null;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   330
					if (parentNode != null){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   331
						baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue();
1183
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   332
						if (baseBuildPlatform.split("_").length > 1){
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   333
							baseBuildPlatform = baseBuildPlatform.split("_")[0];
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   334
						}
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   335
					}
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   336
					
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   337
					// only support configs that fall into something we can make a build context
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   338
					// out of.  They must have a platform and a target.
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   339
					String configName = namedNode.getNodeValue();
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   340
					String[] configTokens = configName.split("_");
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   341
			    	if (configTokens.length >= 2) { //$NON-NLS-1$
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   342
			    		String target = configTokens[1];
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   343
			    		if (target.endsWith("deb") || target.endsWith("rel")){ //$NON-NLS-1$
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   344
			    			if (baseBuildPlatform == null){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   345
			    				baseBuildPlatform = "unknown";
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   346
			    			}
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   347
			    			unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   348
			    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   349
			    	}
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   350
			    }
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   351
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   352
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   353
			NodeList children = node.getChildNodes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   354
			for (int i=0; i< children.getLength(); i++) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   355
				getConfigsForNode(children.item(i), node);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   356
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   357
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   358
    }
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
   359
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
   360
	/**
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
   361
	 * (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
   362
	 * @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
   363
	 */
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
   364
	public static String scanSBSv2() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   365
		if (sbsPath != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   366
			return null;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   367
		}
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
   368
		// do some basic checks
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   369
		IPath expectedPath = getSBSBinDirectory();
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   370
		if (expectedPath != null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   371
			expectedPath = expectedPath.append(sbsScriptName);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   372
			if (expectedPath.toFile().exists()) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   373
				sbsPath = expectedPath;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   374
			}
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   375
		} 
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
   376
		
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   377
		if (sbsPath == null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   378
			return MessageFormat.format(Messages
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   379
					.getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   380
					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
   381
		}
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
   382
		
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
   383
		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
   384
	}
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
   385
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
   386
    /**
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
   387
     * 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
   388
     */
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
   389
	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
   390
		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
   391
			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
   392
			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
   393
		}
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
   394
		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
   395
	}
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
   396
	
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   397
	private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> contexts){ 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   398
    	
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   399
		// 2 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel)
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
   400
		
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
   401
		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
   402
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
   403
			// First sort the target name (Debug / Release) and push Emulation to the top
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
   404
			public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
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
   405
				String sbsAlias1 = o1.getSBSv2Alias();
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
   406
				String sbsAlias2 = o2.getSBSv2Alias();
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
   407
				
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
   408
				if (o1.getPlatformString().equals(o2.getPlatformString())) {
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   409
					if (o1.getSBSv2Alias().split("_").length != o2.getSBSv2Alias().split("_").length)
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
   410
						return o1.getTargetString().compareTo(o2.getTargetString());
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   411
					else if (sbsAlias1.split("_").length >= 3){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   412
						String temp1[] = sbsAlias1.split("_");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   413
						String temp2[] = sbsAlias2.split("_");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   414
						String suffix1 = "";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   415
						String suffix2 = "";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   416
						for (int i = 2; i < temp1.length; i++){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   417
							suffix1 += temp1[i] + "_";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   418
						}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   419
						
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   420
						for (int i = 2; i < temp2.length; i++){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   421
							suffix2 += temp2[i] + "_";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   422
						}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   423
						
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   424
						return suffix1.compareTo(suffix2);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   425
					} 
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
   426
				} else {
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
   427
					if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) {
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
   428
						return -1;
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
   429
					}else if (sbsAlias2.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) {
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
   430
						return 1;
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
   431
					} 
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
   432
				}
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
   433
				return sbsAlias1.compareTo(sbsAlias2);
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
   434
			}
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
   435
			
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
   436
		});
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
   437
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
   438
		// Sort long alias names
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
   439
		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
   440
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
   441
			public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
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
   442
				String sbsAlias1 = o1.getSBSv2Alias();
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
   443
				String sbsAlias2 = o2.getSBSv2Alias();
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
   444
				
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   445
				if (o1.getSBSv2Alias().split("_").length == 3 && o2.getSBSv2Alias().split("_").length == 3 &&
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   446
						o1.getPlatformString().equals(o2.getPlatformString()))
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   447
					return o1.getTargetString().compareTo(o2.getTargetString());
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   448
				else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){
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
   449
					String temp1[] = sbsAlias1.split("_");
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
   450
					String temp2[] = sbsAlias2.split("_");
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
   451
					String suffix1 = "";
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
   452
					String suffix2 = "";
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
   453
					for (int i = 2; i < temp1.length; i++){
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
   454
						suffix1 += temp1[i] + "_";
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
   455
					}
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
   456
					
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
   457
					for (int i = 2; i < temp2.length; i++){
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
   458
						suffix2 += temp2[i] + "_";
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
   459
					}
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
   460
					
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
   461
					return suffix1.compareTo(suffix2);
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
   462
				} 
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
   463
				
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
   464
				return 0;	
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
   465
			}
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
   466
		});
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
   467
		
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   468
    	return contexts; 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   469
    }
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
   470
	
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
   471
	/**
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
   472
	 * 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
   473
	 * 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
   474
	 * 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
   475
	 * 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
   476
	 * @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
   477
	 * @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
   478
	 */
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
   479
	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
   480
		
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
   481
		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
   482
				"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
   483
		
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
   484
		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
   485
		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
   486
			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
   487
			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
   488
				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
   489
					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
   490
						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
   491
				}
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
   492
				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
   493
			}
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
   494
		}
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
   495
		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
   496
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   497
}