/*
 * Copyright 2020 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("AndroidXComposePlugin")
    id("org.jetbrains.kotlin.android")
}

dependencies {

    implementation(libs.kotlinStdlib)
    implementation(libs.kotlinCoroutinesCore)
    api("androidx.compose.runtime:runtime:1.7.0")
    api("androidx.compose.runtime:runtime-saveable:1.7.0")
    api(project(":activity:activity-ktx"))
    api("androidx.compose.ui:ui:1.0.1")
    api("androidx.core:core-ktx:1.13.0")
    api("androidx.lifecycle:lifecycle-viewmodel:2.6.1")
    implementation("androidx.lifecycle:lifecycle-common:2.6.1")
    implementation("androidx.lifecycle:lifecycle-runtime:2.6.1")
    implementation("androidx.savedstate:savedstate:1.2.1")

    androidTestImplementation("androidx.annotation:annotation:1.8.1")
    androidTestImplementation("androidx.compose.foundation:foundation-layout:1.6.0")
    androidTestImplementation(project(":compose:ui:ui-test-junit4"))
    androidTestImplementation(project(":compose:material:material"))
    androidTestRuntimeOnly(project(":compose:test-utils"))
    androidTestImplementation(project(":compose:foundation:foundation"))
    androidTestImplementation(project(":compose:runtime:runtime"))
    androidTestImplementation(project(":compose:ui:ui"))
    androidTestImplementation(project(":compose:ui:ui-graphics"))
    androidTestImplementation(project(":compose:ui:ui-test"))
    androidTestImplementation(project(":compose:ui:ui-text"))
    androidTestImplementation(project(":lifecycle:lifecycle-common"))
    androidTestImplementation(project(":lifecycle:lifecycle-runtime"))
    androidTestImplementation(project(":lifecycle:lifecycle-runtime-testing"))
    androidTestImplementation("androidx.lifecycle:lifecycle-runtime-compose:2.8.2")
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.truth)

    lintChecks(project(":activity:activity-compose-lint"))
    lintPublish(project(":activity:activity-compose-lint"))
}

androidx {
    name = "Activity Compose"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2020"
    description = "Compose integration with Activity"
    legacyDisableKotlinStrictApiMode = true
    samples(project(":activity:activity-compose:activity-compose-samples"))
}

android {
    compileSdk = 35
    namespace = "androidx.activity.compose"
}
