diff --git a/tools/demobench/build.gradle b/tools/demobench/build.gradle index b463890260..cd20207889 100644 --- a/tools/demobench/build.gradle +++ b/tools/demobench/build.gradle @@ -78,7 +78,10 @@ configurations.all { jar { manifest { - attributes 'Main-Class': mainClassName + attributes( + 'Main-Class': mainClassName, + 'Class-Path': configurations.compile.collect { it.getName() }.join(' ') + ) } } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt index 4abfa41e83..651bd6856a 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/DemoBench.kt @@ -35,7 +35,18 @@ import tornadofx.addStageIcon */ class DemoBench : App(DemoBenchView::class) { + + /* + * This entry point is needed by JavaPackager, as + * otherwise the packaged application cannot run. + */ + companion object { + @JvmStatic + fun main(args: Array) = launch(DemoBench::class.java, *args) + } + init { addStageIcon(Image("r3logo.png")) } } + diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt index ef113591c9..89b9053fcf 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/ExplorerController.kt @@ -6,7 +6,7 @@ import java.nio.file.Paths class ExplorerController : Controller() { private val jvm by inject() - private val explorerPath = Paths.get("explorer", "node-explorer.jar").toAbsolutePath() + private val explorerPath = jvm.applicationDir.resolve("explorer").resolve("node-explorer.jar") init { log.info("Explorer JAR: " + explorerPath) diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt index 64dd0fa0b2..7bac668d1c 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/JVMConfig.kt @@ -6,7 +6,9 @@ import tornadofx.Controller class JVMConfig : Controller() { + val userHome: Path = Paths.get(System.getProperty("user.home")).toAbsolutePath() val javaPath: Path = Paths.get(System.getProperty("java.home"), "bin", "java") + val applicationDir = Paths.get(System.getProperty("user.dir")).toAbsolutePath() init { log.info("Java executable: " + javaPath) @@ -20,4 +22,5 @@ class JVMConfig : Controller() { return Runtime.getRuntime().exec(commandFor(jarPath, *args)) } -} \ No newline at end of file +} + diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt index ca2bdfd276..431d137669 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/model/NodeController.kt @@ -11,17 +11,20 @@ import net.corda.demobench.pty.R3Pty import tornadofx.Controller class NodeController : Controller() { - companion object Data { - private const val FIRST_PORT = 10000 + private companion object Data { + const val FIRST_PORT = 10000 } - private val baseDir = Paths.get("work", localDir).toAbsolutePath() - private val pluginDir = Paths.get("plugins").toAbsolutePath() private val jvm by inject() + private val localDir = SimpleDateFormat("yyyyMMddHHmmss") + .format(Date(ManagementFactory.getRuntimeMXBean().startTime)) + private val baseDir = jvm.userHome.resolve("demobench").resolve(localDir) + private val pluginDir = jvm.applicationDir.resolve("plugins") + private val bankOfCorda = pluginDir.resolve("bank-of-corda.jar").toFile() - private val cordaPath = Paths.get("corda", "corda.jar").toAbsolutePath() + private val cordaPath = jvm.applicationDir.resolve("corda").resolve("corda.jar") private val command = jvm.commandFor(cordaPath) private val renderOptions = ConfigRenderOptions.defaults().setOriginComments(false) @@ -102,8 +105,4 @@ class NodeController : Controller() { } } - private val localDir: String - get() = SimpleDateFormat("yyyyMMddHHmmss") - .format(Date(ManagementFactory.getRuntimeMXBean().startTime)) - } diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt index be652abe5a..2d1e015a6d 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/rpc/NodeRPC.kt @@ -29,6 +29,8 @@ class NodeRPC(config: NodeConfig, invoke: (CordaRPCOps) -> Unit): AutoCloseable // Cancel the "setup" task now that we've created the RPC client. this.cancel() + log.info("Node '{}' is now ready.", config.legalName) + // Schedule a new task that will refresh the display once per second. timer.schedule(object: TimerTask() { override fun run() { diff --git a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt index 1abddd1e53..6b9257df42 100644 --- a/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt +++ b/tools/demobench/src/main/kotlin/net/corda/demobench/views/NodeTerminalView.kt @@ -117,13 +117,9 @@ class NodeTerminalView : Fragment() { } class TerminalSettingsProvider : DefaultSettingsProvider() { - override fun getDefaultStyle(): TextStyle { - return TextStyle(TerminalColor.WHITE, TerminalColor.BLACK) - } + override fun getDefaultStyle() = TextStyle(TerminalColor.WHITE, TerminalColor.BLACK) - override fun emulateX11CopyPaste(): Boolean { - return true - } + override fun emulateX11CopyPaste() = true } } diff --git a/tools/demobench/src/main/resources/logback.xml b/tools/demobench/src/main/resources/logback.xml index 35361a9ef1..5c8791e991 100644 --- a/tools/demobench/src/main/resources/logback.xml +++ b/tools/demobench/src/main/resources/logback.xml @@ -3,7 +3,7 @@ - demobench.log + ${user.home}/demobench.log false %date %-5level %c{1} - %msg%n @@ -13,4 +13,4 @@ - \ No newline at end of file +