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

    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
        execution 'ANDROIDX_TEST_ORCHESTRATOR'
    }
    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

    api(project(":framework:annotations"))

    compileOnly libs.androidx.fragment
    compileOnly libs.compose.runtime.runtime

    androidTestImplementation libs.androidx.test.runner
    testImplementation libs.androidx.test.runner
}
