/*
 * Copyright 2022 Google LLC
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     https://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

plugins {
    id 'com.android.library'
    id 'kotlin-android'
    id "com.vanniktech.maven.publish" version libs.versions.mavenPublish
}

import com.vanniktech.maven.publish.SonatypeHost

mavenPublishing {
    publishToMavenCentral(SonatypeHost.DEFAULT)
    signAllPublications()
}

android {
    namespace 'com.google.android.catalog.framework.ui'

    compileSdk 34

    defaultConfig {
        minSdk 21
        targetSdk 34
        resourceConfigurations += ['en']

        testInstrumentationRunner 'androidx.test.runner.AndroidJUnitRunner'
    }

    compileOptions {
        sourceCompatibility JavaVersion.VERSION_17
        targetCompatibility JavaVersion.VERSION_17

        kotlin {
            kotlinOptions {
                freeCompilerArgs += "-Xopt-in=kotlin.RequiresOptIn"
            }
        }
    }

    buildFeatures {
        buildConfig false
        compose true
    }

    composeOptions {
        kotlinCompilerExtensionVersion libs.versions.composeCompiler.get()
    }


    testOptions {
        unitTests {
            includeAndroidResources = true
        }
        animationsDisabled true
    }
    packagingOptions {
        resources {
            excludes += [
                '/META-INF/AL2.0',
                '/META-INF/LGPL2.1'
            ]
        }
    }


    publishing {
        multipleVariants {
            allVariants()
        }
    }
    lint {
        checkReleaseBuilds false
        textOutput file('stdout')
        textReport true
    }
}

dependencies {
    def composeBom = platform(libs.compose.bom)
    implementation composeBom
    androidTestImplementation composeBom

    // Include framework base module
    api(project(":framework:base"))
    // Minimal compose dependencies
    api libs.compose.runtime.runtime

    implementation libs.androidx.core
    implementation libs.androidx.fragment
    implementation libs.mdc
    implementation libs.androidx.navigation.compose
    implementation libs.compose.ui.ui
    implementation libs.compose.material.material3
    implementation libs.compose.material.window3
    implementation libs.compose.material.iconsext

    androidTestImplementation libs.androidx.test.runner
    androidTestImplementation libs.androidx.test.core.ktx
    androidTestImplementation libs.androidx.test.junit
    androidTestImplementation libs.androidx.test.espresso.core
    androidTestImplementation libs.truth
    androidTestImplementation libs.compose.ui.test.junit4
    testImplementation libs.androidx.test.runner
}
