plugins {
    id 'java-library'
    id 'application'
    id 'org.openjfx.javafxplugin' version '0.0.10'
    id 'jacoco'
}

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

group 'ch.unibas.dmi.dbis'
version '0.0.1-ALPHA'
mainClassName = 'ch.unibas.dmi.dbis.cs108.multiplayer.client.Client'

java {
    toolchain {
        languageVersion = JavaLanguageVersion.of(11)
    }
}

//adds maven central as a maven repository
repositories {
    mavenCentral()
}

//adds all needed external libraries to gradle
dependencies {

    implementation 'org.apache.logging.log4j:log4j-api:2.17.1'
    implementation 'org.apache.logging.log4j:log4j-core:2.17.1'
    implementation 'org.openjfx:javafx-controls:18'
    implementation group: 'org.apache.commons', name: 'commons-collections4', version: '4.4'
    testImplementation('org.junit.jupiter:junit-jupiter:5.8.2')
}

test {
    useJUnitPlatform()
}

/*
The following block adds both compile and runtime dependencies to the jar
 */
jar {
    manifest {
        attributes(
                'Main-Class': mainClassName
        )
    }
    from {
        configurations.compileClasspath.collect { it.isDirectory() ? it : zipTree(it) }
        configurations.runtimeClasspath.collect { it.isDirectory() ? it : zipTree(it) }
    }
}
