/* 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'

apply plugin: 'kotlin-kapt'

android {
    compileSdkVersion config.compileSdkVersion

    defaultConfig {
        minSdkVersion config.minSdkVersion
        targetSdkVersion config.targetSdkVersion

        kapt {
            arguments {
                arg("room.schemaLocation", "$projectDir/schemas".toString())
            }
        }

        javaCompileOptions {
            annotationProcessorOptions {
                arguments += ["room.incremental": "true"]
            }
        }
    }

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

    lintOptions {
        warningsAsErrors true
        abortOnError true

        // https://github.com/mozilla-mobile/android-components/issues/10642
        disable 'UnusedResources'
    }

    buildFeatures {
        viewBinding true
    }
}

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

dependencies {
    implementation Dependencies.androidx_appcompat
    implementation Dependencies.kotlin_stdlib
    implementation Dependencies.kotlin_coroutines
    implementation Dependencies.androidx_work_runtime
    implementation Dependencies.androidx_core_ktx
    implementation Dependencies.androidx_recyclerview
    implementation Dependencies.androidx_cardview
    implementation Dependencies.androidx_room_runtime
    kapt Dependencies.androidx_room_compiler

    implementation project(':ui-colors')
    implementation project(':ui-icons')
    implementation project(':ui-widgets')
    implementation project(':browser-state')
    implementation project(':concept-engine')
    implementation project(':concept-fetch')
    implementation project(':concept-menu')
    implementation project(':support-base')
    implementation project(':support-ktx')
    implementation project(':support-webextensions')
    implementation project(':support-utils')

    testImplementation project(':support-test')
    testImplementation Dependencies.androidx_test_core
    testImplementation Dependencies.androidx_test_junit
    testImplementation Dependencies.testing_robolectric
    testImplementation Dependencies.testing_mockito
    testImplementation Dependencies.androidx_work_testing
    testImplementation Dependencies.testing_coroutines
}

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