/*
 * 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.LibraryType

plugins {
    id("AndroidXPlugin")
    id("com.android.library")
    id("kotlin-android")
    alias(libs.plugins.kotlinSerialization)
}

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

dependencies {
    api(libs.playFeatureDelivery)
    api("androidx.lifecycle:lifecycle-livedata-core:2.6.2")
    api(project(":navigation:navigation-common"))
    api(project(":navigation:navigation-runtime"))

    implementation("androidx.core:core-ktx:1.2.0")
    implementation(libs.kotlinSerializationCore)

    testRuntimeOnly(libs.testCore)
    testRuntimeOnly(libs.testRunner)
    testRuntimeOnly(libs.robolectric)

    testImplementation(project(":navigation:navigation-testing"))
    testImplementation("androidx.arch.core:core-testing:2.2.0")
    testImplementation(libs.junit)
    testImplementation(libs.mockitoCore4)
    testImplementation(libs.truth)
    testImplementation(libs.kotlinCoroutinesCore)
    testImplementation(libs.kotlinCoroutinesTest)

    androidTestImplementation("androidx.annotation:annotation:1.7.0")
    androidTestImplementation(libs.dexmakerMockito)
    androidTestImplementation(libs.junit)
    androidTestImplementation(libs.mockitoCore)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.truth)
    androidTestImplementation(project(":internal-testutils-runtime"), {
        exclude group: "androidx.fragment", module: "fragment"
    })
}

androidx {
    name = "Dynamic Feature Navigation Runtime"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2019"
    description = "Android Dynamic Feature Navigation Runtime"
}
