ext { tornadofx_version = '1.7.15' jna_version = '4.1.0' purejavacomm_version = '0.0.18' controlsfx_version = '8.40.12' java_home = System.properties.'java.home' pkg_source = "$buildDir/packagesrc" pkg_outDir = "$buildDir/javapackage" dist_source = "$pkg_source/demobench-$version" pkg_version = version.indexOf('-') >= 0 ? version.substring(0, version.indexOf('-')) : version pkg_macosxKeyUserName = 'R3CEV' } apply plugin: 'java' apply plugin: 'kotlin' apply plugin: 'application' evaluationDependsOn(':tools:explorer:capsule') evaluationDependsOn(':webserver:webcapsule') 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' } jcenter() maven { url 'http://www.sparetimelabs.com/maven2' } } configurations { compile { // We don't need Hibernate just for its @Type annotation. exclude group: 'org.hibernate', module: 'hibernate-core' } } 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" // JediTerm: the terminal emulator used in IntelliJ. We have forked it and tweaked it, see https://github.com/corda/jediterm compile ':terminal-331a005d6793e52cefc9e2cec6774e62d5a546b1' compile ':pty4j-0.7.2' testCompile project(':test-utils') testCompile project(':webserver') testCompile "junit:junit:$junit_version" testCompile "org.jetbrains.kotlin:kotlin-test:$kotlin_version" testCompile "org.assertj:assertj-core:$assertj_version" } tasks.withType(JavaCompile) { // Resolves a Gradle warning about not scanning for pre-processors. options.compilerArgs << '-proc:none' } jar { manifest { attributes( 'Main-Class': mainClassName, 'Class-Path': configurations.runtimeClasspath.collect { it.name }.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' fileMode = 0555 } into('lib/macosx') { from 'libs/macosx' fileMode = 0555 } into('lib/win') { from 'libs/win' fileMode = 0555 } from(project(':tools:explorer:capsule').tasks.buildExplorerJAR) { rename 'node-explorer-(.*)', 'node-explorer.jar' into 'explorer' fileMode = 0444 } from(project(':node:capsule').tasks.buildCordaJAR) { rename 'corda-(.*)', 'corda.jar' into 'corda' fileMode = 0444 } from(project(':webserver:webcapsule').tasks.buildWebserverJar) { rename 'corda-webserver-(.*)', 'corda-webserver.jar' into 'corda' fileMode = 0444 } from(project(':finance').tasks.jar) { rename 'corda-finance-(.*)', 'corda-finance.jar' into 'cordapps' fileMode = 0444 } } } } /* * 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) .replaceAll('@signingKeyUserName@', pkg_macosxKeyUserName) } 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.') //noinspection GroovyAssignabilityCheck 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: 'cordapps/*.jar') include(name: 'explorer/*.jar') } fileset(dir: "$pkg_source/package", type: 'data') { include(name: "bugfixes/**") } } // This is specific to MacOSX packager. bundleArgument(arg: 'mac.signing-key-user-name', value: pkg_macosxKeyUserName) platform { //noinspection GroovyAssignabilityCheck property(name: 'java.util.logging.config.class', value: 'net.corda.demobench.config.LoggingConfig') //noinspection GroovyAssignabilityCheck property(name: 'org.jboss.logging.provider', value: 'slf4j') } preferences(install: true) } } }