/*
 * Copyright 2021 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")
    id("AndroidXComposePlugin")
}

dependencies {

    api(project(":glance:glance"))
    api(project(":glance:glance-template"))
    api("androidx.compose.runtime:runtime:1.1.1")
    api("androidx.compose.ui:ui-graphics:1.1.1")
    api("androidx.compose.ui:ui-unit:1.1.1")
    api("androidx.wear.tiles:tiles:1.1.0")

    implementation(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesGuava)
    implementation("androidx.lifecycle:lifecycle-runtime-ktx:2.6.1")
    implementation("androidx.lifecycle:lifecycle-service:2.6.1")

    testImplementation(libs.testCore)
    testImplementation(libs.testRules)
    testImplementation(libs.testRunner)
    testImplementation(libs.truth)
    testImplementation(libs.junit)
    testImplementation(libs.kotlinTest)
    testImplementation(libs.kotlinCoroutinesTest)
    testImplementation(libs.robolectric)
    testImplementation(libs.kotlinReflect)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.mockitoKotlin4)
    testImplementation("androidx.core:core-ktx:1.7.0")
    testImplementation("androidx.wear.tiles:tiles-testing:1.0.0")

    androidTestImplementation("androidx.core:core:1.7.0")
    androidTestImplementation("androidx.core:core-ktx:1.7.0")
    androidTestImplementation(project(":test:screenshot:screenshot"))
    androidTestImplementation("androidx.wear.tiles:tiles-renderer:1.0.0")
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.kotlinTest)
    androidTestImplementation(libs.kotlinCoroutinesTest)
}

android {
    defaultConfig {
        minSdk = 26
        compileSdk = 35
    }
    // Use Robolectric 4.+
    testOptions.unitTests.includeAndroidResources = true

    lintOptions {
        // TODO(b/191286558): Remove when lint is fixed.
        disable "UnsafeOptInUsageError", "UnsafeOptInUsageWarning"
        // protobuf generates unannotated methods
        disable "UnknownNullness"
    }
    namespace = "androidx.glance.wear.tiles"
}

androidx {
    name = "Glance for Wear Tiles"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    mavenVersion = LibraryVersions.GLANCE_WEAR_TILES
    inceptionYear = "2021"
    description = "Glance allows developers to build layouts for Wear Tiles using a Jetpack " +
            "Compose-style API."
    legacyDisableKotlinStrictApiMode = true
    metalavaK2UastEnabled = false
    addGoldenImageAssets()
}
