plugins {
    id 'java-library'
    id 'maven-publish'
    id 'kotlin'
}

repositories {
    mavenCentral()
}

final JVM_TARGET = '1.8'

compileKotlin {
    kotlinOptions {
        jvmTarget = JVM_TARGET
    }
}
compileTestKotlin {
    kotlinOptions {
        jvmTarget = JVM_TARGET
    }
}

task sourcesJar(type: Jar) {
    archiveClassifier.set('sources')
    from sourceSets.main.allSource
}

java {
    sourceCompatibility = JavaVersion.VERSION_1_8
    targetCompatibility = JavaVersion.VERSION_1_8

    withSourcesJar()
}

afterEvaluate {
    publishing {
        publications {
            release(MavenPublication) {
                from components.java

                groupId = appGroupId
                artifactId = project.name
                version = appVersion
            }
        }
    }
}

/* --------------------------------------------------- */
/* > Dependencies */
/* --------------------------------------------------- */

dependencies {
    implementation fileTree(dir: 'libs', include: ['*.jar'])

    implementation 'com.squareup.okio:okio:2.10.0'
    implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
    implementation deps.coroutine

    final kotestVersion = "4.6.1"
    testImplementation "io.kotest:kotest-runner-junit5:$kotestVersion"
    testImplementation "io.kotest:kotest-assertions-core:$kotestVersion"
}
