import org.jetbrains.kotlin.gradle.tasks.KotlinCompilationTask

plugins {
    id("org.jetbrains.kotlin.multiplatform")
}

kotlin {
    jvmToolchain(21)

    compilerOptions {
        allWarningsAsErrors.set(true)
    }
}

// KMP metadata tasks can surface duplicate KLIB unique_name warnings from upstream
// Compose/AndroidX artifacts. Keep warnings-as-errors for source compilation, but
// do not fail metadata aggregation on dependency metadata warnings.
tasks.withType<KotlinCompilationTask<*>>().configureEach {
    compilerOptions {
        allWarningsAsErrors.set(!name.endsWith("KotlinMetadata"))
    }
}
