/* 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.application'
apply plugin: 'kotlin-android'
apply plugin: 'kotlin-parcelize'

android {
    compileSdkVersion config.compileSdkVersion

    defaultConfig {
        applicationId "org.mozilla.samples.compose.browser"
        minSdkVersion config.minSdkVersion
        targetSdkVersion config.targetSdkVersion
        versionCode 1
        versionName "1.0"

        testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
        testInstrumentationRunnerArgument "clearPackageData", "true"
        testInstrumentationRunnerArgument "listener", "leakcanary.FailTestOnLeakRunListener"
    }

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

    buildFeatures {
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion = Versions.compose_version
    }
}

tasks.register("updateBorderifyExtensionVersion", Copy) { task ->
    updateExtensionVersion(task, 'src/main/assets/extensions/borderify')
}

tasks.register("updateTestExtensionVersion", Copy) { task ->
    updateExtensionVersion(task, 'src/main/assets/extensions/test')
}

dependencies {
    implementation project(':concept-engine')
    implementation project(':concept-awesomebar')
    implementation project(':concept-tabstray')

    implementation project(':browser-engine-gecko')
    implementation project(':browser-state')
    implementation project(':browser-icons')

    implementation project(':compose-awesomebar')
    implementation project(':compose-browser-toolbar')
    implementation project(':compose-engine')
    implementation project(':compose-tabstray')

    implementation project(':feature-awesomebar')
    implementation project(':feature-search')
    implementation project(':feature-session')
    implementation project(':feature-tabs')

    implementation project(':service-location')

    implementation project(':ui-icons')

    implementation Dependencies.kotlin_stdlib

    implementation Dependencies.androidx_activity_compose
    implementation Dependencies.androidx_appcompat
    implementation Dependencies.androidx_core_ktx
    implementation Dependencies.androidx_compose_ui
    implementation Dependencies.androidx_compose_ui_tooling
    implementation Dependencies.androidx_compose_foundation
    implementation Dependencies.androidx_compose_material
    implementation Dependencies.androidx_compose_navigation
}

preBuild.dependsOn updateBorderifyExtensionVersion
preBuild.dependsOn updateTestExtensionVersion
