core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/api/sdk/SBSv2Utils.java
author timkelly
Fri, 11 Jun 2010 10:31:54 -0500
branchC3_BUILDER_WORK
changeset 1459 51ff67a50dee
parent 1444 4f7d895e3e16
child 1476 09e768e53db5
permissions -rw-r--r--
Create an SDK with a bad epocroot when a configuration is being loaded but where the SDK is not in the global list. We add it so it can be displayed along with an error message that the SDK has a bad EPOCROOT.
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;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    33
import org.eclipse.core.runtime.preferences.IEclipsePreferences;
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    34
import org.eclipse.core.runtime.preferences.InstanceScope;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    35
import org.osgi.framework.Version;
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
    36
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
    37
import org.w3c.dom.Element;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    38
import org.w3c.dom.Node;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    39
import org.w3c.dom.NodeList;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    40
import org.xml.sax.InputSource;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    41
import org.xml.sax.helpers.DefaultHandler;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    42
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
    43
import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext;
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
    44
import com.nokia.carbide.cpp.sdk.core.ISDKManager;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    45
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
    46
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
    47
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
176
11eeeeeb1733 clean up imports
timkelly
parents: 0
diff changeset
    48
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
    49
import com.nokia.cpp.internal.api.utils.core.HostOS;
176
11eeeeeb1733 clean up imports
timkelly
parents: 0
diff changeset
    50
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
    51
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    52
/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    53
 * Utility class for SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    54
 * @since 2.0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    55
 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    56
public class SBSv2Utils {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    57
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    58
	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
    59
	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
    60
	private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
    61
	private static final long VALID_ABLD_SIZE = 1024;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    62
1134
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
	 * 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
    65
	 */
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    66
	private static Map<String, String> unfilteredSBSv2ConfigNames;
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    67
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    68
	/** 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
    69
	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
    70
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
    71
	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
    72
	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
    73
	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    74
	/**
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    75
     * 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
    76
     * May or may not actually exist.
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    77
     * @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
    78
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    79
    public static IPath getSBSBinDirectory() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    80
    	String pathValue = EnvironmentReader.getEnvVar("PATH"); //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    81
    	IPath sbs = HostOS.findProgramOnPath(sbsScriptName, pathValue);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    82
    	if (sbs != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    83
    		sbs = sbs.removeLastSegments(1);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    84
    	}
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    85
    	return sbs;
0
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    88
    /**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    89
     * Get the build configurations supported by SBSv2
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    90
     * @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
    91
     * @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
    92
     */
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
    93
    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
    94
    	
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    95
    	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
    96
    		unfilteredSBSv2ConfigNames = new HashMap<String, String>();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
    97
    		
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
    98
        	// 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
    99
    		try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   100
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   101
    			IPath configPath = getSBSBinDirectory();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   102
    			if (configPath != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   103
    				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
   104
    				File configDir = configPath.toFile();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   105
    				if (configDir.exists() && configDir.isDirectory()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   106
    					File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   107
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   108
    						public boolean accept(File arg0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   109
    							if (arg0.isDirectory()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   110
    								return true;
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
    							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
   113
    						}
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
    					}, false);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   116
    					
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   117
    					for (File file : configFiles) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   118
    						getConfigsForFile(file);
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
    			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   122
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   123
    		} catch (Exception e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   124
        		e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   125
        		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
   126
    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   127
    	}
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
    	return unfilteredSBSv2ConfigNames;
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   132
    /**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   133
     * 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
   134
     * @param sdks list of SDK's to check
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   135
     * @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
   136
     */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   137
    public static List<ISymbianSDK> getSupportedSDKs(List<ISymbianSDK> sdks) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   138
    	List<ISymbianSDK> supportedSDKs = new ArrayList<ISymbianSDK>();
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   139
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   140
    	// 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
   141
    	if (!enableSBSv1Support()) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   142
    		supportedSDKs.addAll(sdks);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   143
    	} else {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   144
	    	//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
   145
	    	// 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
   146
	    	for (ISymbianSDK sdk : sdks) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   147
	    		Version osVersion = sdk.getOSVersion();
1459
51ff67a50dee Create an SDK with a bad epocroot when a configuration is being loaded but where the SDK is not in the global list.
timkelly
parents: 1444
diff changeset
   148
	    		if (osVersion.getMajor() > 8 || osVersion.getMajor() == 0 ||
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
   149
	    				(osVersion.getMajor() == 9 && osVersion.getMinor() > 3)) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   150
	    			supportedSDKs.add(sdk);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   151
	    		}
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   152
	    	}
0
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
    	return supportedSDKs;
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
    
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   157
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   158
	 * 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
   159
	 * be filtered out of any UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   160
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   161
	public static String[] getSBSv2ConfigurationsToFilter() {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   162
		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
   163
		if (prefs != null) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   164
			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
   165
			return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER);
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
		return new String[0];
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   170
	/**
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   171
	 * 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
   172
	 * out of any UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   173
	 * @param configs configs to be filtered
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   174
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   175
	public static void setSBSv2ConfigurationsToFilter(String[] configs) {
629
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   176
		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
   177
		if (prefs != null) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   178
			String store = ""; //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   179
			for (String config : configs) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   180
				store = store + SBSV2_FILTERED_CONFIGS_DELIMETER + config;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   181
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   182
			
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   183
			// remove the leading delimeter
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   184
			if (store.length() > 0) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   185
				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
   186
			}
c7ecdd0b9f52 Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents: 176
diff changeset
   187
			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
   188
				// 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
   189
				prefs.put(SBSV2_FILTERED_CONFIGS_STORE, store);
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   190
				try {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   191
					prefs.flush();
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   192
				} catch (BackingStoreException e) {
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   193
					Logging.log(SDKCorePlugin.getDefault(),
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   194
							Logging.newStatus(SDKCorePlugin.getDefault(), e));
c24c517fe8c2 Fix SBSv2 SDK filtering.
Ed Swartz <ed.swartz@nokia.com>
parents: 608
diff changeset
   195
				}
0
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
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   200
	/**
1444
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   201
	 * Gets the list of all SBSv2 build contexts for the given SDK
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   202
	 * @param sdk the SDK to get the build contexts for
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   203
	 * @return the list of SBSv2 build contexts.  the list may be empty
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   204
	 */
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   205
	public static List<ISymbianBuildContext> getAllSBSv2BuildContexts(ISymbianSDK sdk) {
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   206
		List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   207
		Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator();
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   208
		while (it.hasNext()){
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   209
			
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   210
			Map.Entry buildConfigPair = (Map.Entry)it.next();
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   211
			String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias 
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   212
			String basePlat = (String)buildConfigPair.getValue();
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   213
			// only support configs that fall into something we can make a build context
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   214
			// out of.  They must have a platform and a target.
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   215
			String targetString = null;
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   216
			String[] configTokens = alias.split("_"); // $//$NON-NLS-N$
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   217
			// We presume that aliases have the second token as the "target". 
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   218
	    	if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ //$NON-NLS-2$
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   219
	    		targetString = ISymbianBuildContext.DEBUG_TARGET;
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   220
	    	} else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ //$NON-NLS-2$
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   221
	    		targetString = ISymbianBuildContext.RELEASE_TARGET;
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   222
	    	}
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   223
	    	
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   224
	    	if (targetString != null) {
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   225
	    		BuildContextSBSv2 context = null;
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   226
	    		// TODO: Display String not properly set
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   227
	    		String configID = ISBSv2BuildContext.BUILDER_ID + "." + alias + "." + sdk.getUniqueId();
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   228
	    		String displayString = alias + " [" + sdk.getUniqueId() + "]";
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   229
	    		context = new BuildContextSBSv2(sdk, basePlat, targetString, alias, displayString, configID);
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   230
	    		if (context != null) 
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   231
	    			contexts.add(context);
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   232
	    	}
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   233
		}
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   234
		
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   235
		return sortContexts(contexts);
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   236
	}
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   237
4f7d895e3e16 Fixed errors in unit tests due to ISymbianSDK refactoring, plus other updates to SDK core and UI plugins.
stechong
parents: 1433
diff changeset
   238
	/**
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   239
	 * 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
   240
	 * @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
   241
	 * @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
   242
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   243
	public static List<ISymbianBuildContext> getFilteredSBSv2BuildContexts(ISymbianSDK sdk) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   244
		List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   245
		
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   246
		initDefaultConfigsToFilter();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   247
		
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   248
		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
   249
		
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   250
		while (it.hasNext()){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   251
			
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   252
			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
   253
			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
   254
			String basePlat = (String)buildConfigPair.getValue();
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   255
			boolean addConfig = true;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   256
			
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   257
			for (String filteredConfig : getSBSv2ConfigurationsToFilter()) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   258
				if (filteredConfig.compareTo(alias) == 0) {
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   259
					addConfig = false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   260
					break;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   261
				}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   262
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   263
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   264
			if (addConfig) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   265
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   266
				// 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
   267
				// 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
   268
				String targetString = null;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   269
				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
   270
				// 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
   271
		    	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
   272
		    		targetString = ISymbianBuildContext.DEBUG_TARGET;
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   273
		    	} 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
   274
		    		targetString = ISymbianBuildContext.RELEASE_TARGET;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   275
		    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   276
		    	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   277
		    	if (targetString != null) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   278
		    		BuildContextSBSv2 context = null;
1433
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
   279
		    		// TODO: Display String not properly set
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
   280
		    		String configID = ISBSv2BuildContext.BUILDER_ID + "." + alias + "." + sdk.getUniqueId();
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
   281
		    		String displayString = alias + " [" + sdk.getUniqueId() + "]";
1a693b01d107 1) Reworking cconfiguration 'id' to be separate from the config display name
timkelly
parents: 1418
diff changeset
   282
		    		context = new BuildContextSBSv2(sdk, basePlat, targetString, alias, displayString, configID);
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   283
		    		if (context != null) 
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   284
		    			contexts.add(context);
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   285
		    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   286
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   287
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   288
		
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
   289
		return sortContexts(contexts);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   290
	}
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
	/**
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   293
	 * There are many build aliases presented by default from Raptor
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   294
	 * Filter out those that are less commonly used on new workspace creation.
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   295
	 */
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   296
	public static void initDefaultConfigsToFilter() {
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   297
		IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.getPluginId());
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   298
		String inited = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_INITED, "");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   299
		if (inited == null || inited.length() == 0){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   300
			Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   301
			List<String> defaultConfigsToFilter = new ArrayList<String>();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   302
			while (it.hasNext()){ 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   303
				Map.Entry buildConfigPair = (Map.Entry)it.next();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   304
				String buildAlias = (String)buildConfigPair.getKey();
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   305
				if (buildAlias.toLowerCase().startsWith("armv6") ||
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   306
					buildAlias.toLowerCase().startsWith("armv7") ||
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   307
					buildAlias.toLowerCase().startsWith("armv9")){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   308
					defaultConfigsToFilter.add(buildAlias);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   309
				}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   310
			}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   311
			prefs.put(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   312
			setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()]));
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   313
			
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   314
		}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   315
	}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   316
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   317
	/**
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
   318
	 * 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
   319
	 * @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
   320
	 */
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   321
	
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   322
	@SuppressWarnings("unused")
608
d2a651a847a5 Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents: 266
diff changeset
   323
	public static boolean enableSBSv1Support() {
1352
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   324
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   325
		if (!SDKCorePlugin.SUPPORTS_SBSV1_BUILDER)
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   326
			return false;
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   327
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   328
		else if (!enableSBSv2Support())
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   329
			return true;
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   330
		
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   331
		else if (isSBSv1Supported())
2953a4d4c5d9 Add SDKCorePlugin.SUPPORTS_SBSV1_BUILDER to enable/disable SBSv1 builder support
timkelly
parents: 1350
diff changeset
   332
			return true;
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   333
		
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
   334
		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
   335
	}
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
   336
	
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
   337
	/**
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   338
	 * Whether or not to display SBSv2 builder UI
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   339
	 * @return true if SBSv2 is installed, false otherwise
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   340
	 */
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   341
	public static boolean enableSBSv2Support() {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   342
		IPath sbsBinPath = getSBSBinDirectory();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   343
		if (sbsBinPath != null && sbsBinPath.toFile().exists()) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   344
			return true;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   345
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   346
		return false;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   347
	}
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
	private static void getConfigsForFile(File file) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   350
    	
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   351
    	try {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   352
    		Element root = null;
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   353
    		DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   354
    		parser.setErrorHandler(new DefaultHandler());
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   355
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   356
    		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
   357
    		root = parser.parse(source).getDocumentElement();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   358
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   359
    		NodeList children = root.getChildNodes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   360
    		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
   361
    			getConfigsForNode(children.item(i), root);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   362
    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   363
    		
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   364
    	} catch (Exception e) {
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   365
    		e.printStackTrace();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   366
    		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
   367
    	}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   368
    }
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   369
    
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   370
    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
   371
		if (node.getNodeName().equals("config")) { //$NON-NLS-1$
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   372
			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
   373
			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
   374
			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
   375
				if (namedNode != null) {
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   376
					
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   377
					// 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
   378
					String baseBuildPlatform = null;
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   379
					if (parentNode != null){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   380
						baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue();
1183
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   381
						if (baseBuildPlatform.split("_").length > 1){
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   382
							baseBuildPlatform = baseBuildPlatform.split("_")[0];
00adbfb5e5c4 Fix bug 11048
timkelly
parents: 1138
diff changeset
   383
						}
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   384
					}
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   385
					
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   386
					// 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
   387
					// 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
   388
					String configName = namedNode.getNodeValue();
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   389
					String[] configTokens = configName.split("_");
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   390
			    	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
   391
			    		String target = configTokens[1];
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   392
			    		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
   393
			    			if (baseBuildPlatform == null){
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   394
			    				baseBuildPlatform = "unknown";
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   395
			    			}
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   396
			    			unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   397
			    		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   398
			    	}
1134
081b99cb271a bug 10674. Add support for long alias names from Carbide.xml (initial support)
timkelly
parents: 693
diff changeset
   399
			    }
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   400
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   401
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   402
			NodeList children = node.getChildNodes();
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   403
			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
   404
				getConfigsForNode(children.item(i), node);
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   405
			}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   406
		}
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   407
    }
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
   408
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
   409
	/**
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
   410
	 * (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
   411
	 * @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
   412
	 */
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
   413
	public static String scanSBSv2() {
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   414
		if (sbsPath != null){
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   415
			return null;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   416
		}
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
   417
		// do some basic checks
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   418
		IPath expectedPath = getSBSBinDirectory();
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   419
		if (expectedPath != null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   420
			expectedPath = expectedPath.append(sbsScriptName);
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   421
			if (expectedPath.toFile().exists()) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   422
				sbsPath = expectedPath;
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   423
			}
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   424
		} 
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
   425
		
1239
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   426
		if (sbsPath == null) {
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   427
			return MessageFormat.format(Messages
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   428
					.getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$
668d819e9f59 Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents: 1221
diff changeset
   429
					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
   430
		}
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
   431
		
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
   432
		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
   433
	}
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
   434
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
   435
    /**
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
   436
     * 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
   437
     */
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
   438
	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
   439
		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
   440
			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
   441
			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
   442
		}
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
   443
		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
   444
	}
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
   445
	
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   446
	private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> contexts){ 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   447
    	
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   448
		// 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
   449
		
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
		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
   451
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
			// 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
   453
			public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   454
				ISBSv2BuildContext sbsv2Context1 = null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   455
				ISBSv2BuildContext sbsv2Context2 = null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   456
				String sbsAlias1 = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   457
				String sbsAlias2 = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   458
				if (o1 instanceof ISBSv2BuildContext && o2 instanceof ISBSv2BuildContext){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   459
					sbsv2Context1 = ((ISBSv2BuildContext)o1);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   460
					sbsv2Context2 = ((ISBSv2BuildContext)o2);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   461
					sbsAlias1 = sbsv2Context1.getSBSv2Alias();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   462
					sbsAlias2 = sbsv2Context2.getSBSv2Alias();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   463
				}
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
   464
				if (o1.getPlatformString().equals(o2.getPlatformString())) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   465
					if (sbsv2Context1.getSBSv2Alias().split("_").length != sbsv2Context1.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
   466
						return o1.getTargetString().compareTo(o2.getTargetString());
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   467
					else if (sbsAlias1.split("_").length >= 3){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   468
						String temp1[] = sbsAlias1.split("_");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   469
						String temp2[] = sbsAlias2.split("_");
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   470
						String suffix1 = "";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   471
						String suffix2 = "";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   472
						for (int i = 2; i < temp1.length; i++){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   473
							suffix1 += temp1[i] + "_";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   474
						}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   475
						
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   476
						for (int i = 2; i < temp2.length; i++){
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   477
							suffix2 += temp2[i] + "_";
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   478
						}
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   479
						
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   480
						return suffix1.compareTo(suffix2);
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   481
					} 
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
   482
				} 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
   483
					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
   484
						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
   485
					}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
   486
						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
   487
					} 
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
   488
				}
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
   489
				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
   490
			}
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
   491
			
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
   492
		});
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
   493
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
   494
		// 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
   495
		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
   496
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
   497
			public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) {
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   498
				ISBSv2BuildContext sbsv2Context1 = null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   499
				ISBSv2BuildContext sbsv2Context2 = null;
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   500
				String sbsAlias1 = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   501
				String sbsAlias2 = "";
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   502
				if (o1 instanceof ISBSv2BuildContext && o2 instanceof ISBSv2BuildContext){
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   503
					sbsv2Context1 = ((ISBSv2BuildContext)o1);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   504
					sbsv2Context2 = ((ISBSv2BuildContext)o2);
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   505
					sbsAlias1 = sbsv2Context1.getSBSv2Alias();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   506
					sbsAlias2 = sbsv2Context2.getSBSv2Alias();
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   507
				}
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
   508
				
1418
8ca7cf978139 first pass refactoring ICarbideBuildConfiguration, removing implementation of ISymbianBuildContext.
timkelly
parents: 1352
diff changeset
   509
				if (sbsv2Context1.getSBSv2Alias().split("_").length == 3 && sbsv2Context2.getSBSv2Alias().split("_").length == 3 &&
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   510
						o1.getPlatformString().equals(o2.getPlatformString()))
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   511
					return o1.getTargetString().compareTo(o2.getTargetString());
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   512
				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
   513
					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
   514
					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
   515
					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
   516
					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
   517
					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
   518
						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
   519
					}
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
   520
					
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
   521
					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
   522
						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
   523
					}
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
   524
					
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
   525
					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
   526
				} 
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
   527
				
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
   528
				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
   529
			}
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
   530
		});
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
   531
		
1270
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   532
    	return contexts; 
ad41cb5ef65f fix bug 11077 and bug 11033
timkelly
parents: 1239
diff changeset
   533
    }
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
   534
	
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
   535
	/**
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
   536
	 * 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
   537
	 * 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
   538
	 * 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
   539
	 * 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
   540
	 * @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
   541
	 * @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
   542
	 */
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
   543
	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
   544
		
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
   545
		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
   546
				"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
   547
		
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
   548
		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
   549
		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
   550
			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
   551
			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
   552
				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
   553
					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
   554
						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
   555
				}
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
   556
				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
   557
			}
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
   558
		}
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
   559
		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
   560
	}
1288
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   561
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   562
	private static boolean isSBSv1Supported() {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   563
		ISDKManager sdkMgr = SDKCorePlugin.getSDKManager();
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   564
		for (ISymbianSDK sdk : sdkMgr.getSDKList()) {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   565
			File abld = new File(sdk.getEPOCROOT(), "epoc32/tools/abld.pl"); //$NON-NLS-1$
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   566
			if (abld.exists()) {
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   567
				long size = abld.length();
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   568
				if (size >= VALID_ABLD_SIZE)
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   569
					return true;
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   570
			}
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   571
		}
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   572
		return false;
7f5308d16da0 Fix for Bug 11073 (Remove SBSv1 as a builder option).
stechong
parents: 1270
diff changeset
   573
	}
0
fb279309251b DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff changeset
   574
}