// JDK 11 JavaFX
plugins {
    id 'org.openjfx.javafxplugin' version '0.0.7' apply false
}

apply plugin: 'org.openjfx.javafxplugin'
javafx {
    version = "11.0.2"
    modules = [
        'javafx.controls',
        'javafx.fxml',
        'javafx.swing'
    ]
}

apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'application'

mainClassName = 'net.corda.explorer.Main'

dependencies {
    testImplementation "junit:junit:$junit_version"

    testRuntimeOnly "org.junit.vintage:junit-vintage-engine:${junit_vintage_version}"
    testRuntimeOnly "org.junit.platform:junit-platform-launcher:${junit_platform_version}"

    testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"

    // TornadoFX: A lightweight Kotlin framework for working with JavaFX UI's.
    implementation 'no.tornado:tornadofx:1.5.9'

    // Corda Core: Data structures and basic types needed to work with Corda.
    implementation project(':core')
    implementation project(':client:rpc')
    implementation project(':client:jfx')
    implementation project(':finance:contracts')
    implementation project(':finance:workflows')
    implementation project(':tools:worldmap')
    implementation project(':common-logging')

    // Log4J: logging framework (with SLF4J bindings)
    implementation "org.apache.logging.log4j:log4j-slf4j2-impl:$log4j_version"

    // Capsule is a library for building independently executable fat JARs.
    // We only need this dependency to implementation our Caplet against.
    implementation "co.paralleluniverse:capsule:$capsule_version"

    // FontAwesomeFX: The "FontAwesome" icon library.
    implementation "de.jensd:fontawesomefx-fontawesome:$fontawesomefx_fontawesome_version"
    implementation "de.jensd:fontawesomefx-commons:$fontawesomefx_commons_version"

    // ReactFX: Functional reactive UI programming.
    implementation 'org.reactfx:reactfx:2.0-M5'
    implementation 'org.fxmisc.easybind:easybind:1.0.3'

    implementation 'org.jfxtras:jfxtras-font-roboto:8.0-r6'

    // Humanize: formatting
    implementation 'com.github.mfornos:humanize-icu:1.2.2'

    // Controls FX: more java FX components http://fxexperience.com/controlsfx/
    implementation "org.controlsfx:controlsfx:$controlsfx_version"
    // This provide com.apple.eawt stub for non-mac system.
    implementation 'com.yuvimasory:orange-extensions:1.3.0'

    // JOpt: for command line flags.
    implementation "net.sf.jopt-simple:jopt-simple:$jopt_simple_version"

    implementation "org.apache.commons:commons-lang3:$commons_lang3_version"
    implementation "com.github.ben-manes.caffeine:caffeine:$caffeine_version"
}

compileJava.dependsOn ':testing:testserver:testcapsule:buildWebserverJar'
startScripts.dependsOn ':testing:testserver:testcapsule:buildWebserverJar'
startScripts.dependsOn ':node:capsule:buildCordaJAR'

tasks.withType(JavaCompile).configureEach {
    // Resolves a Gradle warning about not scanning for pre-processors.
    options.compilerArgs << '-proc:none'
}

jar {
    manifest {
        attributes(
            'Automatic-Module-Name': 'net.corda.tools.explorer'
        )
    }
}
