import dependencies.Dep

def ideaActive = System.getProperty("idea.active") == "true"

apply plugin: 'com.android.library'
apply plugin: 'kotlin-multiplatform'
apply plugin: 'kotlin-kapt'

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

kotlin {
    android("android")
    iosArm64("iosArm64") {
        binaries {
            framework {
                freeCompilerArgs += "-Xobjc-generics"
            }
        }
    }
    iosX64("iosX64") {
        binaries {
            framework {
                freeCompilerArgs += "-Xobjc-generics"
            }
        }
    }
    if (ideaActive) {
        iosX64("ios") {
            binaries {
                framework {
                    freeCompilerArgs += "-Xobjc-generics"
                }
            }
        }
    }
    sourceSets {
        commonMain.dependencies {
            implementation Dep.Kotlin.stdlibCommon
            api project(":model")
            implementation project(":data:api")
            implementation Dep.Kotlin.coroutinesCommon
            implementation Dep.Klock.common
        }
        androidMain {
            dependsOn commonMain
            dependencies {
                implementation Dep.Kotlin.stdlibJvm
                implementation project(":data:device")
                implementation project(":data:firestore")
                implementation project(':ext:log')
                implementation project(":data:db")
                implementation project(":corecomponent:androidcomponent")

                implementation Dep.Kotlin.stdlibJvm
                implementation Dep.Kotlin.coroutines
                implementation Dep.AndroidX.lifecycleLiveData
                implementation Dep.AndroidX.Work.runtimeKtx

                implementation Dep.Dagger.core
                implementation Dep.Dagger.androidSupport
            }
        }
        commonTest.dependencies {
            implementation Dep.Test.KotlinMultiPlatform.commonModuleTest
            implementation Dep.Test.KotlinMultiPlatform.commonModuleTestAnnotations
            implementation Dep.MockK.common
        }
        androidTest {
            dependsOn commonMain
            dependencies {
                implementation Dep.Test.KotlinMultiPlatform.jvmModuleTest
                implementation Dep.Test.KotlinMultiPlatform.jvmModuleTestJunit
                implementation Dep.MockK.jvm
            }
        }
    }
}

dependencies {
    kapt Dep.Dagger.compiler
    kapt Dep.Dagger.androidProcessor
}

configurations {
    compileClasspath
}
