From: Heongseok Heo Date: Sat, 30 Nov 2013 07:15:20 +0000 (+0900) Subject: CLI : Apply pregress monitor , log for progress X-Git-Url: http://review.tizen.org/git/?a=commitdiff_plain;h=3483843b665421e499fbc9af7cfdf8ce4aec40a5;p=sdk%2Ftools%2Fcli.git CLI : Apply pregress monitor , log for progress Apply progress monitor and log4j for progress log Modify build script and install script Change-Id: I5b4ba7f988d656e0217f971e212d61d0ca6aef9b Signed-off-by: Heongseok Heo --- diff --git a/org.tizen.ncli.ide/resources/log4j-debug.xml b/org.tizen.ncli.ide/resources/log4j-debug.xml new file mode 100644 index 0000000..625523d --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-debug.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j-error.xml b/org.tizen.ncli.ide/resources/log4j-error.xml new file mode 100644 index 0000000..50905c9 --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-error.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j-info.xml b/org.tizen.ncli.ide/resources/log4j-info.xml new file mode 100644 index 0000000..c1d5f9e --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-info.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j-progress.xml b/org.tizen.ncli.ide/resources/log4j-progress.xml new file mode 100644 index 0000000..5e86100 --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-progress.xml @@ -0,0 +1,46 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j-trace.xml b/org.tizen.ncli.ide/resources/log4j-trace.xml new file mode 100644 index 0000000..61298ea --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-trace.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j-warn.xml b/org.tizen.ncli.ide/resources/log4j-warn.xml new file mode 100644 index 0000000..b984f69 --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j-warn.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/resources/log4j.xml b/org.tizen.ncli.ide/resources/log4j.xml new file mode 100644 index 0000000..328d165 --- /dev/null +++ b/org.tizen.ncli.ide/resources/log4j.xml @@ -0,0 +1,15 @@ + + + + + + + + + + + + + + + diff --git a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java index b08536f..d34cb50 100644 --- a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java +++ b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebAppModule.java @@ -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. - *

- * This class make out build result by parameters for build.
- * Independent with IDE or CLI + * This class collect and modify resources to be packaged and then make out + * build output directory
c.f. default name is .buildResult
* * @author Harry Hyeongseok Heo{@literal } (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 filterFactory = new WildCardFilterFactory(); public List excludes = new ArrayList(); - 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 filterFactory, + List 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 filterFactory, List 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. + *

  • Current work directory
  • + *
  • Existing config.xml
  • * @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 getResources(String cwd, String relativeSrcDir, ResourceLayer layer) throws IOException { + private List getResources(String cwd, String relativeSrcDir, + ResourceLayer layer) throws IOException { List resources = new ArrayList(); List 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 resources = new ArrayList(); // 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 ) ); } /** diff --git a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java index 78e92aa..dbdafed 100644 --- a/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java +++ b/org.tizen.ncli.ide/src/org/tizen/core/ide/BuildWebParameter.java @@ -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() { diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.java index 629c90d..6a9b061 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.java @@ -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; diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.properties b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.properties index 294aa2f..8e73694 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.properties +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/messages/TizenCLIMessages.properties @@ -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 diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java index fa62a60..0b401a8 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/AbstractCLI.java @@ -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 "Total time: {hours}:{minutes}:{seconds}.{miliseconds}" + */ + protected void printElapsedTime() { + long elapsedTime = stopWatch.getTime(); + String duration = DurationFormatUtils.formatDuration(elapsedTime, "HH:mm:ss.S"); + progressLog.info("Total time: {}",duration); } } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java index fcd09f5..a72d9c5 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildNativeCLI.java @@ -38,10 +38,10 @@ import org.tizen.ncli.ide.subcommands.BuildNativeCLICommand; public class BuildNativeCLI extends AbstractCLI { private Logger log = LoggerFactory.getLogger(getClass()); - @Option(name = "--arch", depends="--compiler", metaVar = "x86 | arm", usage = "Architecture for build result") + @Option(name = "--arch", metaVar = "x86 | arm", usage = "Architecture for build result") private String architecture; - @Option(name = "--compiler", depends="--arch", metaVar = "gcc | llvm", usage = "Compiler for build result") + @Option(name = "--compiler", metaVar = "gcc | llvm", usage = "Compiler for build result") private String compiler; @Option(name = "--configuration", metaVar = "Debug | Release | DA", usage = "Configuration for build result") @@ -60,14 +60,13 @@ public class BuildNativeCLI extends AbstractCLI { */ @Override public void execute() { - log.trace("Execute BuildWebCLI..."); + log.trace("Execute BuildNativeCLI..."); BuildNativeCLICommand command = new BuildNativeCLICommand(); command.setWorkingDir(workingDir == null ? currentWorkspacePath : workingDir); - command.setArchitecture(architecture); - command.setCompiler(compiler); - command.setConfiguration(DA.equals(configuration) ? DA_ORIGIN : configuration); + configuration = DA.equals(configuration) ? DA_ORIGIN : configuration; + command.setRequiredOptions(new String[]{architecture, compiler, configuration}); command.setPredefineOption(predefineOption); BuildNative runCommand = command.runCommand(); diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java index 9ab7806..861d165 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/BuildWebCLI.java @@ -1,15 +1,47 @@ +/* + * IDE + * + * Copyright (c) 2000 - 2013 Samsung Electronics Co., Ltd. All rights reserved. + * + * Contact: + * Hyeongseok Heo + * Kangho Kim + * + * Licensed under the Apache License, Version 2.0 (the "License"); + * you may not use this file except in compliance with the License. + * You may obtain a copy of the License at + * + * http://www.apache.org/licenses/LICENSE-2.0 + * + * Unless required by applicable law or agreed to in writing, software + * distributed under the License is distributed on an "AS IS" BASIS, + * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. + * See the License for the specific language governing permissions and + * limitations under the License. + * + * Contributors: + * - S-Core Co., Ltd + */ package org.tizen.ncli.ide.shell; import java.io.File; +import java.io.PrintWriter; import java.util.List; +import org.apache.commons.lang3.time.StopWatch; import org.kohsuke.args4j.Option; import org.kohsuke.args4j.spi.StringOptionHandler; import org.slf4j.Logger; import org.slf4j.LoggerFactory; import org.tizen.core.ide.BuildWebParameter; +import org.tizen.core.ide.TextProgressMonitor; import org.tizen.ncli.ide.subcommands.BuildWebCLICommand; +/** + * Entry point of build-web command.
    + * + * @author Harry Hyeongseok Heo {@literal } (S-core) + */ public class BuildWebCLI extends AbstractCLI { private Logger log = LoggerFactory.getLogger(getClass()); @@ -29,7 +61,6 @@ public class BuildWebCLI extends AbstractCLI { public void execute() { log.trace("Execute BuildWebCLI..."); - BuildWebCLICommand command = new BuildWebCLICommand(); if( null == workingDir && null != currentWorkspacePath) { @@ -46,12 +77,9 @@ public class BuildWebCLI extends AbstractCLI { command.setOptimize(optimize); command.setExcludeUIFW(excludeUIFW); command.setWorkingDir(workingDir); - + command.setProgressMonitor(new TextProgressMonitor(new PrintWriter(System.out))); + BuildWebParameter commandData = command.runCommand(); - - output.println("Build web project succeeded!"); - output.println(commandData); - } } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ListCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ListCLI.java index 2590f6b..f11671d 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ListCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/ListCLI.java @@ -45,6 +45,7 @@ public class ListCLI extends AbstractCLI{ @Override public void execute() { + log.trace("Execute ListCLI..."); if( null != this.tizenCLI) { this.tizenCLI.execute(); } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java index 223a337..e9e94a3 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/Main.java @@ -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 = "", usage = "tizen ") @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
    + * + * @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 [args]"); - errorWriter.println(); - errorWriter.println("Where is one of "); + progressLog.error("Usage: tizen [args]"); + progressLog.error("Where is one of "); + progressLog.error("-----------------------------"); Set 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 "); + progressLog.error("See more information:\n tizen help "); } - - // FIXME Delete this in near future. Just for testing - private void printCommandTree() { - TreeNode rootNode = SubCommandData.getRootNode(); - if (null != rootNode) { - Iterator> iterator = rootNode.iterator(); - - while (iterator.hasNext()) { - TreeNode 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> children2) { - for (TreeNode treeNode : children2) { - log.trace("Childe:{}", treeNode.data); - } - } - } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java index a4b325f..51f3be8 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/shell/SignCLI.java @@ -39,7 +39,7 @@ public class SignCLI extends AbstractCLI { */ @Override public void execute() { - log.trace("Execute Signing..."); + log.trace("Execute SignCLI..."); SignCLICommand command = new SignCLICommand(); diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java index fb81307..adc71f6 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/AbstractSubCommand.java @@ -31,6 +31,8 @@ import org.slf4j.LoggerFactory; import org.tizen.common.config.Preference; import org.tizen.common.config.provider.EnvironmentProvider; import org.tizen.common.config.provider.SystemPropertiesProvider; +import org.tizen.core.ide.NullProgressMonitor; +import org.tizen.core.ide.ProgressMonitor; import org.tizen.ncli.ide.CLIConstant; import org.tizen.ncli.ide.core.config.NCLIConfigLoader; import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider; @@ -41,8 +43,15 @@ import org.tizen.ncli.ide.core.config.TizenCLIConfigProvider; * @author Harry Hyeongseok Heo{@literal } (S-core) */ abstract public class AbstractSubCommand { - protected final Logger log = LoggerFactory.getLogger( getClass() ); + protected final Logger log = LoggerFactory.getLogger( AbstractSubCommand.class ); + + /** + * Use this progressLog at notifying Users about progress of work.
    + * Make sure you should not use any method but {@link Logger#info()}... + * */ + protected final Logger progressLog = LoggerFactory.getLogger("NCLI_PROGRESS"); protected File workingDir; + protected ProgressMonitor progressMonitor = new NullProgressMonitor(); public AbstractSubCommand(){ initializeConfig(); @@ -88,4 +97,11 @@ abstract public class AbstractSubCommand { */ protected abstract T call(); + /** + * @param progressMonitor the progressMonitor to set + */ + public void setProgressMonitor(ProgressMonitor progressMonitor) { + this.progressMonitor = progressMonitor; + } + } diff --git a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java index 7e6f0bc..aadf8ff 100644 --- a/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java +++ b/org.tizen.ncli.ide/src/org/tizen/ncli/ide/subcommands/BuildWebCLICommand.java @@ -46,6 +46,8 @@ import org.tizen.common.util.OSChecker; import org.tizen.common.util.StringUtil; import org.tizen.core.ide.BuildWebAppModule; import org.tizen.core.ide.BuildWebParameter; +import org.tizen.core.ide.ProgressMonitor; +import org.tizen.ncli.ide.CLIConstant; import org.tizen.ncli.ide.shell.BuildWebCLI; import org.tizen.web.builder.HybridAppCLIBuilder; import org.tizen.web.builder.exception.MinifyException; @@ -60,16 +62,9 @@ import org.tizen.web.common.WebConstant; * */ public class BuildWebCLICommand extends AbstractSubCommand { - private Logger log = LoggerFactory.getLogger(getClass()); - - // file filter. If you want to exclude a directory, append '/*' - private static final String[] DEFAULT_EXCLUDES = { ".build" + File.separator + "*", ".project", - ".settings" + File.separator + "*", ".sdk_delta.info", "*.wgt" }; - // private BuildWebAppModule webAppBuild = new BuildWebAppModule(new BuildWebParameter(), ".", ".buildResult", new - // SimpleFileFilter(true), new WildCardFilterFactory(), new ArrayList()); private BuildWebAppModule buildWebAppModule = new BuildWebAppModule(); private BuildWebParameter webAppBuildData = new BuildWebParameter(); - + /** * With the {@link BuildWebParameter} , calling {@link BuildWebAppModule} to make out build result.
    * Below files or directories would be excluded by default.
    @@ -81,10 +76,10 @@ public class BuildWebCLICommand extends AbstractSubCommand { */ @Override protected BuildWebParameter call() { - log.trace("BuildWeb command started ..."); - log.info("-----------------------------------------------------"); - log.info("Starting Tizen project build:"); - log.info("-----------------------------------------------------"); + progressLog.info("-----------------------------------------------------"); + progressLog.info("Starting Tizen project build:"); + progressLog.info("-----------------------------------------------------"); + initExcludes(); if (log.isTraceEnabled()) { log.trace("BuildData: {}", webAppBuildData); @@ -97,23 +92,26 @@ public class BuildWebCLICommand extends AbstractSubCommand { buildWebAppModule.setCwd(canonicalPath); log.trace("canonicalPath:{}", canonicalPath); } catch (IOException e) { - e.printStackTrace(); + progressLog.error("Error occurred during setting current work path!"); + log.error("Error occurred during setting current work path!\n{}",e.getMessage()); } } try { + buildWebAppModule.setMonitor(progressMonitor); buildWebAppModule.setData(webAppBuildData); buildWebAppModule.buildResources(); } catch (IOException e) { e.printStackTrace(); } catch (BuildException e) { - e.printStackTrace(); + progressLog.error("Error occured during build!\n\t{}",e.getMessage()); + return webAppBuildData; } catch (Exception e) { e.printStackTrace(); } - + progressLog.info("\nBUILD SUCCESSFUL\n"); return webAppBuildData; } @@ -191,4 +189,11 @@ public class BuildWebCLICommand extends AbstractSubCommand { this.webAppBuildData.setReferences(refs); } + /** + * @return the progressMonitor + */ + public ProgressMonitor getProgressMonitor() { + return progressMonitor; + } + } diff --git a/org.tizen.ncli.ide/tizen.sh b/org.tizen.ncli.ide/tizen.sh index dad8570..e493f63 100755 --- a/org.tizen.ncli.ide/tizen.sh +++ b/org.tizen.ncli.ide/tizen.sh @@ -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" diff --git a/package/build.linux b/package/build.linux index 75df558..e29c5f1 100755 --- a/package/build.linux +++ b/package/build.linux @@ -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 diff --git a/package/new-cli.install.linux b/package/new-cli.install.linux index a7be48c..62811a1 100644 --- a/package/new-cli.install.linux +++ b/package/new-cli.install.linux @@ -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}"