[Title] Fixed bug for comparing GBS version
authordonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 8 Feb 2013 06:20:01 +0000 (15:20 +0900)
committerdonghyuk.yang <donghyuk.yang@samsung.com>
Fri, 8 Feb 2013 06:20:01 +0000 (15:20 +0900)
org.tizen.nativeplatform/src/org/tizen/nativeplatform/build/ui/GBSBuildConfigurationTab.java
org.tizen.nativeplatform/src/org/tizen/nativeplatform/gbs/GBSOptionManager.java

index 27afc56..51ff10c 100644 (file)
@@ -201,7 +201,7 @@ public class GBSBuildConfigurationTab extends AbstractCBuildPropertyTab {
                composite.setLayoutData(gd);
                
                Label errorLabel = new Label(composite, SWT.NONE);
-               errorLabel.setText(String.format(ERROR_LABEL, GBSOptionManager.CURRENT_GBS_VERSION));
+               errorLabel.setText(String.format(ERROR_LABEL, Double.toString(GBSOptionManager.MIN_GBS_VERSION)));
        }
        
        private void createCcacheOption(Composite parent, int index) {
index 1fe254b..545c766 100644 (file)
@@ -34,7 +34,7 @@ import org.tizen.nativeplatform.util.CommandLauncher;
 public class GBSOptionManager {
        private static ArrayList<GBSOption> options = new ArrayList<GBSOption>();
        private static boolean initialized = false;
-       public static String CURRENT_GBS_VERSION = "0.12";
+       public static double MIN_GBS_VERSION = 0.12;
        
        public static void addOption(GBSOption op) {
                options.add(op);
@@ -67,7 +67,16 @@ public class GBSOptionManager {
                                return false;
                        }
                        String result = CommandLauncher.executeOutput("gbs --version", null, true, null);
-                       if ( !result.contains(CURRENT_GBS_VERSION) ) {
+                       
+                       // result format : gbs [version]
+                       String[] results = result.trim().split(" ");
+                       if (results.length != 2) {
+                               return false;
+                       }
+                       String command = results[0];
+                       double ver = Double.parseDouble(results[1]);            
+                       
+                       if ( !command.equals("gbs") || ver < MIN_GBS_VERSION) {
                                return false;
                        }