11 * |
11 * |
12 */ |
12 */ |
13 package com.nokia.carbide.cpp.internal.api.sdk; |
13 package com.nokia.carbide.cpp.internal.api.sdk; |
14 |
14 |
15 import java.io.File; |
15 import java.io.File; |
16 import java.io.FileFilter; |
|
17 import java.text.MessageFormat; |
16 import java.text.MessageFormat; |
18 import java.util.ArrayList; |
17 import java.util.ArrayList; |
19 import java.util.Collections; |
18 import java.util.Collections; |
20 import java.util.Comparator; |
19 import java.util.Comparator; |
21 import java.util.HashMap; |
|
22 import java.util.Iterator; |
|
23 import java.util.List; |
20 import java.util.List; |
24 import java.util.Map; |
|
25 |
|
26 import javax.xml.parsers.DocumentBuilder; |
|
27 import javax.xml.parsers.DocumentBuilderFactory; |
|
28 |
21 |
29 import org.eclipse.cdt.utils.spawner.EnvironmentReader; |
22 import org.eclipse.cdt.utils.spawner.EnvironmentReader; |
30 import org.eclipse.core.filesystem.URIUtil; |
|
31 import org.eclipse.core.runtime.IPath; |
23 import org.eclipse.core.runtime.IPath; |
32 import org.eclipse.core.runtime.Path; |
24 import org.eclipse.core.runtime.Path; |
33 import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
25 import org.eclipse.core.runtime.preferences.IEclipsePreferences; |
34 import org.eclipse.core.runtime.preferences.InstanceScope; |
26 import org.eclipse.core.runtime.preferences.InstanceScope; |
35 import org.osgi.framework.Version; |
27 import org.osgi.framework.Version; |
36 import org.osgi.service.prefs.BackingStoreException; |
28 import org.osgi.service.prefs.BackingStoreException; |
37 import org.w3c.dom.Element; |
29 |
38 import org.w3c.dom.Node; |
|
39 import org.w3c.dom.NodeList; |
|
40 import org.xml.sax.InputSource; |
|
41 import org.xml.sax.helpers.DefaultHandler; |
|
42 |
|
43 import com.nokia.carbide.cpp.sdk.core.ISBSv2BuildContext; |
|
44 import com.nokia.carbide.cpp.sdk.core.ISDKManager; |
30 import com.nokia.carbide.cpp.sdk.core.ISDKManager; |
45 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
31 import com.nokia.carbide.cpp.sdk.core.ISymbianBuildContext; |
46 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
32 import com.nokia.carbide.cpp.sdk.core.ISymbianSDK; |
47 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
33 import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin; |
48 import com.nokia.cpp.internal.api.utils.core.FileUtils; |
|
49 import com.nokia.cpp.internal.api.utils.core.HostOS; |
34 import com.nokia.cpp.internal.api.utils.core.HostOS; |
50 import com.nokia.cpp.internal.api.utils.core.Logging; |
35 import com.nokia.cpp.internal.api.utils.core.Logging; |
51 |
36 |
52 /** |
37 /** |
53 * Utility class for SBSv2 |
38 * Utility class for SBSv2 |
84 if (sbs != null){ |
69 if (sbs != null){ |
85 sbs = sbs.removeLastSegments(1); |
70 sbs = sbs.removeLastSegments(1); |
86 } |
71 } |
87 return sbs; |
72 return sbs; |
88 } |
73 } |
89 |
|
90 /** |
|
91 * Get the build configurations supported by SBSv2 |
|
92 * @param refreshList whether or not to parse the configuration xml files again |
|
93 * @return A map of raptor aliases (key) to base build platform. Never null; |
|
94 */ |
|
95 // public static Map<String, String> getUnfilteredSBSv2BuildConfigurations(boolean refreshList) { |
|
96 // |
|
97 // if (unfilteredSBSv2ConfigNames == null || refreshList || unfilteredSBSv2ConfigNames.size() == 0) { |
|
98 // unfilteredSBSv2ConfigNames = new HashMap<String, String>(); |
|
99 // |
|
100 // // parse the xml files in <sbs-install>/lib/config/ to get SBSv2 configs |
|
101 // try { |
|
102 // |
|
103 // IPath configPath = getSBSBinDirectory(); |
|
104 // if (configPath != null) { |
|
105 // configPath = configPath.removeLastSegments(1).append("lib/config"); //$NON-NLS-1$ |
|
106 // File configDir = configPath.toFile(); |
|
107 // if (configDir.exists() && configDir.isDirectory()) { |
|
108 // File[] configFiles = FileUtils.listFilesInTree(configDir, new FileFilter() { |
|
109 // |
|
110 // public boolean accept(File arg0) { |
|
111 // if (arg0.isDirectory()) { |
|
112 // return true; |
|
113 // } |
|
114 // return arg0.getName().toLowerCase().endsWith("xml"); //$NON-NLS-1$ |
|
115 // } |
|
116 // |
|
117 // }, false); |
|
118 // |
|
119 // for (File file : configFiles) { |
|
120 // getConfigsForFile(file); |
|
121 // } |
|
122 // } |
|
123 // } |
|
124 // |
|
125 // } catch (Exception e) { |
|
126 // e.printStackTrace(); |
|
127 // Logging.log(SDKCorePlugin.getDefault(), Logging.newStatus(SDKCorePlugin.getDefault(), e)); |
|
128 // } |
|
129 // } |
|
130 // |
|
131 // return unfilteredSBSv2ConfigNames; |
|
132 // } |
|
133 |
74 |
134 /** |
75 /** |
135 * Given a list of SDKs, returns the list of the SDK's supported by SBSv2 |
76 * Given a list of SDKs, returns the list of the SDK's supported by SBSv2 |
136 * @param sdks list of SDK's to check |
77 * @param sdks list of SDK's to check |
137 * @return list of SBSv2 supported SDK's, may be empty |
78 * @return list of SBSv2 supported SDK's, may be empty |
158 |
99 |
159 /** |
100 /** |
160 * Returns the list of SBSv2 build configuration names that should |
101 * Returns the list of SBSv2 build configuration names that should |
161 * INCLUDED in any UI. Only configs to be displayed are saved |
102 * INCLUDED in any UI. Only configs to be displayed are saved |
162 */ |
103 */ |
163 public static List<String> getSBSv2FilteredConfigs() { |
104 public static List<String> getSBSv2FilteredConfigPreferences() { |
164 List<String> buildAliasList = new ArrayList<String>(); |
105 List<String> buildAliasList = new ArrayList<String>(); |
165 IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID); |
106 IEclipsePreferences prefs = new InstanceScope().getNode(SDKCorePlugin.PLUGIN_ID); |
166 if (prefs != null) { |
107 if (prefs != null) { |
167 String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, ""); |
108 String configs = prefs.get(SBSV2_FILTERED_CONFIGS_STORE_V2, ""); |
168 String aliasesToInclude[] = configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); |
109 String aliasesToInclude[] = configs.split(SBSV2_FILTERED_CONFIGS_DELIMETER); |