瀏覽代碼

small buildscript changes & added a progress indicator to the WPCMgr
utility

LH 9 年之前
父節點
當前提交
55ac48ed4e
共有 3 個文件被更改,包括 56 次插入6 次删除
  1. 3 0
      UpidTK/build.gradle
  2. 35 1
      WPCMGr/build.gradle
  3. 18 5
      WPCMGr/src/main/java/de/nplusc/izc/Utilities/WPCMgr/Synchronizer.java

+ 3 - 0
UpidTK/build.gradle

@@ -36,6 +36,9 @@ dependencies{
 	compile 'org.apache.commons:commons-exec:1.3'
     compile	'org.xerial:sqlite-jdbc:3.8.7'
 	compile 'mysql:mysql-connector-java:5.1.6'
+    compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-iostreams', version: '2.1'
 	compile(project(':ToolKit')) {
         transitive = false
     }

+ 35 - 1
WPCMGr/build.gradle

@@ -2,7 +2,7 @@ defaultTasks 'distZip'
 
 apply plugin: 'java'
 apply plugin: 'application'
-
+apply from: "$rootDir/utils/IO.gradle"
 
 sourceCompatibility = 1.8
 version = 'SNAPSHOT'
@@ -29,14 +29,48 @@ options.compilerArgs << '-Xlint:-deprecation'
 
 options.compilerArgs << '-XDignore.symbol.file'
 }
+startScripts << { 
+
+  def startScriptDir = outputDir.getAbsolutePath()
+  def winStartScript = startScriptDir + "/" + applicationName + ".bat"
+  def winStartScriptCopy = startScriptDir + "/" + applicationName + "c.bat"
+  def overwriteExistingFile = true
+  copyFile(winStartScript, winStartScriptCopy, overwriteExistingFile)
+
+  modifyFile(winStartScript) {
+    // javaw.exe doesn't have a console
+    if(it.contains("java.exe")){
+      return it.replace("java.exe", "javaw.exe")
+    }
+    // Command that launches the app
+    else if(it.startsWith("\"%JAVA_EXE%\" %DEFAULT_JVM_OPTS%")){
+      return "start \"\" /b " + it
+    }
+    // Leave the line unchanged
+    else{
+      return it
+    }
+  }
+}
+distZip {
+  // Include the additional start script
+  into(project.name+"-"+project.version+"/bin/"){
+    from(startScripts.outputDir)
+	include '*c.bat'
+  }
+}
 
 dependencies{
 	compile fileTree(dir: 'lib', include: '*.jar')
+        compile "net.rubygrapefruit:native-platform:0.9"
 	compile "commons-io:commons-io:2.+"
 	compile 'org.apache.commons:commons-exec:1.3'
 	compile "org.yaml:snakeyaml:1.14"
 	compile 'org.ini4j:ini4j:0.5.2'
 	compile 'mysql:mysql-connector-java:5.1.6'
+        compile group: 'org.apache.logging.log4j', name: 'log4j-api', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-core', version: '2.1'
+	compile group: 'org.apache.logging.log4j', name: 'log4j-iostreams', version: '2.1'
 	compile(project(':ToolKit')) {
         transitive = false
     }

+ 18 - 5
WPCMGr/src/main/java/de/nplusc/izc/Utilities/WPCMgr/Synchronizer.java

@@ -54,7 +54,7 @@ public class Synchronizer
             LinkedHashMap<String,Object> data = (LinkedHashMap<String,Object>) new Yaml().load(new FileInputStream(path+"\\00_meta\\state.yml"));
             if(data.get("HEAD")==null)
             {
-            initPipeLine(path, res);
+                initPipeLine(path, res);
             }
             else
             {
@@ -88,7 +88,15 @@ public class Synchronizer
 
         //FileTK.writeFile(new Yaml().dump(cmdQueue),"T:\\wpc\\00_meta\\debug_.yaml");
 
-            cmdQueue.forEach(x -> Tools.runCmdWithPassthru(System.out, x));
+        //FileTK.writeFile(new Yaml().dump(cmdQueue),"T:\\wpc\\00_meta\\debug_.yaml");
+        final int length = cmdQueue.size();
+        cmdQueue.forEach(x -> 
+        {
+            Tools.runCmdWithPassthru(null, x);
+            System.out.println("\rVerarbeitet: "+(++pos)+"/"+length);
+        });
+        System.out.println("\nFertigstellen....");
+
         
         
         try
@@ -111,6 +119,7 @@ public class Synchronizer
         System.exit(0);
     }
     
+    private static int pos;
     public static void updatePipeLine(String path,String res)
     {
         DumperOptions yamlOptions = new DumperOptions();
@@ -145,9 +154,13 @@ public class Synchronizer
         
 
         //FileTK.writeFile(new Yaml().dump(cmdQueue),"T:\\wpc\\00_meta\\debug_.yaml");
-
-        cmdQueue.forEach(x -> Tools.runCmdWithPassthru(System.out, x));
-
+        final int length = cmdQueue.size();
+        cmdQueue.forEach(x -> 
+        {
+            Tools.runCmdWithPassthru(null, x);
+            System.out.println("\rVerarbeitet: "+(++pos)+"/"+length);
+        });
+        System.out.println("\nFertigstellen....");
 
 
         String targetDir = (String) data.get("Outdir");