/*
 * 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("AndroidXComposePlugin")
    id("dagger.hilt.android.plugin")
}

android {
    compileSdk = 35
    defaultConfig {
        testInstrumentationRunner "androidx.hilt.navigation.compose.TestRunner"
    }
    namespace = "androidx.hilt.navigation.compose"
}

dependencies {

    implementation(libs.kotlinStdlib)
    api(project(":hilt:hilt-navigation"))
    api("androidx.compose.runtime:runtime:1.0.1")
    api("androidx.compose.ui:ui:1.0.1")
    api("androidx.lifecycle:lifecycle-viewmodel-compose:2.6.1")
    api("androidx.navigation:navigation-compose:2.5.1")

    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(":compose:material:material"))
    androidTestImplementation(project(":compose:test-utils"))
    androidTestImplementation(project(":lifecycle:lifecycle-common"))
    androidTestImplementation(project(":lifecycle:lifecycle-common-java8"))
    androidTestImplementation(project(":lifecycle:lifecycle-livedata-core"))
    androidTestImplementation(project(":lifecycle:lifecycle-viewmodel"))
    androidTestImplementation(project(":lifecycle:lifecycle-viewmodel-savedstate"))
}

hilt {
    enableAggregatingTask = true
}

androidx {
    name = "Navigation Compose Hilt Integration"
    type = LibraryType.PUBLISHED_LIBRARY_ONLY_USED_BY_KOTLIN_CONSUMERS
    mavenVersion = LibraryVersions.HILT_NAVIGATION_COMPOSE
    inceptionYear = "2021"
    description = "Navigation Compose Hilt Integration"
    legacyDisableKotlinStrictApiMode = true
    samples(project(":hilt:hilt-navigation-compose-samples"))
    kotlinTarget = KotlinTarget.KOTLIN_2_0
}

ksp {
    useKsp2 = true
}
