/*
 * Copyright (C) 2016 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("com.android.library")
    id("kotlin-android")
    alias(libs.plugins.kotlinSerialization)
}

dependencies {
    api("androidx.fragment:fragment-ktx:1.6.2")
    api("androidx.slidingpanelayout:slidingpanelayout:1.2.0")
    api(project(":navigation:navigation-common"))
    api(project(":navigation:navigation-runtime"))
    api(libs.kotlinStdlib)

    implementation(libs.kotlinSerializationCore)
    implementation(libs.kotlinCoroutinesCore)
    implementation("androidx.activity:activity:1.7.2")
    implementation("androidx.core:core-ktx:1.8.0")
    implementation("androidx.lifecycle:lifecycle-common:2.6.2")
    implementation("androidx.lifecycle:lifecycle-livedata-core:2.6.2")
    implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.2")
    implementation("androidx.savedstate:savedstate:1.2.1")

    androidTestImplementation(project(":navigation:navigation-testing"))
    androidTestImplementation("androidx.annotation:annotation:1.7.0")
    androidTestImplementation("androidx.fragment:fragment-testing:1.6.2")
    androidTestImplementation("androidx.fragment:fragment-testing-manifest:1.6.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.2")
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testMonitor)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.truth)
    androidTestImplementation(project(":internal-testutils-runtime"), {
        exclude group: "androidx.fragment", module: "fragment"
    })
    androidTestImplementation(project(":internal-testutils-navigation"), {
        exclude group: "androidx.navigation", module: "navigation-common"
    })
}

androidx {
    name = "Navigation Fragment"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2017"
    description = "Android Navigation-Fragment"
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}

android {
    namespace = "androidx.navigation.fragment"
}
