/*
 * Copyright 2021 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")
    id("com.google.devtools.ksp")
    id("dagger.hilt.android.plugin")
}

android {
    defaultConfig {
        testInstrumentationRunner "androidx.hilt.navigation.fragment.TestRunner"
    }
    namespace = "androidx.hilt.navigation.fragment"
}

dependencies {
    api(libs.kotlinStdlib)
    api(project(":hilt:hilt-navigation"))
    api("androidx.navigation:navigation-fragment-ktx:2.5.1")

    androidTestImplementation("androidx.fragment:fragment-testing:1.3.0")
    androidTestImplementation(libs.testExtJunit)
    androidTestImplementation(libs.testCore)
    androidTestImplementation(libs.testRunner)
    androidTestImplementation(libs.testRules)
    androidTestImplementation(libs.truth)
    androidTestImplementation(libs.hiltAndroid)
    androidTestImplementation(libs.hiltAndroidTesting)
    kspAndroidTest(libs.hiltCompiler)
    androidTestImplementation(project(":internal-testutils-runtime"))
    androidTestImplementation(project(":internal-testutils-navigation"), {
        exclude group: 'androidx.navigation', module: 'navigation-common'
    })
}

hilt {
    enableAggregatingTask = true
}

androidx {
    name = "Navigation Fragment Hilt Extension"
    type = LibraryType.PUBLISHED_LIBRARY
    mavenVersion = LibraryVersions.HILT_NAVIGATION
    inceptionYear = "2021"
    description = "Android Navigation Fragment Hilt Extension"
    legacyDisableKotlinStrictApiMode = true
    kotlinTarget = KotlinTarget.KOTLIN_2_0
}

ksp {
    useKsp2 = true
}
