plugins {
    `kotlin-dsl`
}

group = "dev.carlosmartino.plugins.buildlogic"

dependencies {
    implementation(libs.plugins.kotlinMultiplatform.toDep())
    implementation(libs.plugins.kotlinSerialization.toDep())
    implementation(libs.plugins.androidApplication.toDep())
    implementation(libs.plugins.androidLibrary.toDep())
    implementation(libs.plugins.composeCompiler.toDep())
    implementation(libs.plugins.composeMultiplatform.toDep())
}

fun Provider<PluginDependency>.toDep() =
    map {
        "${it.pluginId}:${it.pluginId}.gradle.plugin:${it.version}"
    }

tasks {
    validatePlugins {
        enableStricterValidation = true
        failOnWarning = true
    }
}

gradlePlugin {
    plugins {
        register("kotlinMultiplatform") {
            id = "dev.carlosmartino.plugins.kotlinMultiplatform"
            implementationClass = "KotlinMultiplatformConventionPlugin"
        }
        register("composeMultiplatform") {
            id = "dev.carlosmartino.plugins.composeMultiplatform"
            implementationClass = "ComposeMultiplatformConventionPlugin"
        }
    }
}
