plugins {
    id "org.jetbrains.kotlin.jvm" version '1.9.10'
    id "java-library"
    id "io.github.gradle-nexus.publish-plugin" version "1.3.0"
}

apply from: "${rootDir}/scripts/configure.gradle"

ext {
    PUBLISH_GROUP_ID = '{{ sdk.namespace | caseDot }}'
    PUBLISH_ARTIFACT_ID = '{{ sdk.gitRepoName | caseDash }}'
    PUBLISH_VERSION = System.getenv('SDK_VERSION')
    POM_URL = 'https://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName }}'
    POM_SCM_URL = 'https://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName }}'
    POM_ISSUE_URL = 'https://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName }}/issues'
    POM_DESCRIPTION = '{{ sdk.description }}'
    POM_LICENSE_URL = 'https://opensource.org/licenses/GPL-3.0'
    POM_LICENSE_NAME = "GPL-3.0"
    POM_DEVELOPER_ID = '{{ sdk.gitUserName }}'
    POM_DEVELOPER_NAME = '{{ spec.contactName }}'
    POM_DEVELOPER_EMAIL = '{{ spec.contactEmail }}'
    GITHUB_SCM_CONNECTION = 'scm:git:git://github.com/{{ sdk.gitUserName }}/{{ sdk.gitRepoName }}.git'
}

version PUBLISH_VERSION

repositories {
    mavenCentral()
}

dependencies {
    api("org.jetbrains.kotlinx:kotlinx-coroutines-core:1.7.1")

    api(platform("com.squareup.okhttp3:okhttp-bom:4.12.0"))
    api("com.squareup.okhttp3:okhttp")

    implementation("com.squareup.okhttp3:okhttp-urlconnection")
    implementation("com.squareup.okhttp3:logging-interceptor")
    implementation("com.google.code.gson:gson:2.9.0")

    testImplementation("org.jetbrains.kotlin:kotlin-test-junit")
}

test {
    useJUnit()
}

compileKotlin {
    dependsOn createBuildConfig
    kotlinOptions.jvmTarget = '1.8'
}

compileTestKotlin {
    kotlinOptions.jvmTarget = '1.8'
}

apply from: "${rootDir}/scripts/setup.gradle"
apply from: "${rootDir}/scripts/publish.gradle"
