/*
 * 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
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile

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

dependencies {
    api("androidx.fragment:fragment:1.6.2")
    api(project(":navigation:navigation-dynamic-features-runtime"))
    api(project(":navigation:navigation-common"))
    api(project(":navigation:navigation-fragment"))
    api(project(":navigation:navigation-runtime"))
    api(libs.playFeatureDelivery)
    api(libs.kotlinStdlib)

    implementation(libs.kotlinSerializationCore)
    implementation("androidx.activity:activity:1.7.2")
    implementation("androidx.core:core-ktx:1.2.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")

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

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

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

androidx {
    name = "Dynamic Feature Navigation Fragment"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2019"
    description = "Android Dynamic Feature Navigation Fragment"
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}
