plugins {
    id 'com.android.library'
    alias(libs.plugins.kotlinAndroid)
    id 'kotlin-kapt'
    alias(libs.plugins.androidJunit5)
}

android {
    namespace 'com.github.anrimian.musicplayer.data'

    def config = rootProject.ext

    compileSdkVersion = config.androidCompileSdkVersion
    buildToolsVersion = config.androidBuildToolsVersion

    defaultConfig {
        minSdkVersion config.androidMinSdkVersion
        targetSdkVersion config.androidTargetSdkVersion

        testInstrumentationRunner config.testInstrumentationRunner
        testInstrumentationRunnerArguments["runnerBuilder"] = config.testJunit5Builder

        compileOptions {
            sourceCompatibility JavaVersion.VERSION_11
            targetCompatibility JavaVersion.VERSION_11
        }

        javaCompileOptions {
            annotationProcessorOptions {
                arguments = ["room.schemaLocation": "$projectDir/schemas".toString()]
            }
        }
        sourceSets {
            androidTest.assets.srcDirs += files("$projectDir/schemas".toString())
        }
    }

    buildTypes {
        QA {
            initWith release
        }
    }

    testOptions {
        unitTests.returnDefaultValues = true
    }
    packagingOptions {
        resources {
            excludes += [
                    'META-INF/*',
            ]
        }
    }
}

dependencies {
    implementation project(':domain')

    implementation libs.kotlinStdLib

    implementation libs.appCompat
    implementation libs.documentFile
    implementation libs.rxJava
    implementation libs.coroutinesCore
    implementation libs.exoPlayerCore

    compileOnly libs.javaxAnnotation

    implementation libs.room
    implementation libs.roomRx
    kapt libs.roomCompiler

    implementation libs.libjAudioTagger

    testImplementation libs.junit5
    testImplementation libs.junit5Params
    testRuntimeOnly libs.junit5Engine
    testImplementation libs.mockito
    testImplementation libs.mockitoKt

    androidTestImplementation libs.androidXTestRunner
    androidTestImplementation libs.junit5
    androidTestImplementation libs.espresso
    androidTestImplementation libs.androidXTestRules
    androidTestImplementation libs.rxJavaExt
    androidTestImplementation libs.roomTest

}