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

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

apply plugin: 'org.jetbrains.kotlin.jvm'
apply plugin: 'net.corda.plugins.quasar-utils'

description 'Corda client JavaFX modules'

//noinspection GroovyAssignabilityCheck
configurations {
    integrationTestImplementation.extendsFrom testImplementation
    integrationTestRuntime.extendsFrom testRuntimeOnly
}

sourceSets {
    integrationTest {
        kotlin {
            compileClasspath += main.output + test.output
            runtimeClasspath += main.output + test.output
            srcDir file('src/integration-test/kotlin')
        }
    }
}

// To find potential version conflicts, run "gradle htmlDependencyReport" and then look in
// build/reports/project/dependencies/index.html for green highlighted parts of the tree.

dependencies {
    implementation project(':core')
    implementation project(':finance:contracts')
    implementation project(':finance:workflows')
    implementation project(':client:rpc')

    implementation "com.google.guava:guava:$guava_version"
    implementation "io.reactivex:rxjava:$rxjava_version"

    // For caches rather than guava
    implementation "com.github.ben-manes.caffeine:caffeine:$caffeine_version"

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

    // Artemis Client: ability to connect to an Artemis broker and control it.
    // TODO: remove the forced update of commons-collections and beanutils when artemis updates them
    implementation "org.apache.commons:commons-collections4:${commons_collections_version}"
    implementation "commons-beanutils:commons-beanutils:${beanutils_version}"
    implementation("org.apache.activemq:artemis-core-client:${artemis_version}") {
        exclude group: 'org.jgroups', module: 'jgroups'
    }

    // Unit testing helpers.
    testImplementation "org.junit.jupiter:junit-jupiter-api:${junit_jupiter_version}"
    testImplementation "junit:junit:$junit_version"

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

    testImplementation "org.jetbrains.kotlin:kotlin-test:$kotlin_version"
    testImplementation "org.assertj:assertj-core:${assertj_version}"

    testImplementation project(':test-utils')

    // Integration test helpers
    integrationTestImplementation "junit:junit:$junit_version"
    integrationTestImplementation project(':node-driver')
}

task integrationTest(type: Test) {
    testClassesDirs = sourceSets.integrationTest.output.classesDirs
    classpath = sourceSets.integrationTest.runtimeClasspath
}

jar {
    baseName 'corda-jfx'
    manifest {
        attributes 'Automatic-Module-Name': 'net.corda.client.jfx'
    }
}

publishing {
    publications {
        maven(MavenPublication) {
            artifactId jar.baseName
            from components.java
        }
    }
}
