Fixed SDK scanning issues at startup; also fixed Bug 11470.
--- a/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Mon Jun 14 13:24:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/AllTests.java Tue Jun 15 23:12:37 2010 -0500
@@ -33,6 +33,7 @@
suite.addTestSuite(SymbianContextTest.class);
suite.addTestSuite(TestSDKChangeListener.class);
suite.addTestSuite(TestDevicesXMLListener.class);
+ suite.addTestSuite(TestCarbideSDKCache.class);
//$JUnit-END$
return suite;
}
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/core/com.nokia.carbide.cpp.sdk.core.test/src/com/nokia/carbide/cpp/sdk/core/test/TestCarbideSDKCache.java Tue Jun 15 23:12:37 2010 -0500
@@ -0,0 +1,103 @@
+package com.nokia.carbide.cpp.sdk.core.test;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.jobs.IJobChangeEvent;
+import org.eclipse.core.runtime.jobs.IJobChangeListener;
+import org.eclipse.core.runtime.jobs.Job;
+import org.osgi.framework.Version;
+
+import com.nokia.carbide.cpp.internal.sdk.core.model.SDKManager;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory;
+
+import junit.framework.TestCase;
+
+public class TestCarbideSDKCache extends TestCase {
+
+ private class TestSDKManager extends SDKManager {
+ private File cacheFile = new File(System.getProperty("user.home"), CARBIDE_SDK_CACHE_FILE_NAME);
+ public File getCacheFile() {
+ return cacheFile;
+ }
+
+ public Job getScanJob() {
+ return scanJob;
+ }
+ }
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ }
+
+ public void testCacheCreation() throws Exception {
+ final TestSDKManager manager = new TestSDKManager();
+ File cacheFile = manager.getCacheFile();
+ if (cacheFile != null && cacheFile.exists()) {
+ cacheFile.delete();
+ }
+ IJobChangeListener listener = new IJobChangeListener() {
+
+ public void sleeping(IJobChangeEvent event) {
+ }
+
+ public void scheduled(IJobChangeEvent event) {
+ }
+
+ public void running(IJobChangeEvent event) {
+ }
+
+ public void done(IJobChangeEvent event) {
+ File cacheFile = manager.getCacheFile();
+ assertNotNull(cacheFile);
+ assertTrue(cacheFile.exists());
+ }
+
+ public void awake(IJobChangeEvent event) {
+ }
+
+ public void aboutToRun(IJobChangeEvent event) {
+ }
+ };
+ manager.addScanJobListner(listener);
+ manager.scanSDKs();
+ manager.getScanJob().join();
+ manager.removeScanJobLisner(listener);
+ }
+
+ public void testCacheModification() throws Exception {
+ final TestSDKManager manager = new TestSDKManager();
+ long orgTime = manager.getCacheFile().lastModified();
+ manager.scanSDKs();
+ manager.getScanJob().join();
+ assertTrue(manager.getCacheFile().lastModified() > orgTime);
+ final String sdkId = "test";
+ ISymbianSDK sdk = SymbianSDKFactory.createInstance(sdkId, "C:\\", "com.nokia.s60",
+ new Version("9.5"), new Version("5.0"));
+ orgTime = manager.getCacheFile().lastModified();
+ waitASecond();
+ manager.addSDK(sdk);
+ assertTrue(manager.getCacheFile().lastModified() > orgTime);
+ orgTime = manager.getCacheFile().lastModified();
+ waitASecond();
+ manager.updateSDK(sdk);
+ assertTrue(manager.getCacheFile().lastModified() > orgTime);
+ orgTime = manager.getCacheFile().lastModified();
+ waitASecond();
+ manager.removeSDK(sdkId);
+ assertTrue(manager.getCacheFile().lastModified() > orgTime);
+ }
+
+ private void waitASecond() {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ e.printStackTrace();
+ }
+ }
+
+}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Mon Jun 14 13:24:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/AbstractSDKManager.java Tue Jun 15 23:12:37 2010 -0500
@@ -41,7 +41,7 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IProgressMonitor;
import org.eclipse.core.runtime.IStatus;
-import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.core.runtime.Path;
import org.eclipse.core.runtime.Platform;
import org.eclipse.core.runtime.Status;
import org.eclipse.core.runtime.jobs.IJobChangeListener;
@@ -70,6 +70,7 @@
import com.nokia.carbide.cpp.sdk.core.ISymbianBuilderID;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
+import com.nokia.carbide.cpp.sdk.core.SymbianSDKFactory;
import com.nokia.cpp.internal.api.utils.core.FileUtils;
import com.nokia.cpp.internal.api.utils.core.ListenerList;
import com.nokia.cpp.internal.api.utils.core.Logging;
@@ -130,12 +131,12 @@
public AbstractSDKManager() {
macroStore = SymbianMacroStore.getInstance();
-// scanJob = new Job ("Scan System Drives") {
-// @Override
-// protected IStatus run(IProgressMonitor monitor) {
-// return handleScan(monitor);
-// }
-// };
+ scanJob = new Job ("Scan System Drives") {
+ @Override
+ protected IStatus run(IProgressMonitor monitor) {
+ return handleScan(monitor);
+ }
+ };
}
public SymbianMacroStore getSymbianMacroStore(){
@@ -143,11 +144,10 @@
}
public void scanSDKs() {
-// if (scanJob.getState() == Job.NONE) {
-// scanJob.setSystem(true);
-// scanJob.schedule();
-// }
- handleScan(new NullProgressMonitor());
+ // do the real sdk scanning in a job.
+ if (scanJob.getState() == Job.NONE) {
+ scanJob.schedule();
+ }
}
private IStatus handleScan(IProgressMonitor monitor) {
@@ -181,6 +181,12 @@
found = true;
break;
}
+ if (sdk.getEPOCROOT().toLowerCase().equals(oldSdk.getEPOCROOT().toLowerCase())) {
+ // use the existing SDK name
+ ((SymbianSDK)sdk).setUniqueId(oldSdk.getUniqueId());
+ found = true;
+ break;
+ }
}
if (found == false) {
SDKManagerInternalAPI.addMissingSdk(oldSdk
@@ -197,6 +203,7 @@
// tell others about it
fireInstalledSdkChanged(SDKChangeEventType.eSDKScanned);
scanCarbideSDKCache();
+ updateCarbideSDKCache();
// Notify any plugins that want to know if the SDKManager has scanned plugins.
if (!sdkHookExtenstionsNotified) {
@@ -231,6 +238,9 @@
protected void ensureScannedSDKs() {
if (!hasScannedSDKs) {
+ // load sdk list from cache during start up, this way we don't have to wait
+ // for sdk scanning job to be completed.
+ loadCarbideSDKCache();
scanSDKs();
}
}
@@ -268,8 +278,8 @@
synchronized(sdkList)
{
try {
+ sdkList.add(sdk);
updateSDK(sdk);
- sdkList.add(sdk);
SDKManagerInternalAPI.removeMissingSdk(sdk.getUniqueId());
// tell others about it
fireInstalledSdkChanged(SDKChangeEventType.eSDKAdded);
@@ -312,6 +322,92 @@
abstract protected boolean doRemoveSDK(String sdkId);
+ protected void loadCarbideSDKCache(){
+ DocumentBuilder docBuilder = null;
+ try {
+ docBuilder = DocumentBuilderFactory.newInstance().newDocumentBuilder();
+ } catch (ParserConfigurationException e) {
+ ResourcesPlugin.getPlugin().getLog().log(new Status(IStatus.ERROR, SDKCorePlugin.PLUGIN_ID, IStatus.ERROR, e.getMessage(), e));
+ throw new RuntimeException(e);
+ }
+
+ try {
+ File carbideSDKCacheFile = getCardbieSDKCacheFile();
+ if (!carbideSDKCacheFile.exists()){
+ try {
+ FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null);
+ } catch (CoreException e){
+ e.printStackTrace();
+ }
+ } else if (carbideSDKCacheFile.length() > 0) {
+ Document lastKnownDoc = docBuilder.parse(carbideSDKCacheFile);
+
+ NodeIterator ni = XPathAPI.selectNodeIterator(lastKnownDoc, "/sdks/sdk");
+ for (Node n = ni.nextNode(); n != null; n = ni.nextNode()) {
+
+ // get the unique ID
+ NamedNodeMap attribs = n.getAttributes();
+ String id = attribs.getNamedItem(SDK_CACHE_ID_ATTRIB).getNodeValue();
+
+ // get whether or not the SDK is enabled
+ String sdkEnabled = "true";
+ Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB);
+ if (sdkEnabledItem != null)
+ sdkEnabled = sdkEnabledItem.getNodeValue();
+
+ // get the os version
+ String osVersion = "";
+ Node osVersionItem = attribs.getNamedItem(SDK_CACHE_OS_VERSION_ATTRIB);
+ if (osVersionItem != null)
+ osVersion = osVersionItem.getNodeValue();
+
+ // get the sdk version
+ String sdkVersion = "";
+ Node sdkVersionItem = attribs.getNamedItem(SDK_CACHE_SDK_VERSION_ATTRIB);
+ if (sdkVersionItem != null)
+ sdkVersion = sdkVersionItem.getNodeValue();
+
+ // get the custom EPOCROOT, if allowed
+ String epocRoot = null;
+ Node epocrootItem = attribs.getNamedItem(SDK_CACHE_EPOCROOT_ATTRIB);
+ if (epocrootItem != null)
+ epocRoot = epocrootItem.getNodeValue();
+
+ // get whether or not this SDK has been scanned
+ String wasScanned = "false";
+ Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS);
+ if (sdkScannedItem != null)
+ wasScanned = sdkScannedItem.getNodeValue();
+
+ ISymbianSDK sdk = SymbianSDKFactory.createInstance(id,
+ epocRoot,
+ ISBSv1BuildInfo.S60_SDK_NAME,
+ new Version(osVersion),
+ new Version(sdkVersion));
+ if (sdkEnabled.equalsIgnoreCase("true")){
+ ((SymbianSDK)sdk).setEnabled(true);
+ } else {
+ ((SymbianSDK)sdk).setEnabled(false);
+ }
+ ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
+ ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
+ if (wasScanned.equalsIgnoreCase("true")){
+ sbsv1BuildInfo.setPreviouslyScanned(true);
+ sbsv2BuildInfo.setPreviouslyScanned(true);
+ } else {
+ sbsv1BuildInfo.setPreviouslyScanned(false);
+ sbsv2BuildInfo.setPreviouslyScanned(false);
+ }
+ synchronized (sdkList) {
+ sdkList.add(sdk);
+ }
+ } // for
+ }
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
protected void scanCarbideSDKCache(){
DocumentBuilder docBuilder = null;
@@ -323,103 +419,94 @@
}
try {
- File carbideSDKCacheFile = new File(System.getProperty("user.home"), CARBIDE_SDK_CACHE_FILE_NAME);
+ File carbideSDKCacheFile = getCardbieSDKCacheFile();
if (!carbideSDKCacheFile.exists()){
try {
FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null);
} catch (CoreException e){
e.printStackTrace();
}
- }else if (carbideSDKCacheFile.length() > 0) {
- Document lastKnownDoc = docBuilder.parse(carbideSDKCacheFile);
-
- NodeIterator ni = XPathAPI.selectNodeIterator(lastKnownDoc, "/sdks/sdk");
- for (Node n = ni.nextNode(); n != null; n = ni.nextNode()) {
-
- // get the unique ID
- NamedNodeMap attribs = n.getAttributes();
- String id = attribs.getNamedItem(SDK_CACHE_ID_ATTRIB).getNodeValue();
-
- // get whether or not the SDK is enabled
- String sdkEnabled = "true";
- Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB);
- if (sdkEnabledItem != null)
- sdkEnabled = sdkEnabledItem.getNodeValue();
+ } else if (carbideSDKCacheFile.length() > 0) {
+ Document lastKnownDoc = docBuilder.parse(carbideSDKCacheFile);
- // get the os version
- String osVersion = "";
- Node osVersionItem = attribs.getNamedItem(SDK_CACHE_OS_VERSION_ATTRIB);
- if (osVersionItem != null)
- osVersion = osVersionItem.getNodeValue();
-
- // get the os branch
- String osBranch = "";
- Node osBranchItem = attribs.getNamedItem(SDK_CACHE_OS_BRANCH_ATTRIB);
- if (osBranchItem != null)
- osBranch = osBranchItem.getNodeValue();
-
- // get the sdk version
- String sdkVersion = "";
- Node sdkVersionItem = attribs.getNamedItem(SDK_CACHE_SDK_VERSION_ATTRIB);
- if (sdkVersionItem != null)
- sdkVersion = sdkVersionItem.getNodeValue();
-
- // get the custom EPOCROOT, if allowed
- String customEpocroot = null;
- if (!isEPOCRootFixed()) {
+ NodeIterator ni = XPathAPI.selectNodeIterator(lastKnownDoc, "/sdks/sdk");
+ for (Node n = ni.nextNode(); n != null; n = ni.nextNode()) {
+
+ // get the unique ID
+ NamedNodeMap attribs = n.getAttributes();
+ String id = attribs.getNamedItem(SDK_CACHE_ID_ATTRIB).getNodeValue();
+
+ // get whether or not the SDK is enabled
+ String sdkEnabled = "true";
+ Node sdkEnabledItem = attribs.getNamedItem(SDK_CACHE_ENABLED_ATTRIB);
+ if (sdkEnabledItem != null)
+ sdkEnabled = sdkEnabledItem.getNodeValue();
+
+ // get the os version
+ String osVersion = "";
+ Node osVersionItem = attribs.getNamedItem(SDK_CACHE_OS_VERSION_ATTRIB);
+ if (osVersionItem != null)
+ osVersion = osVersionItem.getNodeValue();
+
+ // get the sdk version
+ String sdkVersion = "";
+ Node sdkVersionItem = attribs.getNamedItem(SDK_CACHE_SDK_VERSION_ATTRIB);
+ if (sdkVersionItem != null)
+ sdkVersion = sdkVersionItem.getNodeValue();
+
+ // get the custom EPOCROOT
+ String epocRoot = null;
Node epocrootItem = attribs.getNamedItem(SDK_CACHE_EPOCROOT_ATTRIB);
if (epocrootItem != null)
- customEpocroot = epocrootItem.getNodeValue();
- }
-
- // get whether or not this SDK has been scanned
- String wasScanned = "false";
- Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS);
- if (sdkScannedItem != null)
- wasScanned = sdkScannedItem.getNodeValue();
-
- ISymbianSDK sdk = getSDK(id, false);
- if (sdk != null){
-
- if (sdkEnabled.equalsIgnoreCase("true")){
- ((SymbianSDK)sdk).setEnabled(true);
- } else {
- ((SymbianSDK)sdk).setEnabled(false);
- }
+ epocRoot = epocrootItem.getNodeValue();
+
+ // get whether or not this SDK has been scanned
+ String wasScanned = "false";
+ Node sdkScannedItem = attribs.getNamedItem(SDK_SCANNED_FOR_PLUGINS);
+ if (sdkScannedItem != null)
+ wasScanned = sdkScannedItem.getNodeValue();
- if (!osVersion.equals("")){
- if (Version.parseVersion(osVersion).getMajor() != 0){
- ((SymbianSDK)sdk).setOSVersion(Version.parseVersion(osVersion));
+ ISymbianSDK sdk = getSDK(id, false);
+ if (sdk != null){
+
+ if (sdkEnabled.equalsIgnoreCase("true")){
+ ((SymbianSDK)sdk).setEnabled(true);
+ } else {
+ ((SymbianSDK)sdk).setEnabled(false);
+ }
+
+ if (!osVersion.equals("")){
+ if (Version.parseVersion(osVersion).getMajor() != 0){
+ ((SymbianSDK)sdk).setOSVersion(Version.parseVersion(osVersion));
+ }
+ }
+
+ if (epocRoot != null) {
+ ((SymbianSDK)sdk).setEPOCROOT(epocRoot);
+ }
+
+ ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
+ ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
+ if (wasScanned.equalsIgnoreCase("true")){
+ sbsv1BuildInfo.setPreviouslyScanned(true);
+ sbsv2BuildInfo.setPreviouslyScanned(true);
+ } else {
+ sbsv1BuildInfo.setPreviouslyScanned(false);
+ sbsv2BuildInfo.setPreviouslyScanned(false);
+ }
+
+ if (!sdkVersion.equals("")){
+ if (Version.parseVersion(sdkVersion).getMajor() != 0){
+ ((SymbianSDK)sdk).setSDKVersion(Version.parseVersion(sdkVersion));
+ }
}
}
-
- if (customEpocroot != null) {
- ((SymbianSDK)sdk).setEPOCROOT(customEpocroot);
- }
-
- ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
- ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)sdk.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
- if (wasScanned.equalsIgnoreCase("true")){
- sbsv1BuildInfo.setPreviouslyScanned(true);
- sbsv2BuildInfo.setPreviouslyScanned(true);
- } else {
- sbsv1BuildInfo.setPreviouslyScanned(false);
- sbsv2BuildInfo.setPreviouslyScanned(false);
- }
-
- if (!sdkVersion.equals("")){
- if (Version.parseVersion(sdkVersion).getMajor() != 0){
- ((SymbianSDK)sdk).setSDKVersion(Version.parseVersion(sdkVersion));
- }
- }
- }
-
- } // for
- }
- } catch (TransformerException e) {
- } catch (SAXException e) {
- } catch (IOException e) {
- }
+ } // for
+ }
+ } catch (TransformerException e) {
+ } catch (SAXException e) {
+ } catch (IOException e) {
+ }
}
public void updateCarbideSDKCache() {
@@ -434,7 +521,7 @@
return;
}
- File carbideSDKCacheFile = new File(System.getProperty("user.home"), CARBIDE_SDK_CACHE_FILE_NAME);
+ File carbideSDKCacheFile = getCardbieSDKCacheFile();
if (!carbideSDKCacheFile.exists()){
try {
FileUtils.writeFileContents(carbideSDKCacheFile, EMPTY_STRING.toCharArray(), null);
@@ -472,11 +559,9 @@
sdkVerNode.setNodeValue(currSDK.getSDKVersion().toString());
attribs.setNamedItem(sdkVerNode);
- if (!isEPOCRootFixed()) {
- Node sdkEpocRootNode = d.createAttribute(SDK_CACHE_EPOCROOT_ATTRIB);
- sdkEpocRootNode.setNodeValue(currSDK.getEPOCROOT());
- attribs.setNamedItem(sdkEpocRootNode);
- }
+ Node sdkEpocRootNode = d.createAttribute(SDK_CACHE_EPOCROOT_ATTRIB);
+ sdkEpocRootNode.setNodeValue(currSDK.getEPOCROOT());
+ attribs.setNamedItem(sdkEpocRootNode);
ISBSv1BuildInfo sbsv1BuildInfo = (ISBSv1BuildInfo)currSDK.getBuildInfo(ISymbianBuilderID.SBSV1_BUILDER);
ISBSv2BuildInfo sbsv2BuildInfo = (ISBSv2BuildInfo)currSDK.getBuildInfo(ISymbianBuilderID.SBSV2_BUILDER);
@@ -502,6 +587,11 @@
}
}
+ protected File getCardbieSDKCacheFile() {
+ IPath path = new Path(System.getProperty("user.home"));
+ return path.append(CARBIDE_SDK_CACHE_FILE_NAME).toFile();
+ }
+
/**
* Tell whether EPOCROOT can be changed for a given ISymbianSDK
* @return flag
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Mon Jun 14 13:24:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/model/SDKManager.java Tue Jun 15 23:12:37 2010 -0500
@@ -44,6 +44,7 @@
import com.nokia.carbide.cpp.internal.sdk.core.gen.Devices.DevicesType;
import com.nokia.carbide.cpp.internal.sdk.core.xml.DevicesLoader;
import com.nokia.carbide.cpp.sdk.core.ISymbianSDK;
+import com.nokia.carbide.cpp.sdk.core.ISymbianSDKFeatures;
import com.nokia.carbide.cpp.sdk.core.SDKCorePlugin;
import com.nokia.carbide.cpp.sdk.core.SDKEnvInfoFailureException;
import com.nokia.cpp.internal.api.utils.core.HostOS;
@@ -89,19 +90,15 @@
File devicesFile = getDevicesXMLFile();
if (devicesFile == null || !devicesFile.exists()) {
- // There is no devices.xml. Ask the user if he/she wants to
- // add it
- if (hasPromptedForDevicesXML == false) {
- hasPromptedForDevicesXML = true;
- doAsynchPromptCreateDevicesXML();
- }
- result = false; // no devices.xml file..
+ // It's ok if there is no devices.xml.
+ // Raptor based SDKs no longer depends on it.
} else {
devicesXLMLastModified = devicesFile.lastModified();
devicesType = DevicesLoader.loadDevices(devicesFile.toURL());
EList devices = devicesType.getDevice();
for (Iterator iter = devices.iterator(); iter.hasNext();) {
SymbianSDK sdk = new SymbianSDK((DeviceType) iter.next());
+ sdk.addSupportedFeature(ISymbianSDKFeatures.IS_FROM_DEVICES_XML);
sdkList.add(sdk);
}
}
@@ -115,25 +112,27 @@
}
public void updateSDK(ISymbianSDK sdk) {
- try {
- File devicesFile = getDevicesXMLFile();
+ if (((SymbianSDK)sdk).getSupportedFeatures().contains(ISymbianSDKFeatures.IS_FROM_DEVICES_XML)) {
+ try {
+ File devicesFile = getDevicesXMLFile();
- if (devicesFile == null || !devicesFile.exists()) {
- // There is no devices.xml. Ask the user if he/she wants to
- // add it
- doAsynchPromptCreateDevicesXML();
- return;
- }
+ if (devicesFile == null || !devicesFile.exists()) {
+ // There is no devices.xml. Ask the user if he/she wants to
+ // add it
+ doAsynchPromptCreateDevicesXML();
+ return;
+ }
- // If file does not exist exception will catch it
- DevicesLoader.updateDevice(sdk, devicesFile.toURL());
- updateCarbideSDKCache();
-
- } catch (Exception e) {
- // must catch and rethrow as unchecked exception this
- // because no throws clause in API method
- throw new RuntimeException(e);
+ // If file does not exist exception will catch it
+ DevicesLoader.updateDevice(sdk, devicesFile.toURL());
+
+ } catch (Exception e) {
+ // must catch and rethrow as unchecked exception this
+ // because no throws clause in API method
+ throw new RuntimeException(e);
+ }
}
+ updateCarbideSDKCache();
}
protected boolean doRemoveSDK(String sdkId) {
@@ -181,8 +180,8 @@
// registry entry exists, check existence of file
regPath = regPath.append(DEVICES_FILE_NAME);
if (!regPath.toFile().exists()){
- String errMsg = MessageFormat.format("Devices.xml does not exist at: {0}", regPath);
- logError(errMsg, null);
+// String errMsg = MessageFormat.format("Devices.xml does not exist at: {0}", regPath);
+// logError(errMsg, null);
return null;
}
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java Mon Jun 14 13:24:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/internal/sdk/core/xml/DevicesLoader.java Tue Jun 15 23:12:37 2010 -0500
@@ -109,7 +109,8 @@
boolean deviceExists = false;
for (Iterator i = devicesList.iterator(); i.hasNext();) {
DeviceType currDevice = (DeviceType)i.next();
- if (currDevice.getId().equals(sdk.getUniqueId())){
+ if (currDevice.getId().equals(sdk.getUniqueId()) ||
+ currDevice.getEpocroot().toLowerCase().equals(sdk.getEPOCROOT().toLowerCase())){
deviceExists = true;
currDevice.setEpocroot(sdk.getEPOCROOT());
currDevice.setId(sdk.getUniqueId());
--- a/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDKFeatures.java Mon Jun 14 13:24:47 2010 -0500
+++ b/core/com.nokia.carbide.cpp.sdk.core/src/com/nokia/carbide/cpp/sdk/core/ISymbianSDKFeatures.java Tue Jun 15 23:12:37 2010 -0500
@@ -24,5 +24,6 @@
public static final String IS_WINSCW_UREL_SUPPORTED = "isWINSCWURELSupported";
public static final String IS_EKA1 = "isEAK1";
public static final String IS_EKA2 = "isEKA2";
+ public static final String IS_FROM_DEVICES_XML = "isFromDevicesXml";
}