Repository: Kotlin/kotlinx.coroutines
File: integration-testing/build.gradle.kts (Kotlin)

Code before:
    */
    fun checkIsSnapshotTrainProperty(): Boolean {
        val buildSnapshotTrain = providers.gradleProperty("build_snapshot_train").orNull
        return !buildSnapshotTrain.isNullOrEmpty()
    }

    val firstPartyDependencies = listOf(
        "kotlin",
        "atomicfu",
    )

    fun checkIsSnapshotVersion(): Boolean {
        var usingSnapshotVersion = checkIsSnapshotTrainProperty()
        for (key in firstPartyDependencies) {
            val value = providers.gradleProperty("${key}_version").orNull
                ?.takeIf { it.endsWith("-SNAPSHOT") }
                ?: continue
            println("NOTE: USING SNAPSHOT VERSION: $key=$value")
            usingSnapshotVersion = true
        }
        return usingSnapshotVersion
    }

    val usingSnapshotVersion = checkIsSnapshotVersion()
    val hasSnapshotTrainProperty = checkIsSnapshotTrainProperty()
    val kotlinRepoUrl = providers.gradleProperty("kotlin_repo_url").orNull

    extra.apply {
        set("using_snapshot_version", usingSnapshotVersion)
        set("build_snapshot_train", hasSnapshotTrainProperty)
    }

    if (usingSnapshotVersion) {
        repositories {
            mavenLocal()
            maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
            if (!kotlinRepoUrl.isNullOrBlank()) {
                maven(kotlinRepoUrl)
            }
        }
    }
}

plugins {
    id("org.jetbrains.kotlin.jvm") version extra["kotlin_version"].toString()
}

repositories {
    if (extra["using_snapshot_version"] == true) {
        maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
    }

Review comment (suggestion):
BTW, do we need to process other additional parameters here the same way it is done in the main project?

I mean, `kotlin_language_version`, `kotlin_additional_cli_options`, etc.

Not suggesting to support them in this PR, but rather curious if it is something worth doing in the future.

Code after:
    */
    fun checkIsSnapshotTrainProperty(): Boolean {
        val buildSnapshotTrain = providers.gradleProperty("build_snapshot_train").orNull
        return !buildSnapshotTrain.isNullOrEmpty()
    }

    val firstPartyDependencies = listOf(
        "kotlin",
        "atomicfu",
    )

    fun checkIsSnapshotVersion(): Boolean {
        var usingSnapshotVersion = checkIsSnapshotTrainProperty()
        for (key in firstPartyDependencies) {
            val value = providers.gradleProperty("${key}_version").orNull
                ?.takeIf { it.endsWith("-SNAPSHOT") }
                ?: continue
            println("NOTE: USING SNAPSHOT VERSION: $key=$value")
            usingSnapshotVersion = true
        }
        return usingSnapshotVersion
    }

    val usingSnapshotVersion = checkIsSnapshotVersion()
    val hasSnapshotTrainProperty = checkIsSnapshotTrainProperty()
    val kotlinRepoUrl = providers.gradleProperty("kotlin_repo_url").orNull

    extra.apply {
        set("using_snapshot_version", usingSnapshotVersion)
        set("build_snapshot_train", hasSnapshotTrainProperty)
    }

    if (usingSnapshotVersion) {
        repositories {
            mavenLocal()
            maven("https://maven.pkg.jetbrains.space/kotlin/p/kotlin/dev")
            maven("https://redirector.kotlinlang.org/maven/dev")
            if (!kotlinRepoUrl.isNullOrBlank()) {
                maven(kotlinRepoUrl)
            }
        }

    }
}

plugins {
    id("org.jetbrains.kotlin.jvm") version extra["kotlin_version"].toString()
}

allprojects {
    repositories {