CLI : Apply pregress monitor , log for progress 41/13241/4
authorHeongseok Heo <hyeongseok.heo@samsung.com>
Sat, 30 Nov 2013 07:15:20 +0000 (16:15 +0900)
committerhyeongseok.heo <hyeongseok.heo@samsung.com>
Wed, 4 Dec 2013 02:53:39 +0000 (11:53 +0900)
Apply progress monitor and log4j for progress log

Modify build script and install script

Change-Id: I5b4ba7f988d656e0217f971e212d61d0ca6aef9b
Signed-off-by: Heongseok Heo <hyeongseok.heo@samsung.com>
22 files changed:
org.tizen.ncli.ide/resources/log4j-debug.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j-error.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j-info.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j-progress.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j-trace.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j-warn.xml [new file with mode: 0644]
org.tizen.ncli.ide/resources/log4j.xml [new file with mode: 0644]
org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java
org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.properties
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/ListCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java
org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java
org.tizen.ncli.ide/tizen.sh
package/build.linux
package/new-cli.install.linux

diff --git a/org.tizen.ncli.ide/resources/log4j-debug.xml b/org.tizen.ncli.ide/resources/log4j-debug.xml
new file mode 100644 (file)
index 0000000..625523d
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="debug" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j-error.xml b/org.tizen.ncli.ide/resources/log4j-error.xml
new file mode 100644 (file)
index 0000000..50905c9
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="error" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j-info.xml b/org.tizen.ncli.ide/resources/log4j-info.xml
new file mode 100644 (file)
index 0000000..c1d5f9e
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="info" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j-progress.xml b/org.tizen.ncli.ide/resources/log4j-progress.xml
new file mode 100644 (file)
index 0000000..5e86100
--- /dev/null
@@ -0,0 +1,46 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       <appender name="file-appender" class="org.apache.log4j.FileAppender">
+        <param name="File" value=CLI_LOG_FILE />
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%d{ISO8601} [%p] %F(%L) - %m%n" />
+        </layout>
+    </appender>
+       <appender name="progress-console" class="org.apache.log4j.ConsoleAppender">
+        <param name="Target" value="System.out" />
+        <layout class="org.apache.log4j.PatternLayout">
+            <param name="ConversionPattern" value="%m%n" />
+        </layout>
+    </appender>
+    
+    <appender name="null" class="org.apache.log4j.varia.NullAppender">
+    </appender>
+       
+       <logger name="NCLI_PROGRESS">
+          <level value="info"/>
+          <appender-ref ref="progress-console" />
+       </logger>
+       
+       <logger name="org.tizen.ncli.ide">
+          <level value="trace"/>
+       <appender-ref ref="file-appender" />
+       </logger>
+       
+       <logger name="org.tizen.core.ide">
+       <level value="off"/>
+       <appender-ref ref="file-appender" />
+    </logger>
+       
+       
+       <root>
+               <priority value="off" />
+               <appender-ref ref="null" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j-trace.xml b/org.tizen.ncli.ide/resources/log4j-trace.xml
new file mode 100644 (file)
index 0000000..61298ea
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="trace" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j-warn.xml b/org.tizen.ncli.ide/resources/log4j-warn.xml
new file mode 100644 (file)
index 0000000..b984f69
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="warn" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
diff --git a/org.tizen.ncli.ide/resources/log4j.xml b/org.tizen.ncli.ide/resources/log4j.xml
new file mode 100644 (file)
index 0000000..328d165
--- /dev/null
@@ -0,0 +1,15 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE log4j:configuration PUBLIC "-//APACHE//DTD LOG4J 1.2//EN" "log4j.dtd">
+<log4j:configuration xmlns:log4j="http://jakarta.apache.org/log4j/">
+       <appender name="console" class="org.apache.log4j.ConsoleAppender">
+               <param name="Target" value="System.out" />
+               <layout class="org.apache.log4j.PatternLayout">
+                       <param name="ConversionPattern" value="[%p] %F(%L) - %m%n" />
+               </layout>
+       </appender>
+       
+       <root>
+               <priority value="off" />
+               <appender-ref ref="console" />
+       </root>
+</log4j:configuration>
index b08536f..d34cb50 100644 (file)
@@ -53,29 +53,44 @@ import org.tizen.web.builder.JSMinifyBuilder;
 import org.tizen.web.builder.UIFWBuilder;
 
 /**
- * This class has a main role of build web application.
- * <p>
- * This class make out build result by parameters for build.<br>
- * Independent with IDE or CLI
+ * This class collect and modify resources to be packaged and then make out
+ * build output directory </br> c.f. default name is <code>.buildResult</code><br>
  * 
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)
- * 
- * 
  */
 public class BuildWebAppModule {
     private Logger log = LoggerFactory.getLogger(getClass());
+
     private BuildWebParameter data;
     private String cwd;
     private String output = ".buildResult";
     private SimpleFileFilter filter = new SimpleFileFilter(true);
     public FactoryWithArgument<Filter, String> filterFactory = new WildCardFilterFactory();
     public List<String> excludes = new ArrayList<String>();
-    private String[] DEFAULT_EXCLUDES = { ".build/*", ".project", ".settings/*", ".sdk_delta.info", "*.wgt" };
+    private String[] DEFAULT_EXCLUDES = { ".build/*", ".project",
+            ".settings/*", ".sdk_delta.info", "*.wgt" };
+    private ProgressMonitor monitor = new NullProgressMonitor();
+
+    private boolean force = false;
+    
+    private static final String BUILD_WEB_TASK = "Build Web Application";
 
     public BuildWebAppModule() {
         // TODO Auto-generated constructor stub
     }
 
+    public BuildWebAppModule(BuildWebParameter data, String cwd, String output,
+            SimpleFileFilter filter,
+            FactoryWithArgument<Filter, String> filterFactory,
+            List<String> excludes) {
+        this.data = data;
+        this.cwd = cwd;
+        this.output = output;
+        this.filter = filter;
+        this.filterFactory = filterFactory;
+        this.excludes = excludes;
+    }
+
     /**
      * @param cwd
      *            the cwd to set
@@ -92,20 +107,20 @@ public class BuildWebAppModule {
         this.data = data;
     }
 
-    public BuildWebAppModule(BuildWebParameter data, String cwd, String output, SimpleFileFilter filter,
-            FactoryWithArgument<Filter, String> filterFactory, List<String> excludes) {
-        this.data = data;
-        this.cwd = cwd;
-        this.output = output;
-        this.filter = filter;
-        this.filterFactory = filterFactory;
-        this.excludes = excludes;
+    /**
+     * @param monitor
+     *            the monitor to set
+     */
+    public void setMonitor(ProgressMonitor monitor) {
+        this.monitor = monitor;
     }
 
     public void buildResources() throws IOException, BuildException, Exception {
         BuildProcess buildProcess = new BuildProcess();
-
-        if (isPrerequisiteSatisfy()) {
+        
+        monitor.beginTask(BUILD_WEB_TASK,10);
+        checkPrerequisit(force );
+            
             // Set output
             if (null != data && null != data.getOutputName()) {
                 this.output = cwd + File.separator + data.getOutputName();
@@ -114,15 +129,16 @@ public class BuildWebAppModule {
             }
             // If output path exist, the path will be recreated.
             deleteOutput();
+            
             // Set default exclude resources
             addDefaultExclude();
-
+            monitor.update(1);
             // Set start layer
             FileHandler fh = new StandardFileHandler();
             fh.setCurrentWorkingDirectory(cwd);
-            ResourceLayer startLayer = new ResourceLayer("Initial Resource Layer", fh);
+            ResourceLayer startLayer = new ResourceLayer(
+                    "Initial Resource Layer", fh);
 
-            log.debug("=== OUTPUT === {}", this.output);
             // Get resource list for build
             Resource[] resources = null;
             resources = getBuildResources(startLayer);
@@ -133,17 +149,27 @@ public class BuildWebAppModule {
             }
 
             generateAllBuilders(buildProcess, startLayer);
-
             if (buildProcess.getLastBuilder() != null) {
                 log.debug("start build process");
+                monitor.update(1);
                 buildProcess.build(resources);
-
+                monitor.update(2);
                 // check succeeding status.
                 checkHybridStructure(buildProcess);
             }
-        } else {
-            throw new BuildException(null);
+            monitor.endTask();
+    }
+
+    private void checkPrerequisit(boolean force) throws BuildException {
+        if ( null != cwd && !"".equals(cwd.trim()) ) {
+            log.trace("Exist config.xml? {}", FileUtil.isExist(cwd+"/config.xml"));
+            if ( !force && !FileUtil.isExist(cwd+"/config.xml")) {
+                throw new BuildException(new Exception("config.xml is not exist!"));
+            }
+        }else {
+            throw new BuildException(new Exception("Current working directory should be set!"));
         }
+        
     }
 
     private void deleteOutput() {
@@ -163,35 +189,45 @@ public class BuildWebAppModule {
     }
 
     /**
-     * Check pre-requisite for executing build
-     * 
+     * Check pre-requisite for executing build.
+     * <li>Current work directory</li>
+     * <li>Existing config.xml</li>
      * @return
      */
     private boolean isPrerequisiteSatisfy() {
-        return null != cwd && !"".equals(cwd.trim());
+        boolean ret = null != cwd && !"".equals(cwd.trim());
+        if(ret) {
+            log.trace("Exist config.xml? {}", FileUtil.isExist(cwd+"/config.xml"));
+            ret = FileUtil.isExist(cwd+"/config.xml");
+        }
+        return ret;
     }
 
     /**
      * get resource list
      * 
      * @param cwd
-     *            root path located resources. It means working path. means current path.
+     *            root path located resources. It means working path. means
+     *            current path.
      * @param relativeSrcDir
      *            relative directory including resources.
      * @param layer
      *            {@link ResourceLayer} about resource
      * @throws IOException
      */
-    private List<Resource> getResources(String cwd, String relativeSrcDir, ResourceLayer layer) throws IOException {
+    private List<Resource> getResources(String cwd, String relativeSrcDir,
+            ResourceLayer layer) throws IOException {
         List<Resource> resources = new ArrayList<Resource>();
         List<File> files = null;
         String absoluteDir = cwd + File.separator + relativeSrcDir;
         files = FileUtil.findFiles(new File(absoluteDir), ".*", true);
-
+        
         for (File file : files) {
-            String fileRelativePath = FilenameUtil.getRelativePath(cwd, file.getCanonicalPath());
+            String fileRelativePath = FilenameUtil.getRelativePath(cwd,
+                    file.getCanonicalPath());
 
-            if (!FilenameUtil.equals(file.getCanonicalPath(), this.cwd) && !this.filter.accept(cwd, fileRelativePath)) {
+            if (!FilenameUtil.equals(file.getCanonicalPath(), this.cwd)
+                    && !this.filter.accept(cwd, fileRelativePath)) {
                 log.debug("Ignore {}", fileRelativePath);
                 continue;
             }
@@ -211,30 +247,38 @@ public class BuildWebAppModule {
      * @param layer
      *            parent layer
      * @param includes
-     *            Include resource list. If you want to add all resources located in input path, set this parameter to
-     *            null. If you set this parameter, another resources will not be added to list.
+     *            Include resource list. If you want to add all resources
+     *            located in input path, set this parameter to null. If you set
+     *            this parameter, another resources will not be added to list.
      * @param data
-     *            .excludes Exclude resource list. If you want to exclude resources, set this parameter using regular
-     *            expression. It should be set regular expression about file element.
+     *            .excludes Exclude resource list. If you want to exclude
+     *            resources, set this parameter using regular expression. It
+     *            should be set regular expression about file element.
      * @return
      * @throws IOException
      */
-    private Resource[] getBuildResources(ResourceLayer layer) throws IOException {
+    private Resource[] getBuildResources(ResourceLayer layer)
+            throws IOException {
         List<Resource> resources = new ArrayList<Resource>();
         // setIncludes(includes);
         setExcludes(data.getExcludeList());
         log.trace("CWD:{}", cwd);
         String cwd = layer.getFileHandler().getCurrentWorkingDirectory();
-        resources.addAll(getResources(cwd, FilenameUtil.getRelativePath(cwd, cwd), layer));
-
+        monitor.update(1);
+        resources.addAll(getResources(cwd,
+                FilenameUtil.getRelativePath(cwd, cwd), layer));
+        monitor.update(2);
         // reference project
         /*
-         * if (cmdLine.hasOption(OPT_NAME_REFERENCE_PROJECT)) { FileHandler refFh = new StandardFileHandler();
-         * ResourceLayer referenceLayer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_REFERENCE_NAME , refFh);
-         * layer.setParent(referenceLayer); String refPath =
-         * convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT)); refFh.setCurrentWorkingDirectory(refPath);
+         * if (cmdLine.hasOption(OPT_NAME_REFERENCE_PROJECT)) { FileHandler
+         * refFh = new StandardFileHandler(); ResourceLayer referenceLayer = new
+         * ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_REFERENCE_NAME ,
+         * refFh); layer.setParent(referenceLayer); String refPath =
+         * convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));
+         * refFh.setCurrentWorkingDirectory(refPath);
          * 
-         * resources.addAll(getResources(refPath , FilenameUtil.getRelativePath(refPath, refPath) , referenceLayer)); }
+         * resources.addAll(getResources(refPath ,
+         * FilenameUtil.getRelativePath(refPath, refPath) , referenceLayer)); }
          */
 
         return resources.toArray(new Resource[resources.size()]);
@@ -247,20 +291,28 @@ public class BuildWebAppModule {
      * @param parentLayer
      * @throws IOException
      */
-    public void generateAllBuilders(BuildProcess buildProcess, ResourceLayer parentLayer) throws IOException {
-
+    public void generateAllBuilders(BuildProcess buildProcess,
+            ResourceLayer parentLayer) throws IOException {
         FileHandler fh = new VirtualFileHandler();
-        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());
+        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler()
+                .getCurrentWorkingDirectory());
         if (null != this.data && this.data.isExcludeUIFW()) {
-            addUIFWBuilder(true, true, buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+            addUIFWBuilder(true, true, buildProcess,
+                    getLastResourceLayer(buildProcess, parentLayer), fh);
         }
+        monitor.update(1);
         if (null != this.data && this.data.hasReference()) {
-            addHybridBuilder(buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+            addHybridBuilder(buildProcess,
+                    getLastResourceLayer(buildProcess, parentLayer), fh);
         }
+        monitor.update(1);
         if (null != this.data && this.data.isOptimize()) {
-            addOptimizingBuilders(buildProcess, getLastResourceLayer(buildProcess, parentLayer), fh);
+            addOptimizingBuilders(buildProcess,
+                    getLastResourceLayer(buildProcess, parentLayer), fh);
         }
-        addLastbuilder(buildProcess, getLastResourceLayer(buildProcess, parentLayer));
+        addLastbuilder(buildProcess,
+                getLastResourceLayer(buildProcess, parentLayer));
+        monitor.update(1);
     }
 
     /**
@@ -269,37 +321,44 @@ public class BuildWebAppModule {
      * @param buildProcess
      * @param parentLayer
      */
-    private void addOptimizingBuilders(BuildProcess buildProcess, ResourceLayer parentLayer, FileHandler fh) {
+    private void addOptimizingBuilders(BuildProcess buildProcess,
+            ResourceLayer parentLayer, FileHandler fh) {
         if (buildProcess == null) {
             return;
         }
 
         // add js minify builder
-        ResourceLayer jsMinLayer = new ResourceLayer(JSMinifyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+        ResourceLayer jsMinLayer = new ResourceLayer(
+                JSMinifyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
         JSMinifyBuilder jsMin = new JSMinifyBuilder(jsMinLayer);
         buildProcess.addBuilder(jsMin);
 
         // add css minify builder
-        ResourceLayer cssMinLayer = new ResourceLayer(CssMinifyBuilder.RESOURCE_LAYER_NAME, jsMinLayer, fh);
+        ResourceLayer cssMinLayer = new ResourceLayer(
+                CssMinifyBuilder.RESOURCE_LAYER_NAME, jsMinLayer, fh);
         CssMinifyBuilder cssMin = new CssMinifyBuilder(cssMinLayer);
         buildProcess.addBuilder(cssMin);
     }
 
     /**
-     * Add hybrid builder to buildProcess. It will be used to build including reference project.
+     * Add hybrid builder to buildProcess. It will be used to build including
+     * reference project.
      * 
      * @param cmdLine
      * @param buildProcess
      * @param lastLayer
      * @throws IOException
      */
-    private void addHybridBuilder(BuildProcess buildProcess, ResourceLayer lastLayer, FileHandler fh)
-            throws IOException {
-        ResourceLayer layer = new ResourceLayer(HybridAppCLIBuilder.RESOURCE_LAYER_NAME, lastLayer, fh);
+    private void addHybridBuilder(BuildProcess buildProcess,
+            ResourceLayer lastLayer, FileHandler fh) throws IOException {
+        ResourceLayer layer = new ResourceLayer(
+                HybridAppCLIBuilder.RESOURCE_LAYER_NAME, lastLayer, fh);
 
-        String refPath = ""; // TODO add HybridOption! convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));
+        String refPath = ""; // TODO add HybridOption!
+                             // convertPath(cmdLine.getOptionValue(OPT_NAME_REFERENCE_PROJECT));
 
-        HybridAppCLIBuilder hybridAppBuilder = new HybridAppCLIBuilder(layer, refPath);
+        HybridAppCLIBuilder hybridAppBuilder = new HybridAppCLIBuilder(layer,
+                refPath);
         buildProcess.addBuilder(hybridAppBuilder);
     }
 
@@ -310,7 +369,8 @@ public class BuildWebAppModule {
      * @param defaultLayer
      * @return
      */
-    private ResourceLayer getLastResourceLayer(BuildProcess buildProcess, ResourceLayer defaultLayer) {
+    private ResourceLayer getLastResourceLayer(BuildProcess buildProcess,
+            ResourceLayer defaultLayer) {
         ResourceLayer lastLayer = buildProcess.getLastResourceLayer();
         return (lastLayer != null) ? lastLayer : defaultLayer;
     }
@@ -319,18 +379,21 @@ public class BuildWebAppModule {
      * Add UI framework builder to buildProcess.
      * 
      * @param isExclude
-     *            If set true, Tizen web UI framework library will be excluded output path. Application will use
-     *            target's Tizen web UI framework library.
-     * @param useMin
-     *            If 'isExclude' parameter set true and this parameter set true, application will be used target's
-     *            minified Tizen web UI framework library. Or, application will be used target's original Tizen web UI
+     *            If set true, Tizen web UI framework library will be excluded
+     *            output path. Application will use target's Tizen web UI
      *            framework library.
+     * @param useMin
+     *            If 'isExclude' parameter set true and this parameter set true,
+     *            application will be used target's minified Tizen web UI
+     *            framework library. Or, application will be used target's
+     *            original Tizen web UI framework library.
      * @param buildProcess
      * @param parentLayer
      */
-    private void addUIFWBuilder(boolean isExclude, boolean useMin, BuildProcess buildProcess,
-            ResourceLayer parentLayer, FileHandler fh) {
-        ResourceLayer layer = new ResourceLayer(UIFWBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+    private void addUIFWBuilder(boolean isExclude, boolean useMin,
+            BuildProcess buildProcess, ResourceLayer parentLayer, FileHandler fh) {
+        ResourceLayer layer = new ResourceLayer(
+                UIFWBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
         UIFWBuilder uifwBuilder = new UIFWBuilder(isExclude, layer);
         uifwBuilder.setUseMin(useMin);
 
@@ -343,39 +406,50 @@ public class BuildWebAppModule {
      * @param buildProcess
      * @param parentLayer
      */
-    private void addLastbuilder(BuildProcess buildProcess, ResourceLayer parentLayer) {
+    private void addLastbuilder(BuildProcess buildProcess,
+            ResourceLayer parentLayer) {
         // add file output builder
         FileHandler fh = new StandardFileHandler();
-        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler().getCurrentWorkingDirectory());
-        ResourceLayer toFSLayer = new ResourceLayer(CopyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
-        CopyBuilder toFSBuilder = new CopyBuilder(FilenameUtil.getRelativePath(this.cwd, this.output), toFSLayer);
+        fh.setCurrentWorkingDirectory(parentLayer.getFileHandler()
+                .getCurrentWorkingDirectory());
+        ResourceLayer toFSLayer = new ResourceLayer(
+                CopyBuilder.RESOURCE_LAYER_NAME, parentLayer, fh);
+        CopyBuilder toFSBuilder = new CopyBuilder(FilenameUtil.getRelativePath(
+                this.cwd, this.output), toFSLayer);
         buildProcess.addBuilder(toFSBuilder);
     }
 
     /**
-     * Check whether this process have no problem. If have problems, BuildException will be occurred.
+     * Check whether this process have no problem. If have problems,
+     * BuildException will be occurred.
      * 
      * @param buildProcess
      * @throws BuildException
      */
-    protected void checkHybridStructure(BuildProcess buildProcess) throws Exception {
-        // Check hybrid structure. If a manifest file and a binary file are not found, this is a failure.
+    protected void checkHybridStructure(BuildProcess buildProcess)
+            throws Exception {
+        // Check hybrid structure. If a manifest file and a binary file are not
+        // found, this is a failure.
         try {
-            Builder builder = buildProcess.getBuilder(HybridAppCLIBuilder.RESOURCE_LAYER_NAME);
+            Builder builder = buildProcess
+                    .getBuilder(HybridAppCLIBuilder.RESOURCE_LAYER_NAME);
             if (builder != null) {
                 HybridAppCLIBuilder hybridBuilder = (HybridAppCLIBuilder) builder;
                 if (!hybridBuilder.isManifestFound()) {
-                    throw new IOException(HybridAppCLIBuilder.ERROR_MANIFEST_NOT_FOUND);
+                    throw new IOException(
+                            HybridAppCLIBuilder.ERROR_MANIFEST_NOT_FOUND);
                 }
                 if (!hybridBuilder.isBinaryFound()) {
-                    throw new IOException(HybridAppCLIBuilder.ERROR_BINARY_NOT_FOUND);
+                    throw new IOException(
+                            HybridAppCLIBuilder.ERROR_BINARY_NOT_FOUND);
                 }
             }
         } catch (IOException e) {
             throw new Exception(e);
         }
 
-        // TODO Notification ?? getPrompter().notify( MessageFormat.format( SUCCEED_MSG, this.output ) );
+        // TODO Notification ?? getPrompter().notify( MessageFormat.format(
+        // SUCCEED_MSG, this.output ) );
     }
 
     /**
index 78e92aa..dbdafed 100644 (file)
@@ -44,7 +44,18 @@ public class BuildWebParameter {
     private File workingDir;
     private File[] refs;
 
-    public BuildWebParameter() {
+    /* (non-Javadoc)
+        * @see java.lang.Object#toString()
+        */
+       @Override
+       public String toString() {
+               return "BuildWebParameter \n[optimize=" + optimize + ", excludeUIFW="
+                               + excludeUIFW + ", excludeList=" + excludeList
+                               + ", outputName=" + outputName + ", workingDir=" + workingDir
+                               + ", refs=" + Arrays.toString(refs) + "]";
+       }
+
+       public BuildWebParameter() {
     }
 
     public boolean isOptimize() {
index 629c90d..6a9b061 100644 (file)
@@ -8,7 +8,7 @@ public class TizenCLIMessages extends NLS {
     }
     //Common
     public static String CANNOT_READ_CPROJECT;
-    public static String CANNOT_SET_OPTIONS;
+    public static String CANNOT_GET_OPTIONS;
     
     public static String INVALID_ARG;
     public static String INVALID_ARGS;
@@ -22,13 +22,12 @@ public class TizenCLIMessages extends NLS {
     public static String BN_CANNOT_MAKE_BUILD_COMMAND;
     public static String BN_CANNOT_SET_BUILD_TARGET;
     public static String BN_CANNOT_WRITE_BUILD_TARGET_INFO;
+    public static String BN_CANNOT_FIND_DEFAULT_INFO_CONFIG;
     
 
     public static String BN_INVALID_CONFIGURATION;
 
-    public static String BN_NO_CONFIG_BUILD_ARCHITECTURE;
-    public static String BN_NO_CONFIG_BUILD_CONFIGURATION;
-    public static String BN_NO_CONFIG_BUILD_COMPILER;
+    public static String BN_NO_BUILD_INPUT;
     
     public static String BN_SUCCESS_SET_TARGET_INFO;
     
index 294aa2f..8e73694 100644 (file)
@@ -1,5 +1,5 @@
 CANNOT_READ_CPROJECT = Can not read the .cproject file.
-CANNOT_SET_OPTIONS = Can not set the options.
+CANNOT_GET_OPTIONS = Can not get the required options.
 
 INVALID_ARG = The {0} is an invalid argument\nTry to use one of {1}
 INVALID_ARGS = There are invalid arguments.
@@ -12,12 +12,11 @@ BN_CANNOT_GET_TOOLCHAIN_ID = Can not get the toolchain id.
 BN_CANNOT_MAKE_BUILD_COMMAND = Can not make the build command.
 BN_CANNOT_SET_BUILD_TARGET = Can not set the build target information.
 BN_CANNOT_WRITE_BUILD_TARGET_INFO = Can not write the build target information.
+BN_CANNOT_FIND_DEFAULT_INFO_CONFIG = Can not read the {0} value in config file.
 
 BN_INVALID_CONFIGURATION = The {0} is an invalid configuration\nTry to use one of {1}
 
-BN_NO_CONFIG_BUILD_ARCHITECTURE = There is no default architecture value in config file.
-BN_NO_CONFIG_BUILD_COMPILER = There is no default compiler value in config file.
-BN_NO_CONFIG_BUILD_CONFIGURATION = There is no default configuration value in config file.
+BN_NO_BUILD_INPUT = There is no {0} input. -> Try to find default value from config file.
 
 BN_SUCCESS_SET_TARGET_INFO = Success to write the build target information
 
index fa62a60..0b401a8 100644 (file)
@@ -26,10 +26,18 @@ package org.tizen.ncli.ide.shell;
 
 import java.io.File;
 import java.io.PrintWriter;
+import java.text.DateFormat;
+import java.text.MessageFormat;
+import java.text.SimpleDateFormat;
+import java.util.Date;
+import java.util.concurrent.TimeUnit;
 
+import org.apache.commons.lang3.time.DurationFormatUtils;
+import org.apache.commons.lang3.time.StopWatch;
 import org.kohsuke.args4j.Option;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.tizen.common.util.StringUtil;
 import org.tizen.ncli.core.CommandLineParser;
 
 /**
@@ -39,6 +47,7 @@ import org.tizen.ncli.core.CommandLineParser;
  */
 public abstract class AbstractCLI {
     protected Logger log = LoggerFactory.getLogger(getClass());
+    protected final Logger progressLog = LoggerFactory.getLogger("NCLI_PROGRESS");  
 
     @Option(name = "--", metaVar = "working directory", usage = "Specify where is the base directory for the command")
     public File workingDir;
@@ -51,12 +60,27 @@ public abstract class AbstractCLI {
     private CommandLineParser cmdParser;
 
     public abstract void execute();
+    
+    private StopWatch stopWatch = new StopWatch();
 
     /**
      * @param cmdParser
      */
     public void execute(final CommandLineParser cmdParser) {
-        this.cmdParser = cmdParser; 
+        this.cmdParser = cmdParser;
+        stopWatch.start();
+        
         execute();
+        
+        stopWatch.stop();
+    }
+
+    /**
+     * Print execution time as form of <code>"Total time: {hours}:{minutes}:{seconds}.{miliseconds}"</code>
+     */
+    protected void printElapsedTime() {
+        long elapsedTime = stopWatch.getTime();
+        String duration = DurationFormatUtils.formatDuration(elapsedTime, "HH:mm:ss.S");
+        progressLog.info("Total time: {}",duration);
     }
 }
index fcd09f5..a72d9c5 100644 (file)
@@ -38,10 +38,10 @@ 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 for build result")\r
+    @Option(name = "--arch", metaVar = "x86 | arm", usage = "Architecture for build result")\r
     private String architecture;\r
 \r
-    @Option(name = "--compiler", depends="--arch", metaVar = "gcc | llvm", usage = "Compiler for build result")\r
+    @Option(name = "--compiler", metaVar = "gcc | llvm", usage = "Compiler for build result")\r
     private String compiler;\r
 \r
     @Option(name = "--configuration", metaVar = "Debug | Release | DA", usage = "Configuration for build result")\r
@@ -60,14 +60,13 @@ public class BuildNativeCLI extends AbstractCLI {
      */\r
     @Override\r
     public void execute() {\r
-        log.trace("Execute BuildWebCLI...");\r
+        log.trace("Execute BuildNativeCLI...");\r
 \r
         BuildNativeCLICommand command = new BuildNativeCLICommand();\r
 \r
         command.setWorkingDir(workingDir == null ? currentWorkspacePath : workingDir);\r
-        command.setArchitecture(architecture);\r
-        command.setCompiler(compiler);\r
-        command.setConfiguration(DA.equals(configuration) ? DA_ORIGIN : configuration);\r
+        configuration = DA.equals(configuration) ? DA_ORIGIN : configuration;\r
+        command.setRequiredOptions(new String[]{architecture, compiler, configuration});\r
         command.setPredefineOption(predefineOption);\r
 \r
         BuildNative runCommand = command.runCommand();\r
index 9ab7806..861d165 100644 (file)
@@ -1,15 +1,47 @@
+/*\r
+ * IDE\r
+ *\r
+ * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved.\r
+ *\r
+ * Contact:\r
+ * Hyeongseok Heo <hyeongseok.heo@samsung.com>\r
+ * Kangho Kim <kh5325.kim@samsung.com>\r
+ * \r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ *\r
+ * Contributors:\r
+ * - S-Core Co., Ltd\r
+ */\r
 package org.tizen.ncli.ide.shell;\r
 \r
 import java.io.File;\r
+import java.io.PrintWriter;\r
 import java.util.List;\r
 \r
+import org.apache.commons.lang3.time.StopWatch;\r
 import org.kohsuke.args4j.Option;\r
 import org.kohsuke.args4j.spi.StringOptionHandler;\r
 import org.slf4j.Logger;\r
 import org.slf4j.LoggerFactory;\r
 import org.tizen.core.ide.BuildWebParameter;\r
+import org.tizen.core.ide.TextProgressMonitor;\r
 import org.tizen.ncli.ide.subcommands.BuildWebCLICommand;\r
 \r
+/**\r
+ * Entry point of <code>build-web</code> command.<br>\r
+ *  \r
+ * @author Harry Hyeongseok Heo {@literal <hyeongseok.heo@samsung.com>}  (S-core)\r
+ */\r
 public class BuildWebCLI extends AbstractCLI {\r
     private Logger log = LoggerFactory.getLogger(getClass());\r
 \r
@@ -29,7 +61,6 @@ public class BuildWebCLI extends AbstractCLI {
 \r
     public void execute() {\r
         log.trace("Execute BuildWebCLI...");\r
-\r
         BuildWebCLICommand command = new BuildWebCLICommand();\r
         \r
         if( null == workingDir && null != currentWorkspacePath) {\r
@@ -46,12 +77,9 @@ public class BuildWebCLI extends AbstractCLI {
         command.setOptimize(optimize);\r
         command.setExcludeUIFW(excludeUIFW);\r
         command.setWorkingDir(workingDir);\r
-\r
+        command.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out)));\r
+        \r
         BuildWebParameter commandData = command.runCommand();\r
-\r
-        output.println("Build web project succeeded!");\r
-        output.println(commandData);\r
-\r
     }\r
 \r
 }\r
index 2590f6b..f11671d 100644 (file)
@@ -45,6 +45,7 @@ public class ListCLI extends AbstractCLI{
 
     @Override
     public void execute() {
+        log.trace("Execute ListCLI...");
         if( null != this.tizenCLI) {
             this.tizenCLI.execute();
         }
index 223a337..e9e94a3 100644 (file)
@@ -21,12 +21,14 @@ import org.kohsuke.args4j.spi.SubCommandHandler;
 import org.kohsuke.args4j.spi.SubCommands;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.tizen.common.util.IOUtil;
 import org.tizen.ncli.core.CommandInfo;
 import org.tizen.ncli.core.CommandLineParser;
 import org.tizen.ncli.core.SubCommandData;
 import org.tizen.ncli.core.TizenSubCommand;
 import org.tizen.ncli.core.TizenSubCommandHandler;
 import org.tizen.ncli.core.collection.TreeNode;
+import org.tizen.ncli.ide.messages.TizenCLIMessages;
 
 /**
  * This class is entry point of Tizen New Command Line Interface. All the command line argument would be parsed and then
@@ -36,10 +38,12 @@ import org.tizen.ncli.core.collection.TreeNode;
  * 
  */
 public class Main {
-
     private Logger log = LoggerFactory.getLogger(Main.class);
+    /**
+     * Use this to show progress message to User. The default level is specified with info .
+     */
+    protected final Logger progressLog = LoggerFactory.getLogger("NCLI_PROGRESS");
 
-    // FIXME Should resolve subcommand usage message problem and usage and metaVar should be externalized!
     @Argument(index = 0, required = true, handler = TizenSubCommandHandler.class, metaVar = "<command>", usage = "tizen <command>")
     @SubCommands({ @SubCommand(name = "create", impl = CreateCLI.class),
             @SubCommand(name = "build-native", impl = BuildNativeCLI.class),
@@ -48,7 +52,7 @@ public class Main {
             @SubCommand(name = "help", impl = HelpCLI.class) })
     private AbstractCLI tizenCLI;
 
-    @Option(name = "-h", aliases = { "--help" }, usage = "")
+    @Option(name = "-h", aliases = { "--help" }, usage = "tizen -h")
     private boolean helpOpt;
 
     /**
@@ -60,6 +64,11 @@ public class Main {
 
     }
 
+    /**
+     * Main method<br>
+     * 
+     * @param args
+     */
     private void run(String[] args) {
         CommandLineParser cmdParser = new CommandLineParser(this);
         log.trace("Start running Tizen CLI Main class...");
@@ -67,15 +76,11 @@ public class Main {
         PrintWriter errorWriter = new PrintWriter(System.err);
         try {
             cmdParser.setUsageWidth(120);
-            // Argument parsing - make metadata from annotation.
             cmdParser.parseArgument(args);
         } catch (CmdLineException e) {
             if (args.length == 0 || helpOpt) {
                 printDefaultCommandUsage(errorWriter);
             } else if (args.length == 3) {
-                /*
-                 * Check if command name is correct and print proper message
-                 */
                 String command = args[0];
                 log.trace("{}", command);
                 if (null == SubCommandData.get(command)) {
@@ -87,7 +92,7 @@ public class Main {
 
             } else if (args.length > 3) {
                 errorWriter.println();
-                errorWriter.println("Argument is not valid!");
+                errorWriter.println(TizenCLIMessages.INVALID_ARG);
                 errorWriter.println(MessageFormat.format("Error: {0}", e.getMessage()));
                 errorWriter.println();
                 CommandInfo currentCmdInfo = SubCommandData.get("CURRENT_CMD");
@@ -97,9 +102,6 @@ public class Main {
                     currentCmdInfo.getCmdLineParser().printUsage(errorWriter, null);
                 }
             }
-
-            printCommandTree();
-
             errorWriter.flush();
             System.exit(1);
         }
@@ -114,9 +116,8 @@ public class Main {
         }
 
         errorWriter.flush();
-        if (null != tizenCLI.output) {
-            tizenCLI.output.flush();
-        }
+        tizenCLI.printElapsedTime();
+        IOUtil.tryClose(errorWriter);
         System.exit(0);
 
     }
@@ -140,41 +141,14 @@ public class Main {
     }
 
     private void printDefaultCommandUsage(PrintWriter errorWriter) {
-        errorWriter.println();
-        errorWriter.println("Usage: tizen <command> [args]");
-        errorWriter.println();
-        errorWriter.println("Where <command> is one of ");
+        progressLog.error("Usage: tizen <command> [args]");
+        progressLog.error("Where <command> is one of ");
+        progressLog.error("-----------------------------");
         Set<String> commandNames = SubCommandData.keySet();
-        errorWriter.println("============================");
         for (String key : commandNames) {
             CommandInfo commandInfo = SubCommandData.get(key);
-            errorWriter.printf("  %s\t%s\n", key, (commandInfo.getUsage() == null) ? "" : commandInfo.getUsage());
+            progressLog.error("    {}\t{}",key,(commandInfo.getUsage() == null) ? "" : commandInfo.getUsage());
         }
-        errorWriter.println("See more information:\n  tizen help <command>");
+        progressLog.error("See more information:\n  tizen help <command>");
     }
-
-    // FIXME Delete this in near future. Just for testing
-    private void printCommandTree() {
-        TreeNode<CommandInfo> rootNode = SubCommandData.getRootNode();
-        if (null != rootNode) {
-            Iterator<TreeNode<CommandInfo>> iterator = rootNode.iterator();
-
-            while (iterator.hasNext()) {
-                TreeNode<CommandInfo> next = iterator.next();
-                log.trace("{}", next.data.toString());
-                if (null != next.children) {
-                    printChild(next.children);
-                }
-            }
-
-        }
-    }
-
-    // FIXME Delete this in near future. Just for testing
-    private void printChild(List<TreeNode<CommandInfo>> children2) {
-        for (TreeNode<CommandInfo> treeNode : children2) {
-            log.trace("Childe:{}", treeNode.data);
-        }
-    }
-
 }
index a4b325f..51f3be8 100644 (file)
@@ -39,7 +39,7 @@ public class SignCLI extends AbstractCLI {
      */\r
     @Override\r
     public void execute() {\r
-        log.trace("Execute Signing...");\r
+        log.trace("Execute SignCLI...");\r
         \r
         SignCLICommand command = new SignCLICommand();\r
         \r
index fb81307..adc71f6 100644 (file)
@@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory;
 import org.tizen.common.config.Preference;\r
 import org.tizen.common.config.provider.EnvironmentProvider;\r
 import org.tizen.common.config.provider.SystemPropertiesProvider;\r
+import org.tizen.core.ide.NullProgressMonitor;\r
+import org.tizen.core.ide.ProgressMonitor;\r
 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
@@ -41,8 +43,15 @@ import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider;
  * @author Harry Hyeongseok Heo{@literal <hyeongseok.heo@samsung.com>} (S-core)\r
  */\r
 abstract public class AbstractSubCommand<T> {\r
-    protected final Logger log = LoggerFactory.getLogger( getClass() );\r
+    protected final Logger log = LoggerFactory.getLogger( AbstractSubCommand.class );\r
+    \r
+    /**\r
+     * Use this <code>progressLog</code> at notifying  Users about progress of work.<br>\r
+     * Make sure you should not use any method but {@link Logger#info()}...\r
+     * */\r
+    protected final Logger progressLog = LoggerFactory.getLogger("NCLI_PROGRESS"); \r
     protected File workingDir;\r
+       protected ProgressMonitor progressMonitor = new NullProgressMonitor();\r
 \r
     public AbstractSubCommand(){\r
         initializeConfig();\r
@@ -88,4 +97,11 @@ abstract public class AbstractSubCommand<T> {
      */\r
     protected abstract T call();\r
 \r
+       /**\r
+        * @param progressMonitor the progressMonitor to set\r
+        */\r
+       public void setProgressMonitor(ProgressMonitor progressMonitor) {\r
+               this.progressMonitor = progressMonitor;\r
+       }\r
+\r
 }\r
index 7e6f0bc..aadf8ff 100644 (file)
@@ -46,6 +46,8 @@ import org.tizen.common.util.OSChecker;
 import org.tizen.common.util.StringUtil;\r
 import org.tizen.core.ide.BuildWebAppModule;\r
 import org.tizen.core.ide.BuildWebParameter;\r
+import org.tizen.core.ide.ProgressMonitor;\r
+import org.tizen.ncli.ide.CLIConstant;\r
 import org.tizen.ncli.ide.shell.BuildWebCLI;\r
 import org.tizen.web.builder.HybridAppCLIBuilder;\r
 import org.tizen.web.builder.exception.MinifyException;\r
@@ -60,16 +62,9 @@ import org.tizen.web.common.WebConstant;
  * \r
  */\r
 public class BuildWebCLICommand extends AbstractSubCommand<BuildWebParameter> {\r
-    private Logger log = LoggerFactory.getLogger(getClass());\r
-\r
-    // file filter. If you want to exclude a directory, append '/*'\r
-    private static final String[] DEFAULT_EXCLUDES = { ".build" + File.separator + "*", ".project",\r
-            ".settings" + File.separator + "*", ".sdk_delta.info", "*.wgt" };\r
-    // private BuildWebAppModule webAppBuild = new BuildWebAppModule(new BuildWebParameter(), ".", ".buildResult", new\r
-    // SimpleFileFilter(true), new WildCardFilterFactory(), new ArrayList<String>());\r
     private BuildWebAppModule buildWebAppModule = new BuildWebAppModule();\r
     private BuildWebParameter webAppBuildData = new BuildWebParameter();\r
-\r
+    \r
     /**\r
      * With the {@link BuildWebParameter} , calling {@link BuildWebAppModule} to make out build result. <br>\r
      * Below files or directories would be excluded by default.<br>\r
@@ -81,10 +76,10 @@ public class BuildWebCLICommand extends AbstractSubCommand<BuildWebParameter> {
      */\r
     @Override\r
     protected BuildWebParameter call() {\r
-        log.trace("BuildWeb command started ...");\r
-        log.info("-----------------------------------------------------");\r
-        log.info("Starting Tizen project build:");\r
-        log.info("-----------------------------------------------------");\r
+        progressLog.info("-----------------------------------------------------");\r
+        progressLog.info("Starting Tizen project build:");\r
+        progressLog.info("-----------------------------------------------------");\r
+        \r
         initExcludes();\r
         if (log.isTraceEnabled()) {\r
             log.trace("BuildData: {}", webAppBuildData);\r
@@ -97,23 +92,26 @@ public class BuildWebCLICommand extends AbstractSubCommand<BuildWebParameter> {
                 buildWebAppModule.setCwd(canonicalPath);\r
                 log.trace("canonicalPath:{}", canonicalPath);\r
             } catch (IOException e) {\r
-                e.printStackTrace();\r
+                progressLog.error("Error occurred during setting current work path!");\r
+                log.error("Error occurred during setting current work path!\n{}",e.getMessage());\r
             }\r
         }\r
 \r
 \r
         try {\r
+            buildWebAppModule.setMonitor(progressMonitor);\r
             buildWebAppModule.setData(webAppBuildData);\r
             buildWebAppModule.buildResources();\r
 \r
         } catch (IOException e) {\r
             e.printStackTrace();\r
         } catch (BuildException e) {\r
-            e.printStackTrace();\r
+            progressLog.error("Error occured during build!\n\t{}",e.getMessage());\r
+            return webAppBuildData;\r
         } catch (Exception e) {\r
             e.printStackTrace();\r
         }\r
-\r
+        progressLog.info("\nBUILD SUCCESSFUL\n");\r
         return webAppBuildData;\r
     }\r
 \r
@@ -191,4 +189,11 @@ public class BuildWebCLICommand extends AbstractSubCommand<BuildWebParameter> {
         this.webAppBuildData.setReferences(refs);\r
     }\r
 \r
+       /**\r
+        * @return the progressMonitor\r
+        */\r
+       public ProgressMonitor getProgressMonitor() {\r
+               return progressMonitor;\r
+       }\r
+\r
 }\r
index dad8570..e493f63 100755 (executable)
@@ -3,7 +3,9 @@ CURRENT_WORKSPACE_PATH=`pwd`
 HOME_PATH=`test -h $0 && dirname $(readlink $0) || dirname $0`
 cd $HOME_PATH/../lib-ncli
 
-CONFIG_PATH=$HOME_PATH/../conf
+CONFIG_PATH=$HOME_PATH/../conf-ncli
+LOG_CONF_FILE=log4j-progress.xml
+LOG_OPT="-Dlog4j.configuration=${LOG_CONF_FILE}"
 
 LIBS=`find . -maxdepth 1`
 LIB=""
@@ -32,6 +34,6 @@ fi
 
 MAIN=org.tizen.ncli.ide.shell.Main
 
-EXEC="java -Djava.library.path=./os/linux/x86_64 -cp $CLASS_PATH $MAIN $ARGS"
+EXEC="java ${LOG_OPT} -Djava.library.path=./os/linux/x86_64 -cp $CLASS_PATH $MAIN $ARGS"
 
 eval "$EXEC"
index 75df558..e29c5f1 100755 (executable)
@@ -22,6 +22,70 @@ clean()
 }
 
 # build
+# Copy library and related resource before executing actual build.
+#
+# With 'ant' command , build.xml is called and java build is executed.
+# In build function , web-cli build is executed 
+# and then native_build and newcli_build is called
+build() 
+{
+       echo $LIB
+       mkdir -p $LIB   
+
+    SRC_LIST="
+    org.eclipse.osgi_*
+    org.tizen.web.common_*
+    "
+
+    for SRC in ${SRC_LIST}
+    do
+        TARGET=`find $ROOTDIR -name "${SRC}" | head -1`
+           cp ${TARGET} $LIB
+    done
+
+    INCLUDING_LIB_SRC_LIST="
+    org.tizen.common_*
+    org.tizen.common.builder_*
+    org.tizen.common.sign_*
+    org.tizen.common.verrari_*
+    org.tizen.common.verrari.realm_*
+    org.tizen.common.sdblib_*
+    org.tizen.web.builder_*
+    org.tizen.web.compressor.minifier.core_*
+    org.tizen.web.zimlaunch_*
+    org.tizen.web.project.wizard_*
+    org.tizen.web.sign_*
+    "
+
+    for SRC in ${INCLUDING_LIB_SRC_LIST}
+    do
+        TARGET=`find $ROOTDIR -name "${SRC}" | head -1`
+        case "${TARGET}" in
+            *.jar)
+                cp ${TARGET} ${LIB}
+                jar -xvf ${TARGET} lib
+                ;;
+            *)
+                cp -rf ${TARGET} ${LIB}
+                find -name '*.jar' -exec cp {} ${LIB} \;
+                ;;
+        esac
+    done
+
+       cp $PROJECT_HOME/lib/*.jar $LIB
+
+       mkdir -p $BUILD
+       cp -r $PROJECT_HOME/src/* $BUILD
+       # native-cli build
+       native_build
+       # newcli build
+       newcli_build
+       ant
+
+}
+
+
+
 native_build() {
        mkdir -p ${NATIVE_LIB}
        mkdir -p ${NATIVE_TARGET}/bin
@@ -123,64 +187,44 @@ newcli_build() {
        mkdir -p $BUILD
        cp -r $NCLI_PROJECT_HOME/src/* $BUILD
 }
-build() 
-{
-       echo $LIB
-       mkdir -p $LIB   
-
-    SRC_LIST="
-    org.eclipse.osgi_*
-    org.tizen.web.common_*
-    "
-
-    for SRC in ${SRC_LIST}
-    do
-        TARGET=`find $ROOTDIR -name "${SRC}" | head -1`
-           cp ${TARGET} $LIB
-    done
-
-    INCLUDING_LIB_SRC_LIST="
-    org.tizen.common_*
-    org.tizen.common.builder_*
-    org.tizen.common.sign_*
-    org.tizen.common.verrari_*
-    org.tizen.common.verrari.realm_*
-    org.tizen.common.sdblib_*
-    org.tizen.web.builder_*
-    org.tizen.web.compressor.minifier.core_*
-    org.tizen.web.zimlaunch_*
-    org.tizen.web.project.wizard_*
-    org.tizen.web.sign_*
-    "
-
-    for SRC in ${INCLUDING_LIB_SRC_LIST}
-    do
-        TARGET=`find $ROOTDIR -name "${SRC}" | head -1`
-        case "${TARGET}" in
-            *.jar)
-                cp ${TARGET} ${LIB}
-                jar -xvf ${TARGET} lib
-                ;;
-            *)
-                cp -rf ${TARGET} ${LIB}
-                find -name '*.jar' -exec cp {} ${LIB} \;
-                ;;
-        esac
-    done
 
-       cp $PROJECT_HOME/lib/*.jar $LIB
 
-       mkdir -p $BUILD
-       cp -r $PROJECT_HOME/src/* $BUILD
-       # native-cli build
-       native_build
-       # newcli build
-       newcli_build
-       ant
+# install
+# - Make a directory structure for the zip file.(DIBS package) 
+# Do not confuse this is not package install.Just function name is 'install'
+# Like build , in install web-cli install is executed 
+# and then native_install and newcli_install is called.
+install() 
+{
+    mkdir -p $TARGET/lib
 
+    # copy command
+    case ${TARGET_OS} in
+        ubuntu-32|ubuntu-64|macos-64)
+            cp -r $PROJECT_HOME/doc/install/bin_ $TARGET/bin
+            rm $TARGET/bin/*.bat
+            ;;
+        windows-32|windows-64)
+            mkdir -p $TARGET/bin
+            cp -r $PROJECT_HOME/doc/install/bin_/*.bat $TARGET/bin
+            ;;
+        *)
+            echo "${TARGET_OS} is not support yet."
+            exit 1
+            ;;
+    esac
+    cp -r $PROJECT_HOME/doc/install/conf $TARGET/conf || true
+    cp -r $PROJECT_HOME/doc/install/sample $TARGET/sample || true
+    cp -r $PROJECT_HOME/doc/install/realm $TARGET/realm || true
+    cp -r $PROJECT_HOME/doc/install/document/* $TARGET || true
+    cp -r $LIB/* $TARGET/lib || true
+    cp dist/*.jar $TARGET/lib || true
+    # native-cli install
+    native_install
+    # ncli install
+    newcli_install
 }
 
-# install
 native_install() {
 
     mkdir -p ${NATIVE_TARGET}/lib
@@ -228,7 +272,7 @@ newcli_install() {
     case ${TARGET_OS} in
         ubuntu-32|ubuntu-64|macos-64)
             cp -r $NCLI_PROJECT_HOME/tizen.sh $NCLI_TARGET/bin || true
-            cp ${SRCDIR}/dist/tizen-autocomplete.jar $NCLI_TARGET/lib || true
+            cp ${SRCDIR}/dist/tizen-autocomplete.jar $NCLI_TARGET/lib-ncli || true
            cp -r $NCLI_PROJECT_HOME/tizen-autocomplete $NCLI_TARGET/bin || true
 
             ;;
@@ -240,7 +284,9 @@ newcli_install() {
             exit 1
             ;;
     esac
-
+# Copy configuration files
+    cp -r $NCLI_PROJECT_HOME/resources $NCLI_TARGET/conf-ncli || true
+    
 dependency_jars="
 log4j-*.jar
 slf4j-api-*.jar
@@ -255,36 +301,7 @@ args4j-*.jar
 
 
 
-install() 
-{
-    mkdir -p $TARGET/lib
 
-    # copy command
-    case ${TARGET_OS} in
-        ubuntu-32|ubuntu-64|macos-64)
-            cp -r $PROJECT_HOME/doc/install/bin_ $TARGET/bin
-            rm $TARGET/bin/*.bat
-            ;;
-        windows-32|windows-64)
-            mkdir -p $TARGET/bin
-            cp -r $PROJECT_HOME/doc/install/bin_/*.bat $TARGET/bin
-            ;;
-        *)
-            echo "${TARGET_OS} is not support yet."
-            exit 1
-            ;;
-    esac
-    cp -r $PROJECT_HOME/doc/install/conf $TARGET/conf || true
-    cp -r $PROJECT_HOME/doc/install/sample $TARGET/sample || true
-    cp -r $PROJECT_HOME/doc/install/realm $TARGET/realm || true
-    cp -r $PROJECT_HOME/doc/install/document/* $TARGET || true
-    cp -r $LIB/* $TARGET/lib || true
-    cp dist/*.jar $TARGET/lib || true
-    # native-cli install
-    native_install
-    # ncli install
-    newcli_install
-}
 
 [ "$1" = "clean" ] && clean
 [ "$1" = "build" ] && build
index a7be48c..62811a1 100644 (file)
@@ -1,19 +1,24 @@
 TIZEN_SDK_INSTALL_PATH=${INSTALLED_PATH}
 TOOLS_PATH=${TIZEN_SDK_INSTALL_PATH}/tools
 CLI_PATH=${TOOLS_PATH}/ide/bin
+CLI_LOG_FILE=${TOOLS_PATH}/ide/ncli.log
 
 TIZEN_COMPLETION_PATH=/etc/bash_completion.d
 TIZEN_COMPLETION_SCRIPT=${CLI_PATH}/tizen-autocomplete
 TIZEN_COMPLETION_LINK_PATH=/usr/bin/tizen
 TIZEN_NEWCLI_SH=${CLI_PATH}/tizen.sh
 
-CLI_LIB_PATH=${TOOLS_PATH}/ide/ncli-lib
-LOG_CONFIG_PATH=${TOOLS_PATH}/ide/conf
+CLI_LIB_PATH=${TOOLS_PATH}/ide/lib-ncli
+LOG_CONFIG_PATH=${TOOLS_PATH}/ide/conf-ncli
 SPAWN_LIB_PATH=${CLI_LIB_PATH}/os/linux/x86_64
+LOG4J_CONFIG=${LOG_CONFIG_PATH}/log4j-progress.xml
 
 sed -i "s:LOG_CONFIG_PATH:\"${LOG_CONFIG_PATH}\":g" ${TIZEN_COMPLETION_SCRIPT}
 sed -i "s:CLI_LIB_PATH:\"${CLI_LIB_PATH}\":g" ${TIZEN_COMPLETION_SCRIPT}
 sed -i "s:SPAWN_LIB_PATH:\"${SPAWN_LIB_PATH}\":g" ${TIZEN_COMPLETION_SCRIPT}
+sed -i "s:CLI_LOG_FILE:\"${CLI_LOG_FILE}\":g" ${LOG4J_CONFIG}
+
+
 
 gksudo "mv ${TIZEN_COMPLETION_SCRIPT} ${TIZEN_COMPLETION_PATH}"
 gksudo "ln -s ${TIZEN_NEWCLI_SH} ${TIZEN_COMPLETION_LINK_PATH}"