author | Ed Swartz <ed.swartz@nokia.com> |
Fri, 04 Dec 2009 08:32:47 -0600 | |
changeset 629 | c24c517fe8c2 |
parent 608 | d2a651a847a5 |
child 693 | 2d475d296af4 |
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; |
176 | 17 |
import java.util.*; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
18 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
19 |
import javax.xml.parsers.DocumentBuilder; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
20 |
import javax.xml.parsers.DocumentBuilderFactory; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
21 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
22 |
import org.eclipse.cdt.utils.spawner.EnvironmentReader; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
23 |
import org.eclipse.core.filesystem.URIUtil; |
176 | 24 |
import org.eclipse.core.runtime.*; |
629 | 25 |
import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
26 |
import org.eclipse.core.runtime.preferences.InstanceScope; |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
27 |
import org.osgi.framework.Version; |
629 | 28 |
import org.osgi.service.prefs.BackingStoreException; |
176 | 29 |
import org.w3c.dom.*; |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
30 |
import org.xml.sax.InputSource; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
31 |
import org.xml.sax.helpers.DefaultHandler; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
32 |
|
176 | 33 |
import com.nokia.carbide.cpp.sdk.core.*; |
34 |
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
|
35 |
import com.nokia.cpp.internal.api.utils.core.HostOS; |
176 | 36 |
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
|
37 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
38 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
39 |
* Utility class for SBSv2 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
40 |
* @since 2.0 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
41 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
42 |
public class SBSv2Utils { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
43 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
44 |
private static final String SBSV2_FILTERED_CONFIGS_STORE = "sbsv2FilteredConfigs"; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
45 |
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
|
46 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
47 |
private static List<String> unfilteredSBSv2ConfigNames; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
48 |
|
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 |
protected static final String SBS_HOME = "SBS_HOME"; |
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
|
50 |
protected static String sbsHome; |
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
|
51 |
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
|
52 |
|
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
|
53 |
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
|
54 |
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
|
55 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
56 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
57 |
* Get the path to the SBSv2 bin directory. This is based on the SBS_HOME environment variable |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
58 |
* and may or may not actually exist. |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
59 |
* @return absolute path to the bin directory, or null if SBS_HOME is not set |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
60 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
61 |
public static IPath getSBSBinDirectory() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
62 |
String sbsHome = EnvironmentReader.getEnvVar("SBS_HOME"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
63 |
if (sbsHome != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
64 |
return new Path(sbsHome).append("bin"); //$NON-NLS-1$ |
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 |
return null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
67 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
68 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
69 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
70 |
* Get the build configurations supported by SBSv2 |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
71 |
* @param refreshList whether or not to parse the configuration xml files again |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
72 |
* @return list of configuration names, never null |
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 |
public static List<String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
75 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
76 |
if (unfilteredSBSv2ConfigNames == null || refreshList) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
77 |
unfilteredSBSv2ConfigNames = new ArrayList<String>(); |
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 |
// parse the xml files in SBS_HOME/lib/config/ to get SBSv2 configs |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
80 |
try { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
81 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
82 |
IPath configPath = getSBSBinDirectory(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
83 |
if (configPath != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
84 |
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
|
85 |
File configDir = configPath.toFile(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
86 |
if (configDir.exists() && configDir.isDirectory()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
87 |
File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() { |
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 |
public boolean accept(File arg0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
90 |
if (arg0.isDirectory()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
91 |
return true; |
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 |
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
|
94 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
95 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
96 |
}, false); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
97 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
98 |
for (File file : configFiles) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
99 |
getConfigsForFile(file); |
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 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
102 |
} |
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 |
} catch (Exception e) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
105 |
e.printStackTrace(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
106 |
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
|
107 |
} |
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 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
110 |
return unfilteredSBSv2ConfigNames; |
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 |
* 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
|
115 |
* @param sdks list of SDK's to check |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
116 |
* @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
|
117 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
118 |
public static List<ISymbianSDK> getSupportedSDKs(List<ISymbianSDK> sdks) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
119 |
List<ISymbianSDK> supportedSDKs = new ArrayList<ISymbianSDK>(); |
629 | 120 |
|
121 |
// If there is no SBSv1 builder, then assume all SDKs are SBSv2 capable |
|
122 |
if (!enableSBSv1Support()) { |
|
123 |
supportedSDKs.addAll(sdks); |
|
124 |
} else { |
|
125 |
//TODO need a better way to do this from Symbian. |
|
126 |
// For now, just filter out anything older than 9.4 |
|
127 |
for (ISymbianSDK sdk : sdks) { |
|
128 |
Version osVersion = sdk.getOSVersion(); |
|
129 |
if (osVersion.getMajor() > 8 || |
|
130 |
(osVersion.getMajor() == 8 && osVersion.getMinor() > 3)) { |
|
131 |
supportedSDKs.add(sdk); |
|
132 |
} |
|
133 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
134 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
135 |
return supportedSDKs; |
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 |
|
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 |
* 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
|
140 |
* be filtered out of any UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
141 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
142 |
public static String[] getSBSv2ConfigurationsToFilter() { |
629 | 143 |
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
|
144 |
if (prefs != null) { |
629 | 145 |
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
|
146 |
return configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); |
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 |
return new String[0]; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
149 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
150 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
151 |
/** |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
152 |
* 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
|
153 |
* out of any UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
154 |
* @param configs configs to be filtered |
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 |
public static void setSBSv2ConfigurationsToFilter(String[] configs) { |
629 | 157 |
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
|
158 |
if (prefs != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
159 |
String store = ""; //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
160 |
for (String config : configs) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
161 |
store = store + SBSV2_FILTERED_CONFIGS_DELIMETER + config; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
162 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
163 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
164 |
// remove the leading delimeter |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
165 |
if (store.length() > 0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
166 |
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
|
167 |
} |
c7ecdd0b9f52
Fix bug 9310. Fix save problem with Platform Filter Prefs (sbsv2) and add Restore / Apply buttons.
timkelly
parents:
176
diff
changeset
|
168 |
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
|
169 |
// lenght of zero means there are not configs to filter (or show them all) |
629 | 170 |
prefs.put(SBSV2_FILTERED_CONFIGS_STORE, store); |
171 |
try { |
|
172 |
prefs.flush(); |
|
173 |
} catch (BackingStoreException e) { |
|
174 |
Logging.log(SDKCorePlugin.getDefault(), |
|
175 |
Logging.newStatus(SDKCorePlugin.getDefault(), e)); |
|
176 |
} |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
177 |
} |
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 |
* 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
|
183 |
* @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
|
184 |
* @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
|
185 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
186 |
public static List<ISymbianBuildContext> getFilteredSBSv2BuildContexts(ISymbianSDK sdk) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
187 |
List<ISymbianBuildContext> contexts = new ArrayList<ISymbianBuildContext>(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
188 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
189 |
for (String name : getUnfilteredSBSv2BuildConfigurations(false)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
190 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
191 |
boolean addConfig = true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
192 |
for (String filteredConfig : getSBSv2ConfigurationsToFilter()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
193 |
if (filteredConfig.compareTo(name) == 0) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
194 |
addConfig = false; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
195 |
break; |
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 |
if (addConfig) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
200 |
// 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
|
201 |
// 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
|
202 |
String targetString = null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
203 |
if (name.toLowerCase().endsWith("_udeb") || name.toLowerCase().endsWith("_deb")) { //$NON-NLS-1$ //$NON-NLS-2$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
204 |
targetString = ISymbianBuildContext.DEBUG_TARGET; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
205 |
} else if (name.toLowerCase().endsWith("_urel") || name.toLowerCase().endsWith("_rel")) { //$NON-NLS-1$ //$NON-NLS-2$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
206 |
targetString = ISymbianBuildContext.RELEASE_TARGET; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
207 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
208 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
209 |
if (targetString != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
210 |
String[] parts = name.split("_"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
211 |
if (parts.length == 2) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
212 |
SymbianBuildContext context = new SymbianBuildContext(sdk, parts[0].toUpperCase(), targetString); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
213 |
contexts.add(context); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
214 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
215 |
} |
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 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
219 |
Collections.sort(contexts, new Comparator<ISymbianBuildContext>() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
220 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
221 |
public int compare(ISymbianBuildContext o1, ISymbianBuildContext o2) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
222 |
String platform1 = o1.getPlatformString(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
223 |
String platform2 = o2.getPlatformString(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
224 |
if (platform1.equals(platform2)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
225 |
return o1.getTargetString().compareTo(o2.getTargetString()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
226 |
} else { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
227 |
if (platform1.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
228 |
return -1; |
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 |
else if (platform2.equals(ISymbianBuildContext.EMULATOR_PLATFORM)) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
231 |
return 1; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
232 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
233 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
234 |
return 0; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
235 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
236 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
237 |
}); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
238 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
239 |
return contexts; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
240 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
241 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
242 |
/** |
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
|
243 |
* 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
|
244 |
* @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
|
245 |
*/ |
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
|
246 |
public static boolean enableSBSv1Support() { |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
247 |
if (!enableSBSv2Support()) |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
248 |
return true; |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
249 |
|
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
|
250 |
// TODO LINUX: more accurate check |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
251 |
if (HostOS.IS_WIN32) |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
252 |
return true; |
d2a651a847a5
Initial work to support an ISDKManager implementation that only understands SBSv2 (meaning, no devices.xml support).
Ed Swartz <ed.swartz@nokia.com>
parents:
266
diff
changeset
|
253 |
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
|
254 |
} |
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
|
255 |
|
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
|
256 |
/** |
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
257 |
* Whether or not to display SBSv2 builder UI |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
258 |
* @return true if SBSv2 is installed, false otherwise |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
259 |
*/ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
260 |
public static boolean enableSBSv2Support() { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
261 |
IPath sbsBinPath = getSBSBinDirectory(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
262 |
if (sbsBinPath != null && sbsBinPath.toFile().exists()) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
263 |
return true; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
264 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
265 |
return false; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
266 |
} |
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 |
private static void getConfigsForFile(File file) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
269 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
270 |
try { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
271 |
Element root = null; |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
272 |
DocumentBuilder parser = DocumentBuilderFactory.newInstance().newDocumentBuilder(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
273 |
parser.setErrorHandler(new DefaultHandler()); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
274 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
275 |
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
|
276 |
root = parser.parse(source).getDocumentElement(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
277 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
278 |
NodeList children = root.getChildNodes(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
279 |
for (int i=0; i< children.getLength(); i++) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
280 |
getConfigsForNode(children.item(i)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
281 |
} |
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 |
} catch (Exception e) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
284 |
e.printStackTrace(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
285 |
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
|
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 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
289 |
private static void getConfigsForNode(Node node) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
290 |
if (node.getNodeName().equals("config")) { //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
291 |
Node abstractNode = node.getAttributes().getNamedItem("abstract"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
292 |
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
|
293 |
Node namedNode = node.getAttributes().getNamedItem("name"); //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
294 |
if (namedNode != null) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
295 |
// 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
|
296 |
// 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
|
297 |
String configName = namedNode.getNodeValue(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
298 |
if (configName.toLowerCase().endsWith("_udeb") || configName.toLowerCase().endsWith("_deb") || //$NON-NLS-1$ //$NON-NLS-2$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
299 |
configName.toLowerCase().endsWith("_urel") || configName.toLowerCase().endsWith("_rel")) { //$NON-NLS-1$ //$NON-NLS-2$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
300 |
if (configName.split("_").length == 2) { //$NON-NLS-1$ |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
301 |
unfilteredSBSv2ConfigNames.add(configName); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
302 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
303 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
304 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
305 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
306 |
|
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
307 |
NodeList children = node.getChildNodes(); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
308 |
for (int i=0; i< children.getLength(); i++) { |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
309 |
getConfigsForNode(children.item(i)); |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
310 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
311 |
} |
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
312 |
} |
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
|
313 |
|
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
|
314 |
/** |
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
|
315 |
* (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
|
316 |
* @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
|
317 |
*/ |
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 |
public static String 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
|
319 |
// do some basic checks |
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 |
sbsHome = System.getenv(SBS_HOME); |
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
|
321 |
if (sbsHome == 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
|
322 |
return "Please define the SBS_HOME environment (e.g. /path/to/raptor) and add $SBS_HOME/bin to your PATH before running Carbide."; |
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 |
} |
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
|
324 |
|
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
|
325 |
sbsPath = HostOS.findProgramOnPath(sbsScriptName, 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
|
326 |
if (sbsPath == 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
|
327 |
return "Please add $SBS_HOME/bin to your PATH before running Carbide."; |
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
|
328 |
} |
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
|
329 |
|
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
|
330 |
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
|
331 |
} |
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
|
332 |
|
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
|
333 |
/** |
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 |
* 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
|
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 |
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
|
337 |
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
|
338 |
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
|
339 |
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
|
340 |
} |
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
|
341 |
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
|
342 |
} |
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
|
343 |
|
0
fb279309251b
DP tools release version Revision: 200912
Deepak Modgil <Deepak.Modgil@Nokia.com>
parents:
diff
changeset
|
344 |
} |