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

dependencies {

    implementation(libs.kotlinStdlib)
    api("androidx.core:core-ktx:1.12.0")
    api(project(":fragment:fragment-ktx"))
    api("androidx.compose.runtime:runtime:1.5.4")
    api("androidx.compose.ui:ui:1.5.4")
    implementation("androidx.compose.runtime:runtime-saveable:1.5.4")

    androidTestImplementation("androidx.activity:activity:1.8.2")
    androidTestImplementation("androidx.activity:activity-compose:1.8.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-common:2.8.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-viewmodel:2.8.2")
    androidTestImplementation("androidx.compose.foundation:foundation-layout:1.6.0")
    androidTestImplementation(project(":compose:material:material"))
    androidTestImplementation(project(":compose:runtime:runtime"))
    androidTestImplementation(project(":compose:test-utils"))
    androidTestImplementation(project(":compose:ui:ui"))
    androidTestImplementation(project(":compose:ui:ui-test"))
    androidTestImplementation(project(":compose:ui:ui-test-junit4"))
    androidTestImplementation(project(":compose:ui:ui-text"))
    androidTestImplementation(project(":compose:ui:ui-unit"))
    androidTestImplementation(libs.espressoCore)
    androidTestImplementation(libs.hamcrestCore)
    androidTestImplementation(project(":internal-testutils-runtime"))
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.truth)
    androidTestImplementation(libs.testCore)
}

android {
    compileSdk = 35
    namespace = "androidx.fragment.compose"
    // TODO(b/313699418): need to update compose.runtime version to 1.6.0+
    experimentalProperties["android.lint.useK2Uast"] = false
}

androidx {
    name = "Fragment Compose"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2024"
    description = "Integrate Fragments with Compose to provide helper APIs for using Fragments in" +
            "Compose or Compose inside of Fragments"
    legacyDisableKotlinStrictApiMode = true
    samples(project(":fragment:fragment-compose:fragment-compose-samples"))
}
