author | timkelly |
Thu, 22 Apr 2010 15:43:41 -0500 | |
branch | RCL_2_4 |
changeset 1267 | f47181a17fe4 |
parent 1240 | be20b442a60b |
child 1268 | 75a3be8a0480 |
permissions | -rw-r--r-- |
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; |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
17 |
import java.text.MessageFormat; |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
18 |
import java.util.ArrayList; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
19 |
import java.util.Collections; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
20 |
import java.util.Comparator; |
1147 | 21 |
import java.util.HashMap; |
22 |
import java.util.Iterator; |
|
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
23 |
import java.util.List; |
1147 | 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; |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
31 |
import org.eclipse.core.runtime.IPath; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
32 |
import org.eclipse.core.runtime.Path; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
33 |
import org.eclipse.core.runtime.Preferences; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
34 |
import org.osgi.framework.Version; |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
35 |
import org.w3c.dom.Element; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
36 |
import org.w3c.dom.Node; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
37 |
import org.w3c.dom.NodeList; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
38 |
import org.xml.sax.InputSource; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
39 |
import org.xml.sax.helpers.DefaultHandler; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
40 |
|
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
41 |
import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
42 |
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
43 |
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
176 | 44 |
import com.nokia.cpp.internal.api.utils.core.FileUtils; |
45 |
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
|
46 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
47 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
48 |
* Utility class for SBSv2 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
49 |
* @since 2.0 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
50 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
51 |
public class SBSv2Utils { |
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 |
private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$ |
1267 | 54 |
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
|
55 |
private static final String SBSV2_FILTERED_CONFIGS_DELIMETER = ";"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
56 |
|
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
57 |
/** Path, to and including the SBS script */ |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
58 |
protected static IPath sbsPath; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
59 |
|
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
60 |
private static boolean scannedSbsState = false; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
61 |
private static final String sbsScriptName = "sbs.bat"; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
62 |
|
1147 | 63 |
/** Map of usable Raptor alias for -c parameter and base platform: <alias, base plat> */ |
64 |
private static Map<String, String> unfilteredSBSv2ConfigNames; |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
65 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
66 |
/** |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
67 |
* Get the path to the SBSv2 bin directory. not including the sbs executable. |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
68 |
* May or may not actually exist. |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
69 |
* @return absolute path to the bin directory, or null if sbs is not set |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
70 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
71 |
public static IPath getSBSBinDirectory() { |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
72 |
String pathValue = EnvironmentReader.getEnvVar("PATH"); //$NON-NLS-1$ |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
73 |
IPath sbs = HostOS.findProgramOnPath(sbsScriptName, pathValue); |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
74 |
if (sbs != null){ |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
75 |
sbs = sbs.removeLastSegments(1); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
76 |
} |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
77 |
return sbs; |
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 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
80 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
81 |
* Get the build configurations supported by SBSv2 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
82 |
* @param refreshList whether or not to parse the configuration xml files again |
1147 | 83 |
* @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
|
84 |
*/ |
1147 | 85 |
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
|
86 |
|
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
87 |
if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) { |
1147 | 88 |
unfilteredSBSv2ConfigNames = new HashMap<String, String>(); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
89 |
|
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
90 |
// 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
|
91 |
try { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
92 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
93 |
IPath configPath = getSBSBinDirectory(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
94 |
if (configPath != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
95 |
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
|
96 |
File configDir = configPath.toFile(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
97 |
if (configDir.exists() && configDir.isDirectory()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
98 |
File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
99 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
100 |
public boolean accept(File arg0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
101 |
if (arg0.isDirectory()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
102 |
return true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
103 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
104 |
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
|
105 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
106 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
107 |
}, false); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
108 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
109 |
for (File file : configFiles) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
110 |
getConfigsForFile(file); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
111 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
112 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
113 |
} |
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 |
} catch (Exception e) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
116 |
e.printStackTrace(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
117 |
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
|
118 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
119 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
120 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
121 |
return unfilteredSBSv2ConfigNames; |
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 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
124 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
125 |
* 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
|
126 |
* @param sdks list of SDK's to check |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
127 |
* @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
|
128 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
129 |
public static List<ISymbianSDK> getSupportedSDKs(List<ISymbianSDK> sdks) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
130 |
List<ISymbianSDK> supportedSDKs = new ArrayList<ISymbianSDK>(); |
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 |
//TODO need a better way to do this from Symbian. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
133 |
// For now, just filter out anything older than 9.4 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
134 |
for (ISymbianSDK sdk : sdks) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
135 |
Version osVersion = sdk.getOSVersion(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
136 |
if (osVersion.getMajor() > 8 && osVersion.getMinor() > 3) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
137 |
supportedSDKs.add(sdk); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
138 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
139 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
140 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
141 |
return supportedSDKs; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
142 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
143 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
144 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
145 |
* 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
|
146 |
* be filtered out of any UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
147 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
148 |
public static String[] getSBSv2ConfigurationsToFilter() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
149 |
Preferences prefs = SDKCorePlugin.getDefault().getPluginPreferences(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
150 |
if (prefs != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
151 |
String configs = prefs.getString(SBSV2_FILTERED_CONFIGS_STORE); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
152 |
return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); |
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 new String[0]; |
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 |
* 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
|
159 |
* out of any UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
160 |
* @param configs configs to be filtered |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
161 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
162 |
public static void setSBSv2ConfigurationsToFilter(String[] configs) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
163 |
Preferences prefs = SDKCorePlugin.getDefault().getPluginPreferences(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
164 |
if (prefs != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
165 |
String store = ""; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
166 |
for (String config : configs) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
167 |
store = store + SBSV2_FILTERED_CONFIGS_DELIMETER + config; |
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 |
// remove the leading delimeter |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
171 |
if (store.length() > 0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
172 |
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
|
173 |
} |
c7ecdd0b9f52
Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents:
176
diff
changeset
|
174 |
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
|
175 |
// lenght of zero means there are not configs to filter (or show them all) |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
176 |
prefs.setValue(SBSV2_FILTERED_CONFIGS_STORE, store); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
177 |
SDKCorePlugin.getDefault().savePluginPreferences(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
178 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
179 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
180 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
181 |
|
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 |
* 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
|
184 |
* @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
|
185 |
* @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
|
186 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
187 |
public static List<ISymbianBuildContext> getFilteredSBSv2BuildContexts(ISymbianSDK sdk) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
188 |
List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
189 |
|
1267 | 190 |
initDefaultConfigsToFilter(); |
191 |
||
1147 | 192 |
Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); |
193 |
while (it.hasNext()){ |
|
194 |
Map.Entry buildConfigPair = (Map.Entry)it.next(); |
|
195 |
String alias = (String)buildConfigPair.getKey(); // The sbsv2 alias |
|
196 |
String basePlat = (String)buildConfigPair.getValue(); |
|
197 |
||
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
198 |
boolean addConfig = true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
199 |
for (String filteredConfig : getSBSv2ConfigurationsToFilter()) { |
1147 | 200 |
if (filteredConfig.compareTo(alias) == 0) { |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
201 |
addConfig = false; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
202 |
break; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
203 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
204 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
205 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
206 |
if (addConfig) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
207 |
// 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
|
208 |
// 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
|
209 |
String targetString = null; |
1147 | 210 |
String[] configTokens = alias.split("_"); // $//$NON-NLS-N$ |
211 |
// We presume that aliases have the second token as the "target". |
|
212 |
if (configTokens[1].toLowerCase().endsWith("deb")) { //$NON-NLS-1$ |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
213 |
targetString = ISymbianBuildContext.DEBUG_TARGET; |
1147 | 214 |
} else if (configTokens[1].toLowerCase().endsWith("rel")) { //$NON-NLS-1$ |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
215 |
targetString = ISymbianBuildContext.RELEASE_TARGET; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
216 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
217 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
218 |
if (targetString != null) { |
1147 | 219 |
|
220 |
SymbianBuildContext context = null; |
|
221 |
context = new SymbianBuildContext(sdk, basePlat, targetString, alias); |
|
222 |
if (context != null) |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
223 |
contexts.add(context); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
224 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
225 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
226 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
227 |
|
1147 | 228 |
return sortContexts(contexts); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
229 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
230 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
231 |
/** |
1267 | 232 |
* There are many build aliases presented by default from Raptor |
233 |
* Filter out those that are less commonly used on new workspace creation. |
|
234 |
*/ |
|
235 |
public static void initDefaultConfigsToFilter() { |
|
236 |
Preferences prefs = SDKCorePlugin.getDefault().getPluginPreferences(); |
|
237 |
String inited = prefs.getString(SBSV2_FILTERED_CONFIGS_STORE_INITED); |
|
238 |
if (inited == null || inited.length() == 0){ |
|
239 |
Iterator it = getUnfilteredSBSv2BuildConfigurations(false).entrySet().iterator(); |
|
240 |
List<String> defaultConfigsToFilter = new ArrayList<String>(); |
|
241 |
while (it.hasNext()){ |
|
242 |
Map.Entry buildConfigPair = (Map.Entry)it.next(); |
|
243 |
String buildAlias = (String)buildConfigPair.getKey(); |
|
244 |
if (buildAlias.toLowerCase().startsWith("armv6") || |
|
245 |
buildAlias.toLowerCase().startsWith("armv7") || |
|
246 |
buildAlias.toLowerCase().startsWith("armv9")){ |
|
247 |
defaultConfigsToFilter.add(buildAlias); |
|
248 |
} |
|
249 |
} |
|
250 |
prefs.setValue(SBSV2_FILTERED_CONFIGS_STORE_INITED, "true"); |
|
251 |
setSBSv2ConfigurationsToFilter(defaultConfigsToFilter.toArray(new String[defaultConfigsToFilter.size()])); |
|
252 |
||
253 |
} |
|
254 |
||
255 |
} |
|
256 |
||
257 |
/** |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
258 |
* Whether or not to display SBSv2 builder UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
259 |
* @return true if SBSv2 is installed, false otherwise |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
260 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
261 |
public static boolean enableSBSv2Support() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
262 |
IPath sbsBinPath = getSBSBinDirectory(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
263 |
if (sbsBinPath != null && sbsBinPath.toFile().exists()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
264 |
return true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
265 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
266 |
return false; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
267 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
268 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
269 |
private static void getConfigsForFile(File file) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
270 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
271 |
try { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
272 |
Element root = null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
273 |
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
274 |
parser.setErrorHandler(new DefaultHandler()); |
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 |
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
|
277 |
root = parser.parse(source).getDocumentElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
278 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
279 |
NodeList children = root.getChildNodes(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
280 |
for (int i=0; i< children.getLength(); i++) { |
1147 | 281 |
getConfigsForNode(children.item(i), root); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
282 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
283 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
284 |
} catch (Exception e) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
285 |
e.printStackTrace(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
286 |
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
|
287 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
288 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
289 |
|
1147 | 290 |
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
|
291 |
if (node.getNodeName().equals("config")) { //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
292 |
Node abstractNode = node.getAttributes().getNamedItem("abstract"); //$NON-NLS-1$ |
1147 | 293 |
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
|
294 |
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
|
295 |
if (namedNode != null) { |
1147 | 296 |
|
297 |
// Get the parent base build platform |
|
298 |
String baseBuildPlatform = null; |
|
299 |
if (parentNode != null){ |
|
1181 | 300 |
baseBuildPlatform = parentNode.getAttributes().getNamedItem("name").getNodeValue(); |
301 |
if (baseBuildPlatform.split("_").length > 1){ |
|
302 |
baseBuildPlatform = baseBuildPlatform.split("_")[0]; |
|
303 |
} |
|
1147 | 304 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
305 |
// 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
|
306 |
// 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
|
307 |
String configName = namedNode.getNodeValue(); |
1147 | 308 |
String[] configTokens = configName.split("_"); |
309 |
if (configTokens.length >= 2) { //$NON-NLS-1$ |
|
310 |
String target = configTokens[1]; |
|
311 |
if (target.endsWith("deb") || target.endsWith("rel")){ //$NON-NLS-1$ |
|
312 |
if (baseBuildPlatform == null){ |
|
313 |
baseBuildPlatform = "unknown"; |
|
314 |
} |
|
315 |
unfilteredSBSv2ConfigNames.put(configName, baseBuildPlatform); |
|
316 |
} |
|
317 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
318 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
319 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
320 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
321 |
NodeList children = node.getChildNodes(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
322 |
for (int i=0; i< children.getLength(); i++) { |
1147 | 323 |
getConfigsForNode(children.item(i), node); |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
324 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
325 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
326 |
} |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
327 |
|
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
328 |
/** |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
329 |
* (Re-)scan the SBSv2 / Raptor configuration |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
330 |
* @return message if error, else null |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
331 |
**/ |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
332 |
public static String scanSBSv2() { |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
333 |
// do some basic checks |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
334 |
if (sbsPath != null){ |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
335 |
return null; |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
336 |
} |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
337 |
IPath expectedPath = getSBSBinDirectory(); |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
338 |
if (expectedPath != null) { |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
339 |
expectedPath = expectedPath.append(sbsScriptName); |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
340 |
if (expectedPath.toFile().exists()) { |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
341 |
sbsPath = expectedPath; |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
342 |
} |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
343 |
} |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
344 |
if (sbsPath == null) { |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
345 |
return MessageFormat.format(Messages |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
346 |
.getString("SBSv2Utils.CannotFindSBSScriptError"), //$NON-NLS-1$ |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
347 |
sbsScriptName); |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
348 |
} |
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
349 |
|
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
350 |
return null; |
1240
be20b442a60b
Fix bug 11022. Get rid of dependency on SBS_HOME.
timkelly
parents:
1222
diff
changeset
|
351 |
} |
787
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
352 |
|
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
353 |
/** |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
354 |
* Get the path to SBSv2 (sbs.bat or sbs) |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
355 |
**/ |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
356 |
public static IPath getSBSPath() { |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
357 |
if (!scannedSbsState) { |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
358 |
scanSBSv2(); |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
359 |
scannedSbsState = true; |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
360 |
} |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
361 |
return sbsPath != null ? sbsPath : new Path(sbsScriptName); |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
362 |
} |
f90a80bff752
Fix bug 10467. Raptor startup issues when raptor crashes or hangs.
timkelly
parents:
266
diff
changeset
|
363 |
|
1147 | 364 |
private static List<ISymbianBuildContext> sortContexts(List<ISymbianBuildContext> contexts){ |
365 |
||
366 |
// 3 sorting stages to handle long Raptor aliases, and multiple aliases that have a similar platform and target prefix (e.g. armv5_urel) |
|
367 |
||
368 |
Collections.sort(contexts, new Comparator<ISymbianBuildContext>() { |
|
369 |
||
370 |
// First sort the target name (Debug / Release) and push Emulation to the top |
|
371 |
public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { |
|
372 |
String sbsAlias1 = o1.getSBSv2Alias(); |
|
373 |
String sbsAlias2 = o2.getSBSv2Alias(); |
|
374 |
||
375 |
if (o1.getPlatformString().equals(o2.getPlatformString())) { |
|
376 |
if (o1.getSBSv2Alias().split("_").length == 2 && o2.getSBSv2Alias().split("_").length == 2) |
|
377 |
return o1.getTargetString().compareTo(o2.getTargetString()); |
|
378 |
else if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3) |
|
379 |
return 1; |
|
380 |
} else { |
|
381 |
if (sbsAlias1.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { |
|
382 |
return -1; |
|
383 |
}else if (sbsAlias2.toUpperCase().startsWith(ISymbianBuildContext.EMULATOR_PLATFORM)) { |
|
384 |
return 1; |
|
385 |
} |
|
386 |
} |
|
387 |
return sbsAlias1.compareTo(sbsAlias2); |
|
388 |
} |
|
389 |
||
390 |
}); |
|
391 |
||
392 |
// Sort long alias names |
|
393 |
Collections.sort(contexts, new Comparator<ISymbianBuildContext>() { |
|
394 |
||
395 |
public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { |
|
396 |
String sbsAlias1 = o1.getSBSv2Alias(); |
|
397 |
String sbsAlias2 = o2.getSBSv2Alias(); |
|
398 |
||
399 |
if (sbsAlias1.split("_").length >= 3 && sbsAlias1.split("_").length >= 3 && !sbsAlias1.equals(sbsAlias2)){ |
|
400 |
String temp1[] = sbsAlias1.split("_"); |
|
401 |
String temp2[] = sbsAlias2.split("_"); |
|
402 |
String suffix1 = ""; |
|
403 |
String suffix2 = ""; |
|
404 |
for (int i = 2; i < temp1.length; i++){ |
|
405 |
suffix1 += temp1[i] + "_"; |
|
406 |
} |
|
407 |
||
408 |
for (int i = 2; i < temp2.length; i++){ |
|
409 |
suffix2 += temp2[i] + "_"; |
|
410 |
} |
|
411 |
||
412 |
return suffix1.compareTo(suffix2); |
|
413 |
} |
|
414 |
||
415 |
return 0; |
|
416 |
} |
|
417 |
}); |
|
418 |
||
419 |
return contexts; |
|
420 |
} |
|
421 |
||
1222
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
422 |
/** |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
423 |
* If a variant is defined and it changes the output directory, return the directory name. |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
424 |
* For example, armv5_udeb.phone1 would return '.phone1'. If not variant that changes the release tree, then null |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
425 |
* NOTE: This method deals with variant text applied to the end of a build alias, specifically testing for |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
426 |
* variant text defined in the SBSv2 Build Configuration tab. |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
427 |
* @return null if not a variant or the value to append to the platform release tree directory |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
428 |
* @see com.nokia.carbide.cdt.internal.builder.ui#SBSv2BuildConfigTab |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
429 |
*/ |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
430 |
public static String getVariantOutputDirModifier(String variantText) { |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
431 |
|
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
432 |
String[] ignoredVariants = { "generic", "tracecompiler", "trace", "test", "savespace", |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
433 |
"bfc", "smp", "rvct2_2", "rvct4_0", "rvct3_1", "gcce4_3_2", "remove_freeze" }; |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
434 |
|
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
435 |
String newOutputDir = null; |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
436 |
if (variantText != null && variantText.length() > 1){ |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
437 |
String[] variantTok = variantText.split("\\."); |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
438 |
if (variantTok.length > 1){ |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
439 |
for (String ignore : ignoredVariants){ |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
440 |
if (variantTok[1].toLowerCase().equals(ignore)) |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
441 |
return null; |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
442 |
} |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
443 |
newOutputDir = "." + variantTok[1]; |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
444 |
} |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
445 |
} |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
446 |
return newOutputDir; |
63523a35c9b2
fix bug 11068. make sbsv2 variant appender configuration specific
timkelly
parents:
1181
diff
changeset
|
447 |
} |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
448 |
} |