/*
 * Copyright (C) 2022 The Android Open Source Project
 *
 * 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
 *
 *      http://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.
 */

/**
 * This file was created using the `create_project.py` script located in the
 * `<AndroidX root>/development/project-creator` directory.
 *
 * Please use that script when creating a new project, rather than copying an existing project and
 * modifying its settings.
 */
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("org.jetbrains.kotlin.android")
}

dependencies {
    api("androidx.core:core:1.9.0")
    implementation(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesAndroid)
    implementation(libs.kotlinCoroutinesGuava)
    implementation("androidx.appcompat:appcompat:1.6.1")
    implementation("androidx.core:core-ktx:1.9.0")
    implementation("androidx.emoji2:emoji2:1.2.0")
    implementation("androidx.recyclerview:recyclerview:1.2.1")

    androidTestImplementation(libs.bundles.espressoContrib)
    androidTestImplementation(libs.espressoCore)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(project(":test:screenshot:screenshot"))
    androidTestImplementation(project(":internal-testutils-runtime"))
}


android {
    defaultConfig {
        vectorDrawables.useSupportLibrary = true
    }
    namespace = "androidx.emoji2.emojipicker"
    testOptions.unitTests.includeAndroidResources = true
}

androidx {
    name = "Emoji2 Emoji Picker"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2022"
    description = "This library provides the latest emoji support and emoji picker UI to input " +
            "emoji in current and older devices"
    legacyDisableKotlinStrictApiMode = true
    addGoldenImageAssets()
}
