corda/tools/demobench/build.gradle
2017-02-11 23:39:26 +00:00

183 lines
5.5 KiB
Groovy

buildscript {
ext.kotlin_version = '1.0.6'
ext.tornadofx_version = '1.6.0'
ext.jna_version = '4.1.0'
ext.purejavacomm_version = '0.0.17'
ext.guava_version = '14.0.1'
ext.slf4j_version = '1.7.22'
ext.logback_version = '1.1.10'
ext.java_home = System.properties.'java.home'
ext.pkg_source = "$buildDir/packagesrc"
ext.dist_source = "$pkg_source/demobench-$version"
ext.pkg_version = "$version".indexOf('-') >= 0 ? "$version".substring(0, "$version".indexOf('-')) : "$version"
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
}
}
apply plugin: 'java'
apply plugin: 'kotlin'
apply plugin: 'application'
evaluationDependsOn(':tools:explorer:capsule')
sourceCompatibility = 1.8
mainClassName = 'net.corda.demobench.DemoBench'
applicationDefaultJvmArgs = ['-Djava.util.logging.config.class=net.corda.demobench.config.LoggingConfig']
repositories {
flatDir {
dirs 'libs'
}
mavenLocal()
mavenCentral()
jcenter()
maven {
url 'http://www.sparetimelabs.com/maven2'
}
maven {
url 'https://dl.bintray.com/kotlin/exposed'
}
}
dependencies {
// TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.
compile "no.tornado:tornadofx:$tornadofx_version"
compile "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
// ONLY USING THE RPC CLIENT!?
compile project(':node')
compile "com.h2database:h2:$h2_version"
compile "net.java.dev.jna:jna:$jna_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.apache.logging.log4j:log4j-to-slf4j:$log4j_version"
compile "org.slf4j:log4j-over-slf4j:$slf4j_version"
compile "org.slf4j:jcl-over-slf4j:$slf4j_version"
compile "org.slf4j:jul-to-slf4j:$slf4j_version"
compile "ch.qos.logback:logback-classic:$logback_version"
compile "com.typesafe:config:$typesafe_config_version"
// 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 group: 'junit', name: 'junit', version: "$junit_version"
}
// We don't want the Node to drag these transitive dependencies in either!
configurations.all {
exclude module: 'commons-logging'
exclude module: 'log4j-slf4j-impl'
exclude module: 'log4j-core'
}
jar {
manifest {
attributes(
'Main-Class': mainClassName,
'Class-Path': configurations.compile.collect { it.getName() }.join(' ')
)
}
}
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(':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", "$buildDir/exedir"])
copy {
from(zipTree(distZip.outputs.files.singleFile))
into "$pkg_source"
}
copy {
from("$projectDir/package")
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: "$buildDir/exedir", outfile: 'DemoBench', verbose: 'true') {
application(name: 'DemoBench', version: "$pkg_version", mainClass: "$mainClassName")
info(title: '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')
}
preferences(install: false)
}
}
}