/*
 * 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.KotlinTarget
import androidx.build.LibraryType

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

dependencies {
    api("androidx.compose.runtime:runtime:1.5.4")
    api("androidx.compose.ui:ui:1.5.4")
    api("androidx.fragment:fragment:1.6.2")
    api(project(":navigation:navigation-common"))
    api(project(":navigation:navigation-fragment"))
    api(project(":navigation:navigation-runtime"))

    implementation(libs.kotlinStdlib)
    implementation("androidx.annotation:annotation:1.5.0")
    implementation("androidx.core:core-ktx:1.2.0")
    implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.2")

    androidTestRuntimeOnly(project(":compose:test-utils"))

    androidTestImplementation("androidx.activity:activity:1.7.2")
    androidTestImplementation("androidx.fragment:fragment-ktx:1.6.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-viewmodel:2.8.2")
    androidTestImplementation(project(":compose:material:material"))
    androidTestImplementation(project(":compose:runtime:runtime"))
    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(libs.testRunner)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.truth)
}

android {
    compileSdk = 35
    namespace = "androidx.navigation.fragment.compose"
}

androidx {
    name = "Navigation with Fragments with Compose"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    inceptionYear = "2024"
    description = "Add Compose destinations to Navigation with Fragments"
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}
