package version up (2.1.108), Refined InstallPathConfig to lookup sdk.info file up... 70/11270/1
authorkh5325.kim <kh5325.kim@samsung.com>
Wed, 23 Oct 2013 11:07:59 +0000 (20:07 +0900)
committerkh5325.kim <kh5325.kim@samsung.com>
Wed, 23 Oct 2013 11:07:59 +0000 (20:07 +0900)
Change-Id: I64937136b4a4f044133b839963464e1f5ebff977
Signed-off-by: kh5325.kim <kh5325.kim@samsung.com>
org.tizen.common/src/org/tizen/common/core/application/InstallPathConfig.java
org.tizen.common/src/org/tizen/common/core/application/tproject/TprojectHandler.java
package/changelog
package/pkginfo.manifest

index cb86b7b..accd523 100755 (executable)
@@ -95,7 +95,13 @@ final public class InstallPathConfig {
     static {
         DIR_PLATFORMS_VER = "tizen" + DIR_PLATFORMS_VER_NUM;
 
-        loadSdkPath();
+        try {
+            loadSdkPath();
+        } catch (Exception e) {
+            String msg = "Failed to load sdk path";
+            logger.error("Failed to load sdk path", e);
+            System.err.println(msg + ": " + e.getMessage());
+        }
     }
 
     /**
@@ -296,7 +302,7 @@ final public class InstallPathConfig {
         ProfileInfo latestProfileInfo = getLatestProfileInfo();
         return latestProfileInfo == null ? "" : latestProfileInfo.getLatestPlatformName();
     }
-    
+
     /**
      * Returns platforms directory or null.
      */
@@ -355,7 +361,7 @@ final public class InstallPathConfig {
     public static String getSnippetsPath() {
         return getPlatformVersionPath() + File.separator + DIR_SNIPPETS;
     }
-    
+
     /**
      * Returns a snippets path that is installed under the given profile and version.<br>
      * If this method cannot find the sample path, returns null.
@@ -379,7 +385,7 @@ final public class InstallPathConfig {
     public static String getOnDemandPath() {
         return getPlatformVersionPath() + File.separator + DIR_ON_DEMAND;
     }
-    
+
     /**
      * Returns a on-demand path that is installed under the given profile and version.<br>
      * If this method cannot find the sample path, returns null.
@@ -478,33 +484,38 @@ final public class InstallPathConfig {
             prop.load(is);
             sdkInstallPath = prop.getProperty(SDK_INFO_FILE_KEY_INSTALLED_PATH);
             sdkDataPath = prop.getProperty(SDK_INFO_FILE_KEY_DATA_PATH);
-            logger.info(String.format("Loaded (install_path - %s, data_path - %s)", sdkInstallPath, sdkDataPath));
+            logger.info(String.format("Loaded (install_path - %s, data_path - %s, sdk.info - %s)", sdkInstallPath, sdkDataPath, sdkInfoFile));
         } finally {
             IOUtil.tryClose(is);
         }
     }
 
-    private static void loadSdkPath() {
+    private static void lookupSdkInfoFile(String path) {
+        String sdkPath = new File(path).getParent();
+        while (sdkPath != null) {
+            try {
+                parseSdkInfoFile(sdkPath);
+                break;
+            } catch (FileNotFoundException e) {
+                // to find sdk.info up-through
+                logger.error("Failed to find: " + e.getMessage());
+                sdkPath = new File(sdkPath).getParent();
+            } catch (Exception e) {
+                logger.error("Failed to load from " + sdkPath, e);
+            }
+        }
+    }
+
+    private static void loadSdkPath() throws Exception {
         try {
             String eclipsePath = org.eclipse.core.runtime.Platform.getInstallLocation().getURL().getPath();
-            String sdkPath = new File(eclipsePath).getParent();
             // to load from <eclipse>/../sdk.info
-            parseSdkInfoFile(sdkPath);
+            // if failed, to find sdk.info up-through
+            lookupSdkInfoFile(eclipsePath);
         } catch (NoClassDefFoundError ncdfe) {
             // in case of CLI, java.lang.NoClassDefFoundError: org/eclipse/core/runtime/Platform
             String path = InstallPathConfig.class.getProtectionDomain().getCodeSource().getLocation().getPath();
-            String sdkPath = new File(path).getParent();
-            while (sdkPath != null) {
-                try {
-                    parseSdkInfoFile(sdkPath);
-                    break;
-                } catch (FileNotFoundException e) {
-                    // to find sdk.info up-through
-                    sdkPath = new File(sdkPath).getParent();
-                } catch (Exception e) {
-                    logger.error("Failed to load from " + sdkPath, e);
-                }
-            }
+            lookupSdkInfoFile(path);
         } catch (Throwable t) {
             logger.error("Failed to load from " + SDK_INFO_FILE, t);
         } finally {
@@ -515,15 +526,14 @@ final public class InstallPathConfig {
         }
     }
 
-    private static void loadSdkPathFromDefault() {
+    private static void loadSdkPathFromDefault() throws Exception {
         // FIXME : don't need the following lines if using environment variable
         if (OSChecker.isWindows()) {
             defaultHomePath = getRegistryValue(REGISTRY_PATH_OF_SHELL_FOLDER, REGISTRY_LOCAL_APP_DATA_OF_SHELL_FOLDER) ;
         } else if (OSChecker.isLinux() == true || OSChecker.isUnix() == true || OSChecker.isMAC() == true) {
             defaultHomePath = System.getProperty("user.home");
         } else {
-            DialogUtil.openMessageDialog(System.getProperty("os.name") + " is not supported currently.");
-            System.exit(0);
+            throw new Exception(System.getProperty("os.name") + " is not supported currently.");
         }
 
         String sdkPath = defaultHomePath + File.separatorChar + SDKSUFFIX;
@@ -545,8 +555,12 @@ final public class InstallPathConfig {
         }
 
         if (!status) {
-            DialogUtil.openMessageDialog("Tizen SDK is not installed properly.");
-            System.exit(0);
+            try {
+                DialogUtil.openMessageDialog("Tizen SDK is not installed properly.");
+            } catch (Exception e) {
+                logger.error("Failed to open a dialog", e);
+            }
+            throw new Exception("Tizen SDK is not installed properly.");
         }
     }
 
index 34c0111..d9d83bb 100644 (file)
@@ -92,7 +92,7 @@ public class TprojectHandler {
         
         File file = project.getFile(FILE_NAME).getLocation().toFile();
         if ( !file.exists() ) {
-            logger.error("File does not exist. Check the file path. (project: %s, file: %s)", project, file);
+            logger.error(String.format("File does not exist. Check the file path. (project: %s, file: %s)", project, file));
             return null;
         }
         
@@ -135,5 +135,4 @@ public class TprojectHandler {
         
         return tProject;
     }
-
 }
index a84db97..bd026fc 100644 (file)
@@ -1,3 +1,7 @@
+* 2.1.108
+- Refined InstallPathConfig to lookup sdk.info file up-through
+- Fixed a clean build exception
+== kh5325.kim <kh5325.kim@samsung.com> 2013-10-23
 * 2.1.107
 - Modify sikuli test environment
 == bonyong.lee <bonyong.lee@samsung.com> 2013-10-22 11:42
index 505a249..97672d7 100644 (file)
@@ -1,4 +1,4 @@
-Version:2.1.107
+Version:2.1.108
 Source:common-eplugin
 Maintainer:kangho kim <kh5325.kim@samsung.com>, yoonki park <yoonki.park@samsung.com>, hyunsik non <hyunsik.noh@samsung.com>, taeyoung son <taeyoung2.son@samsung.com>, gune Kim <gune.kim@samsung.com>, ho namkoong <ho.namkoong@samsung.com>, hyeongseok heo <hyeong-seok.heo@samsung.com>, gyeongseok seo <gyeongseok.seo@samsung.com>, jihoon song <jihoon80.song@samsung.com>, changhyun lee <changhyun1.lee@samsung.com>, bonyong lee <bonyong.lee@samsung.com>, shingil kang <shingil.kang@samsung.com>