gradle task to install all devices
This commit is contained in:
parent
a606777120
commit
4f0b12bbad
@ -7,3 +7,48 @@ dependencies {
|
|||||||
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.12'
|
compile group: 'org.controlsfx', name: 'controlsfx', version: '8.40.12'
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
task installAll(type: Copy) {
|
||||||
|
group "numass"
|
||||||
|
|
||||||
|
description "Install all control projects into the same directory"
|
||||||
|
|
||||||
|
def parser = new XmlParser()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
subprojects { sub ->
|
||||||
|
dependsOn sub.getTasksByName("installDist", false).first()
|
||||||
|
String distDir = "${sub.buildDir}/install/${sub.name}"
|
||||||
|
from distDir
|
||||||
|
}
|
||||||
|
into "$buildDir/install/numass-control"
|
||||||
|
|
||||||
|
doLast {
|
||||||
|
def configRoot = new Node(null, "config");
|
||||||
|
subprojects { sub ->
|
||||||
|
//add device configuration file
|
||||||
|
def cfgFile = sub.file("src/main/resources/config/devices.xml")
|
||||||
|
if (cfgFile.exists()) {
|
||||||
|
println "Found device config file ${cfgFile}"
|
||||||
|
parser.parse(cfgFile).children().each {
|
||||||
|
configRoot.append(it as Node)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if (!configRoot.children().isEmpty()) {
|
||||||
|
File outFile = file("$buildDir/install/numass-control/config/devices.xml")
|
||||||
|
outFile.getParentFile().mkdirs();
|
||||||
|
outFile.createNewFile();
|
||||||
|
new XmlNodePrinter(outFile.newPrintWriter()).print(configRoot)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
task distAll(dependsOn: installAll, type: Zip) {
|
||||||
|
group "numass"
|
||||||
|
|
||||||
|
description "Make a distribution of all control projects"
|
||||||
|
|
||||||
|
from "$buildDir/install/numass-control"
|
||||||
|
}
|
@ -26,7 +26,7 @@ dependencies {
|
|||||||
compile 'org.controlsfx:controlsfx:8.40.12'
|
compile 'org.controlsfx:controlsfx:8.40.12'
|
||||||
|
|
||||||
compile "no.tornado:tornadofx:1.7.4"
|
compile "no.tornado:tornadofx:1.7.4"
|
||||||
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-2"
|
compile "org.jetbrains.kotlin:kotlin-stdlib-jre8:1.1.2-3"
|
||||||
}
|
}
|
||||||
|
|
||||||
apply plugin: 'kotlin'
|
apply plugin: 'kotlin'
|
||||||
|
@ -29,7 +29,6 @@ import java.time.Instant;
|
|||||||
import java.util.Locale;
|
import java.util.Locale;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
*
|
|
||||||
* @author Alexander Nozik
|
* @author Alexander Nozik
|
||||||
*/
|
*/
|
||||||
public class Talk {
|
public class Talk {
|
||||||
@ -60,7 +59,7 @@ public class Talk {
|
|||||||
while (!"exit".equals(nextString)) {
|
while (!"exit".equals(nextString)) {
|
||||||
try {
|
try {
|
||||||
Instant start = DateTimeUtils.now();
|
Instant start = DateTimeUtils.now();
|
||||||
String answer = handler.sendAndWait(nextString + "\r", null, 1000);
|
String answer = handler.sendAndWait(nextString + "\r", 1000);
|
||||||
//String answer = controller.request(nextString);
|
//String answer = controller.request(nextString);
|
||||||
System.out.printf("ANSWER (latency = %s): %s;%n", Duration.between(start, DateTimeUtils.now()), answer.trim());
|
System.out.printf("ANSWER (latency = %s): %s;%n", Duration.between(start, DateTimeUtils.now()), answer.trim());
|
||||||
} catch (PortException ex) {
|
} catch (PortException ex) {
|
||||||
|
Loading…
Reference in New Issue
Block a user