corda/tools/demobench/build.gradle
2017-05-12 12:15:17 +01:00

205 lines
6.3 KiB
Groovy

buildscript {
ext.tornadofx_version = '1.7.3'
ext.jna_version = '4.1.0'
ext.purejavacomm_version = '0.0.17'
ext.controlsfx_version = '8.40.12'
ext.java_home = System.properties.'java.home'
ext.pkg_source = "$buildDir/packagesrc"
ext.pkg_outDir = "$buildDir/javapackage"
ext.dist_source = "$pkg_source/demobench-$version"
ext.pkg_version = "$version".indexOf('-') >= 0 ? "$version".substring(0, "$version".indexOf('-')) : version
repositories {
mavenLocal()
mavenCentral()
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
evaluationDependsOn(':tools:explorer:capsule')
mainClassName = 'net.corda.demobench.DemoBench'
applicationDefaultJvmArgs = [
'-Djava.util.logging.config.class=net.corda.demobench.config.LoggingConfig',
'-Dorg.jboss.logging.provider=slf4j'
]
repositories {
flatDir {
dirs 'libs'
}
maven {
jcenter()
url 'http://www.sparetimelabs.com/maven2'
}
}
dependencies {
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.
compile "no.tornado:tornadofx:$tornadofx_version"
// Controls FX: more java FX components http://fxexperience.com/controlsfx/
compile "org.controlsfx:controlsfx:$controlsfx_version"
compile project(':client:rpc')
compile project(':finance')
compile "com.h2database:h2:$h2_version"
compile "net.java.dev.jna:jna-platform:$jna_version"
compile "com.google.guava:guava:$guava_version"
compile "com.sparetimelabs:purejavacomm:$purejavacomm_version"
compile "org.slf4j:log4j-over-slf4j:$slf4j_version"
compile "org.slf4j:jul-to-slf4j:$slf4j_version"
compile "org.apache.logging.log4j:log4j-slf4j-impl:$log4j_version"
compile "org.apache.logging.log4j:log4j-core:$log4j_version"
compile "com.typesafe:config:$typesafe_config_version"
// FontAwesomeFX: icons in the form of a font.
compile "de.jensd:fontawesomefx-fontawesome:4.7.0-5"
// These libraries don't exist in any Maven repository I can find.
// See: https://github.com/JetBrains/jediterm
//
// The terminal JAR here has also been tweaked:
// See: https://github.com/JetBrains/jediterm/issues/144
compile ':jediterm-terminal-2.5'
compile ':pty4j-0.7.2'
testCompile project(':node')
testCompile project(':webserver')
testCompile "junit:junit:$junit_version"
testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
testCompile "org.mockito:mockito-core:$mockito_version"
}
jar {
manifest {
attributes(
'Main-Class': mainClassName,
'Class-Path': configurations.compile.collect { it.getName() }.join(' ')
)
}
}
test {
systemProperty 'java.util.logging.config.class', 'net.corda.demobench.config.LoggingConfig'
systemProperty 'org.jboss.logging.provider', 'slf4j'
}
distributions {
main() {
contents {
into('lib/linux') {
from 'libs/linux'
}
into('lib/macosx') {
from 'libs/macosx'
}
into('lib/win') {
from 'libs/win'
}
from(project(':tools:explorer:capsule').tasks.buildExplorerJAR) {
rename 'node-explorer-(.*)', 'node-explorer.jar'
into 'explorer'
}
from(project(':node:capsule').tasks.buildCordaJAR) {
rename 'corda-(.*)', 'corda.jar'
into 'corda'
}
from(project(':webserver:webcapsule').tasks.buildWebserverJar) {
rename 'corda-webserver-(.*)', 'corda-webserver.jar'
into 'corda'
}
from(project(':samples:bank-of-corda-demo').jar) {
rename 'bank-of-corda-demo-(.*)', 'bank-of-corda.jar'
into 'plugins'
}
}
}
}
/*
* Bundles the application using JavaPackager,
* using the ZIP distribution as source.
*/
task javapackage(dependsOn: distZip) {
doLast {
delete([pkg_source, pkg_outDir])
copy {
from(zipTree(distZip.outputs.files.singleFile))
into pkg_source
}
copy {
/*
* Copy non-text formats "as-is".
*/
from("$projectDir/package") {
exclude '**/*.spec'
exclude '**/*.sh'
exclude '**/*.wsf'
exclude '**/*.manifest'
}
into "$pkg_source/package"
}
copy {
/*
* Expand tokens for text formats.
*/
from("$projectDir/package") {
include '**/*.spec'
include '**/*.sh'
include '**/*.wsf'
include '**/*.manifest'
}
filter {
line -> line.replaceAll('@pkg_version@', pkg_version)
}
into "$pkg_source/package"
}
ant.taskdef(
resource: 'com/sun/javafx/tools/ant/antlib.xml',
classpath: "$pkg_source:$java_home/../lib/ant-javafx.jar"
)
ant.deploy(nativeBundles: packageType, outdir: pkg_outDir, outfile: 'DemoBench', verbose: 'true') {
application(name: 'Corda DemoBench', version: pkg_version, mainClass: mainClassName)
info(title: 'Corda DemoBench', vendor: 'R3', description: 'A sales and educational tool for demonstrating Corda.')
resources {
fileset(dir: "$dist_source/lib", type: 'jar') {
include(name: '*.jar')
}
fileset(dir: "$dist_source/lib", type: 'native') {
include(name: "macosx/**/*.dylib")
include(name: "win/**/*.dll")
include(name: "win/**/*.exe")
include(name: "linux/**/*.so")
}
fileset(dir: dist_source, type: 'data') {
include(name: 'corda/*.jar')
include(name: 'plugins/*.jar')
include(name: 'explorer/*.jar')
}
}
platform {
property(name: 'java.util.logging.config.class', value: 'net.corda.demobench.config.LoggingConfig')
property(name: 'org.jboss.logging.provider', value: 'slf4j')
}
preferences(install: true)
}
}
}