// This file applies dependencies common to projects in buildSrc

apply from: "${buildscript.sourceFile.parent}/kotlin-dsl-dependency.gradle"
// copy findGradleKotlinDsl to a local variable: https://github.com/gradle/gradle/issues/26057
def findGradleKotlinDsl = project.findGradleKotlinDsl
dependencies {

    // Gradle APIs
    implementation(gradleApi())
    compileOnly(findGradleKotlinDsl())

    // Android Gradle Plugin APIs used by Stable AIDL
    api(libs.androidGradlePluginApi)

    // Plugins we use and configure
    api(libs.kotlinGradlePlugin)
    compileOnly(libs.kotlinCompiler) // for binaryCompatibilityValidator
    implementation(libs.androidGradlePlugin)
    implementation(libs.androidToolsCommon) // for com.android.Version.ANDROID_GRADLE_PLUGIN_VERSION
    implementation(libs.androidToolsRepository) // com.android.repository for Stable AIDL plugin
    implementation(libs.androidToolsSdkCommon) // com.android.ide.common for Stable AIDL plugin
    implementation(libs.spdxGradlePluginz)
    implementation(libs.androidKotlinMultiplatform)
    implementation(libs.binaryCompatibilityValidator)

    // For Room Gradle Plugin
    implementation(libs.kspGradlePlugin)

    // Force jsoup upgrade on spdx (b/309773103)
    implementation(libs.jsoup)

    // json parser
    implementation(libs.gson)

    // XML parsers used in MavenUploadHelper.kt
    implementation(libs.dom4j) {
        // Optional dependency where Ivy fails to parse the POM file.
        exclude(group:"net.java.dev.msv", module:"xsdlib")
    }
    implementation(libs.xerces)

    implementation(libs.shadow) // used by BundleInsideHelper.kt
    api(libs.apacheAnt) // used in AarManifestTransformerTask.kt for unziping
    implementation(libs.toml)
    implementation(libs.apacheCommonIo) // used in CheckApiEquivalenceTask.kt

    implementation(libs.protobufGradlePlugin) // needed to compile inspection plugin
    implementation(libs.kotlinPoet) // needed to compile glance-layout-generator

    implementation("com.google.protobuf:protobuf-java:3.22.3") // needed to compile baseline-profile gradle plugins
    implementation(libs.agpTestingPlatformCoreProto) // needed to compile baseline-profile gradle plugins

    // dependencies that aren't used by buildSrc directly but that we resolve here so that the
    // root project doesn't need to re-resolve them and their dependencies on every build
    runtimeOnly(libs.hiltAndroidGradlePlugin)
    runtimeOnly(libs.javapoet) // for hiltAndroidGradlePlugin to workaround https://github.com/google/dagger/issues/3068
    runtimeOnly(libs.wireGradlePluginz)

    // Plugin for analyzing dependencies
    implementation(libs.dependency.analysis.gradle.plugin)
}
