/*
 * Copyright 2022 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.BundleInsideHelper
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("kotlin")
}

BundleInsideHelper.forInsideLintJar(project)

dependencies {
    compileOnly(libs.androidLintApiPrevKotlin)
    compileOnly(libs.kotlinStdlib)
    compileOnly(libs.androidToolsCommon)
    compileOnly(libs.intellijCore)
    compileOnly(libs.uast)
    bundleInside(project(":navigation:lint:common"))

    testImplementation(libs.kotlinStdlib)
    testImplementation(libs.androidLintApiPrevKotlin)
    testImplementation(libs.androidLintTestsPrevKotlin)
    testImplementation(libs.intellijCore)
    testImplementation(libs.junit)
    testImplementation(libs.truth)
    testImplementation(project(":navigation:lint:common-test"))
}

androidx {
    name = "Navigation Runtime Lint"
    type = LibraryType.LINT
    inceptionYear = "2022"
    description = "Lint checks for Navigation Runtime"
}
