/*
 * 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.KotlinTarget
import androidx.build.LibraryType

plugins {
    id("AndroidXPlugin")
    id("kotlin")
    id("java-gradle-plugin")
}

apply from: "../../buildSrc/kotlin-dsl-dependency.gradle"

configurations {
    // Config for plugin classpath to be used during tests
    testPlugin {
        canBeConsumed = false
        canBeResolved = true
    }
}

dependencies {
    runtimeOnly(findGradleKotlinDsl())

    // Pinned AGP and lint versions that use an older version of Kotlin (pre 2.1) to avoid bumping
    // the Kotlin target of this project to 2.1.
    api("com.android.tools.build:gradle-api:8.8.0-alpha06")
    api("com.android.tools:common:31.8.0-alpha06")
    api("com.android.tools:sdk-common:31.8.0-alpha06")
    api(libs.guava)

    implementation(gradleApi())
    implementation("com.android.tools:repository:31.8.0-alpha06")
    implementation(libs.apacheCommonIo)
    implementation(libs.apacheAnt)
    implementation(libs.kotlinStdlib)

    testPlugin(libs.androidGradlePlugin)

    testImplementation("com.android.tools.build:gradle:8.8.0-alpha06")
    testImplementation(gradleTestKit())
    testImplementation(project(":internal-testutils-gradle-plugin"))
    testImplementation(libs.androidToolsAnalyticsProtos)
    testImplementation(libs.asm)
    testImplementation(libs.builder)
    testImplementation(libs.junit)
    testImplementation(libs.kotlinTest)
    testImplementation(libs.gson)
    testImplementation(libs.truth)
}

tasks.withType(PluginUnderTestMetadata.class).named("pluginUnderTestMetadata").configure {
    it.pluginClasspath.from(configurations.testPlugin)
}

gradlePlugin {
    plugins {
        stableAidl {
            id = "androidx.stableaidl"
            implementationClass = "androidx.stableaidl.StableAidlPlugin"
        }
    }
}

androidx {
    name = "Stable AIDL Gradle Plugin"
    type = LibraryType.GRADLE_PLUGIN
    inceptionYear = "2022"
    description = "Stable AIDL Gradle Plugin"
    kotlinTarget = KotlinTarget.KOTLIN_1_9
}
