/*
 * Copyright 2018 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")
    alias(libs.plugins.kotlinSerialization)
}

dependencies {
    api(project(":navigation:navigation-runtime"))
    api("androidx.lifecycle:lifecycle-runtime-testing:2.6.2")

    implementation(libs.kotlinCoroutinesCore)
    implementation(libs.kotlinSerializationCore)
    implementation(project(":navigation:navigation-common"))
    implementation("androidx.core:core-ktx:1.8.0")
    implementation("androidx.lifecycle:lifecycle-common:2.6.2")
    implementation("androidx.lifecycle:lifecycle-viewmodel:2.6.2")
    implementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.2")

    androidTestRuntimeOnly(libs.kotlinTestJunit)
    androidTestImplementation("androidx.lifecycle:lifecycle-runtime:2.6.2")
    androidTestImplementation(project(":internal-testutils-navigation"), {
        exclude group: "androidx.navigation", module: "navigation-common"
    })
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testExtTruth)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.truth)

    testRuntimeOnly(libs.testCore)
    testRuntimeOnly(libs.kotlinTestJunit)
    testImplementation(libs.junit)
    testImplementation(libs.testRunner)
    testImplementation(libs.truth)
    testImplementation(libs.robolectric)
}

androidx {
    name = "Navigation Testing"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2017"
    description = "Android Navigation-Testing"
}

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