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

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

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

dependencies {
    // 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. We may get a different version on the runtime
    // classpath.
    compileOnly("com.android.tools.build:gradle-api:8.8.0-alpha06")
    compileOnly("com.android.tools:common:31.8.0-alpha06")
    compileOnly("com.android.tools:sdk-common:31.8.0-alpha06")
    compileOnly("com.android.tools:repository:31.8.0-alpha06")
    compileOnly(libs.kotlinGradlePlugin)

    api(libs.androidGradlePluginApi)
    api(libs.androidToolsCommon)
    api(libs.androidToolsSdkCommon)
    api(libs.guava)

    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 = SoftwareType.GRADLE_PLUGIN
    inceptionYear = "2022"
    description = "Stable AIDL Gradle Plugin"
    kotlinTarget = KotlinTarget.KOTLIN_2_2
}
