import dependencies.Dep

apply plugin: 'com.android.library'
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlinx-serialization'
apply plugin: 'kotlin-android-extensions'

apply from: rootProject.file('gradle/android.gradle')


androidExtensions {
    experimental = true
    features = ["parcelize"]
}
kotlin {
    targets {
        fromPreset(presets.android, 'android')
        fromPreset(presets.jvm, 'jvm')
        final def iOSTarget = System.getenv('SDK_NAME')?.startsWith("iphoneos") \
                              ? presets.iosArm64 : presets.iosX64

        fromPreset(iOSTarget, 'iOS') {
            compilations.main.outputKinds('FRAMEWORK')
        }
    }
    sourceSets {
        commonMain {
            languageSettings {
                languageVersion = '1.3'
                apiVersion = '1.3'
                progressiveMode = true
            }
            dependencies {
                api Dep.Kotlin.stdlibCommon
                api Dep.Klock.common
                implementation Dep.Kotlin.serializationCommon
            }
        }
        jvmMain {
            dependencies {
                api Dep.Kotlin.stdlibJvm
            }
        }
        androidMain {
            dependsOn commonMain
            dependencies {
                api Dep.Kotlin.stdlibJvm
            }
        }
        commonTest.dependencies {
            implementation Dep.Test.KotlinMultiPlatform.commonModuleTest
            implementation Dep.Test.KotlinMultiPlatform.commonModuleTestAnnotations
            implementation Dep.MockK.common
        }
        jvmTest {
            dependsOn jvmMain
            dependencies {
                implementation Dep.Test.KotlinMultiPlatform.jvmModuleTest
                implementation Dep.Test.KotlinMultiPlatform.jvmModuleTestJunit
                implementation Dep.MockK.jvm
            }
        }
        iOSMain {
            dependsOn commonMain
            dependencies {
                implementation Dep.Kotlin.serializationIos
            }
        }
    }
}
configurations {
    compileClasspath
}
