plugins {
    id 'java'
    id 'application'
    id 'com.github.johnrengelman.shadow' version '6.1.0'
    id 'org.openjfx.javafxplugin' version '0.0.9'
    id 'org.beryx.jlink' version '2.15.1'
}

group 'org.example'
version '1.0-SNAPSHOT'

sourceCompatibility = 11

repositories {
    mavenCentral()
}

javafx {
    version = "11.0.2"
    modules = [ 'javafx.controls', 'javafx.fxml', 'javafx.graphics', 'javafx.base']
}


dependencies {
    compile group: 'com.googlecode.json-simple', name: 'json-simple', version: '1.1.1'
    testImplementation 'org.junit.jupiter:junit-jupiter-api:5.6.0'
    compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
    testRuntimeOnly 'org.junit.jupiter:junit-jupiter-engine'
    compile group: 'mysql', name: 'mysql-connector-java', version: '8.0.22'
    runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:win"
    runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:linux"
    runtimeOnly "org.openjfx:javafx-graphics:$javafx.version:mac"
}

mainClassName = 'chatapp.Launcher'

jlink {
    options = ['--strip-debug', '--compress', '2', '--no-header-files', '--no-man-pages']
    launcher {
        name = 'hellofx'
    }
}

test {
    useJUnitPlatform()
}

jar {
    manifest {
        attributes "Main-Class": "chatapp.Launcher"
    }

    from {
        configurations.compile.collect { it.isDirectory() ? it : zipTree(it) }
    }
}
