CLI: Change currentWorkspacePath variable and set alias. 36/12736/1
authorhyunsik.noh <hyunsik.noh@samsung.com>
Fri, 22 Nov 2013 02:24:03 +0000 (11:24 +0900)
committerhyunsik.noh <hyunsik.noh@samsung.com>
Fri, 22 Nov 2013 02:24:03 +0000 (11:24 +0900)
Change currentWorkspacePath type from String to File
Set alias "DA" for "Dynamic Analyzer"

Change-Id: I4b93d94cb67e42ab747a55e27836e5c5acca825f
Signed-off-by: hyunsik.noh <hyunsik.noh@samsung.com>
org.tizen.ncli.ide/src/org/tizen/ncli/ide/autocomplete/TizenAutoComplete.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/CreateWebProjectCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildNativeCLICommand.java

index 1858c86..2f048f9 100644 (file)
@@ -75,7 +75,7 @@ public class TizenAutoComplete {
     public enum optionSuggestion {
         architecture(options[1][0], "--arch", "x86 arm"),
         compiler(options[1][0], "--compiler", "llvm gcc"),
-        configuration(options[1][0], "--configuration", "Debug Release Dynamic Analyzer"),
+        configuration(options[1][0], "--configuration", "Debug Release DA"),
         template("-t");
 
         private String mainCmd;
index c270a3b..f11666c 100644 (file)
@@ -43,7 +43,7 @@ public abstract class AbstractCLI {
     public File workingDir;
 
     @Option(hidden=true,name = "--current-workspace-path", metaVar = "current workspace path", usage = "Specify where is the root path for the command as a default")
-    public String currentWorkspacePath;
+    public File currentWorkspacePath;
 
     protected PrintWriter output = new PrintWriter(System.out);;
 
index 5cab5f6..91e0c9d 100644 (file)
@@ -36,17 +36,20 @@ import org.tizen.ncli.ide.subcommands.BuildNativeCLICommand;
 public class BuildNativeCLI extends AbstractCLI {\r
     private Logger log = LoggerFactory.getLogger(getClass());\r
 \r
-    @Option(name = "--arch", depends="--compiler", metaVar = "x86 | arm", usage = "architecture type")\r
+    @Option(name = "--arch", depends="--compiler", metaVar = "x86 | arm", usage = "Architecture for build result")\r
     private String architecture;\r
 \r
-    @Option(name = "--compiler", depends="--arch", metaVar = "gcc | llvm", usage = "compiler type")\r
+    @Option(name = "--compiler", depends="--arch", metaVar = "gcc | llvm", usage = "Compiler for build result")\r
     private String compiler;\r
 \r
-    @Option(name = "--configuration", metaVar = "Debug | Release | Dynamic Analyzer", usage = "")\r
+    @Option(name = "--configuration", metaVar = "Debug | Release | DA", usage = "Configuration for build result")\r
     private String configuration;\r
 \r
     @Option(name = "--predefine-option", usage = "")\r
     private String predefineOption;\r
+    \r
+    private static final String DA = "DA";\r
+    private static final String DA_ORIGIN = "Dynamic Analyzer";\r
 \r
     /*\r
      * (non-Javadoc)\r
@@ -59,11 +62,10 @@ public class BuildNativeCLI extends AbstractCLI {
 \r
         BuildNativeCLICommand command = new BuildNativeCLICommand();\r
 \r
-        command.setWorkingDir(workingDir);\r
-        command.setCurrentWorkspacePath(currentWorkspacePath);\r
+        command.setWorkingDir(workingDir == null ? currentWorkspacePath : workingDir);\r
         command.setArchitecture(architecture);\r
         command.setCompiler(compiler);\r
-        command.setConfiguration(configuration);\r
+        command.setConfiguration(DA.equals(configuration) ? DA_ORIGIN : configuration);\r
         command.setPredefineOption(predefineOption);\r
 \r
         BuildNative runCommand = command.runCommand();\r
index 4e5fe19..8d8d195 100644 (file)
@@ -35,7 +35,7 @@ public class BuildWebCLI extends AbstractCLI {
         BuildWebCLICommand command = new BuildWebCLICommand();\r
         \r
         if( null == workingDir && null != currentWorkspacePath) {\r
-            workingDir = new File(currentWorkspacePath);\r
+            workingDir = currentWorkspacePath;\r
         }else {\r
             workingDir = cwd;\r
         }\r
index 927ffee..3ca93f1 100644 (file)
@@ -72,19 +72,13 @@ public class CreateWebProjectCLI extends AbstractCLI
             webCommand.setProjectName(projectName);
 
         // set output directory
-        if (workingDir != null)
+        try
         {
-            try
-            {
-                webCommand.setOutputName(workingDir.getCanonicalPath());
-            } catch (IOException e)
-            {
-                logger.error(e.getMessage());
-            }
-        }
-        else
+            File outputDirectory = (workingDir != null ? workingDir : currentWorkspacePath);
+            webCommand.setOutputName(outputDirectory.getCanonicalPath());
+        } catch (IOException e)
         {
-            webCommand.setOutputName(currentWorkspacePath);
+            logger.error(e.getMessage());
         }
 
         webCommand.runCommand();
index 1748e6e..1294798 100644 (file)
@@ -34,7 +34,6 @@ import org.tizen.common.config.provider.SystemPropertiesProvider;
 import org.tizen.ncli.ide.CLIConstant;\r
 import org.tizen.ncli.ide.core.config.NCLIConfigLoader;\r
 import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;\r
-import org.tizen.ncli.ide.exec.NewCommandLineExecutor;\r
 \r
 /**\r
  * This class provides common environment to other SubCommand.\r
@@ -52,12 +51,6 @@ abstract public class AbstractSubCommand<T> {
                this.workingDir = targetPath;\r
        }\r
 \r
-    protected String currentWorkspacePath;\r
-\r
-    public void setCurrentWorkspacePath(String currentWorkspacePath) {\r
-        this.currentWorkspacePath = currentWorkspacePath;\r
-    }\r
-\r
     /**\r
      * This method is called by CLI entry class.\r
      * <p>\r
index abfed7a..1a6a869 100644 (file)
@@ -46,9 +46,9 @@ public class BuildNativeCLICommand extends AbstractSubCommand<BuildNative> {
     private String buildPath = null;
     private String dataPath = null;
     
-    private String toolchainId = null;
-    private String platformId = null;
-    private String targetId = null;
+    public String toolchainId = null;
+    public String platformId = null;
+    public String targetId = null;
     
     private String HEADLESS_CMD = "%s/eclipse -nosplash --launcher.suppressErrors -application org.eclipse.cdt.managedbuilder.core.headlessbuild "
             + "-import %s "
@@ -161,11 +161,10 @@ public class BuildNativeCLICommand extends AbstractSubCommand<BuildNative> {
         sbi = SmartBuildInterface.getInstance();
 
         idePath = InstallPathConfig.getSDKPath() + File.separatorChar + "ide";
-
-        if (workingDir == null) {
-            importPath = currentWorkspacePath;
-        } else {
-            importPath = workingDir.getAbsolutePath();
+        try {
+            importPath = workingDir.getCanonicalPath();
+        } catch (IOException e) {
+            e.printStackTrace();
         }
         
         if(!isVaildImportPathAndConfiguration(importPath, configuration)) {