/* This Source Code Form is subject to the terms of the Mozilla Public
 * License, v. 2.0. If a copy of the MPL was not distributed with this
 * file, You can obtain one at http://mozilla.org/MPL/2.0/. */

apply plugin: 'com.android.library'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

android {
    compileSdkVersion config.compileSdkVersion

    defaultConfig {
        minSdkVersion config.minSdkVersion
        targetSdkVersion config.targetSdkVersion

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
    }

    buildTypes {
        release {
            minifyEnabled false
            proguardFiles getDefaultProguardFile('proguard-android.txt'), 'proguard-rules.pro'
        }
    }

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = Versions.compose_version
    }

    packagingOptions {
        exclude 'META-INF/proguard/androidx-annotations.pro'
    }
}

tasks.withType(org.jetbrains.kotlin.gradle.tasks.KotlinCompile).configureEach {
    kotlinOptions {
        freeCompilerArgs += "-Xopt-in=kotlinx.coroutines.ExperimentalCoroutinesApi"
    }
}

dependencies {
    api project(':lib-state')

    implementation project(':concept-engine')
    implementation project(':concept-storage')
    implementation project(':support-utils')
    implementation project(':support-ktx')

    // We expose this as API because we are using Response in our public API and do not want every
    // consumer to have to manually import "concept-fetch".
    api project(':concept-fetch')

    implementation Dependencies.androidx_browser
    implementation Dependencies.androidx_compose_ui
    implementation Dependencies.kotlin_coroutines
    implementation Dependencies.kotlin_stdlib

    testImplementation project(':support-test')
    testImplementation project(':support-test-libstate')
    testImplementation Dependencies.androidx_test_junit
    testImplementation Dependencies.testing_junit
    testImplementation Dependencies.testing_mockito
    testImplementation Dependencies.testing_robolectric
    testImplementation Dependencies.testing_coroutines

    androidTestImplementation Dependencies.androidx_test_junit
    androidTestImplementation Dependencies.androidx_compose_ui_test_manifest
    androidTestImplementation Dependencies.androidx_compose_ui_test
}

apply from: '../../../publish.gradle'
ext.configurePublish(config.componentsGroupId, archivesBaseName, project.ext.description)
