/*
 * 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(libs.kotlinStdlib)
    api(libs.kotlinCoroutinesCore)
    api(project(":navigation:navigation-common"))
    api("androidx.activity:activity-ktx:1.7.1")
    api("androidx.core:core-ktx:1.8.0")
    api("androidx.lifecycle:lifecycle-common:2.6.2")
    api("androidx.lifecycle:lifecycle-runtime-ktx:2.6.2")
    api("androidx.lifecycle:lifecycle-viewmodel-ktx:2.6.2")
    api("androidx.annotation:annotation-experimental:1.4.1")

    implementation(libs.kotlinSerializationCore)
    implementation("androidx.collection:collection:1.4.2")

    androidTestImplementation("androidx.annotation:annotation:1.8.0")
    androidTestImplementation("androidx.lifecycle:lifecycle-viewmodel-savedstate:2.6.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-common:2.6.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-runtime:2.6.2")
    androidTestImplementation("androidx.lifecycle:lifecycle-runtime-testing:2.6.2")
    androidTestImplementation(project(":internal-testutils-navigation"))
    androidTestImplementation(project(":internal-testutils-runtime"))
    androidTestImplementation(libs.hamcrestCore)
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.kotlinTest)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testExtTruth)
    androidTestImplementation(libs.testMonitor)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.espressoIntents)
    androidTestImplementation(libs.truth)
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation(libs.mockitoCore)

    lintPublish(project(":navigation:navigation-runtime-lint"))
}

android {
    namespace = "androidx.navigation"
}

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