/*
 * Copyright (C) 2018 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")
}

android {
    buildTypes.configureEach {
        consumerProguardFiles "proguard-rules.pro"
    }
    namespace = "androidx.navigation.ui"
}

dependencies {
    api(project(":navigation:navigation-common"))
    api(project(":navigation:navigation-runtime"))
    api("androidx.customview:customview:1.1.0")
    api("androidx.drawerlayout:drawerlayout:1.1.1")
    api("com.google.android.material:material:1.4.0")

    implementation("androidx.appcompat:appcompat:1.2.0")
    implementation("androidx.core:core-ktx:1.2.0")
    implementation("androidx.coordinatorlayout:coordinatorlayout:1.1.0")
    implementation("androidx.transition:transition:1.3.0")

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

androidx {
    name = "Navigation UI"
    type = LibraryType.PUBLISHED_LIBRARY
    inceptionYear = "2018"
    description = "Android Navigation-UI"
}
