buildscript {
    apply from: './constants.gradle'
}
buildscript {
    ext.kotlin_version = '1.8.0'
    ext.ktor_version = '2.2.4'

    repositories {
        mavenCentral()
    }
    dependencies {
        classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version"
    }
}

plugins {
    id 'org.jetbrains.kotlin.plugin.serialization'
    id 'org.jetbrains.kotlin.jvm'
    id "com.github.johnrengelman.shadow" version "7.1.2"
}
version '1.3-SNAPSHOT'
group 'de.jensklingenberg'

apply plugin: 'application'

sourceCompatibility = 1.8
mainClassName = 'de.jensklingenberg.showdown.server.server.ShowdownApplicationKt'

shadowJar {
    manifest {
        attributes 'Main-Class': 'de.jensklingenberg.showdown.server.server.ShowdownApplicationKt'
    }
}
task stage {
    dependsOn clean, installShadowDist
}


def klockVersion = '2.7.0'
dependencies {
    implementation projects.shared
    implementation "io.ktor:ktor-server-core:$ktor_version"
    implementation "io.ktor:ktor-server-content-negotiation:$ktor_version"
    implementation "io.ktor:ktor-server-sessions:$ktor_version"
    implementation "io.ktor:ktor-server-compression:$ktor_version"
    implementation "io.ktor:ktor-server-netty:$ktor_version"
    implementation "io.ktor:ktor-serialization-gson:$ktor_version"
    implementation "io.ktor:ktor-server-websockets:$ktor_version"
    implementation "com.squareup.moshi:moshi-kotlin:${libs.moshikotlin}"
    implementation 'org.jetbrains.kotlinx:kotlinx-serialization-core:1.4.1'
    implementation("com.soywiz.korlibs.klock:klock-jvm:$klockVersion")
    testImplementation 'org.mockito:mockito-core:4.8.0'
    testImplementation "com.nhaarman.mockitokotlin2:mockito-kotlin:2.2.0"
    testImplementation group: 'junit', name: 'junit', version: '4.13.1'
}

sourceSets {
    main.kotlin.srcDirs += "src/main/kotlin"
}

compileKotlin {
    kotlinOptions.jvmTarget = "1.8"
}
compileTestKotlin {
    kotlinOptions.jvmTarget = "1.8"
}

build {
    dependsOn(shadowJar)
}