Skip to content

Commit

Permalink
Update CommunityProjectsBuild.kt (#4229)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgCantor authored Sep 23, 2024
1 parent eac92c0 commit 8adb37c
Showing 1 changed file with 8 additions and 12 deletions.
20 changes: 8 additions & 12 deletions buildSrc/src/main/kotlin/CommunityProjectsBuild.kt
Original file line number Diff line number Diff line change
Expand Up @@ -134,20 +134,16 @@ fun getOverriddenKotlinVersion(project: Project): String? =
/**
* Checks if the project is built with a snapshot version of Kotlin compiler.
*/
fun isSnapshotTrainEnabled(project: Project): Boolean =
when (project.rootProject.properties["build_snapshot_train"]) {
null -> false
"" -> false
else -> true
}
fun isSnapshotTrainEnabled(project: Project): Boolean {
val buildSnapshotTrain = project.rootProject.properties["build_snapshot_train"] as? String
return !buildSnapshotTrain.isNullOrBlank()
}

fun shouldUseLocalMaven(project: Project): Boolean {
var someDependencyIsSnapshot = false
project.rootProject.properties.forEach { key, value ->
if (key.endsWith("_version") && value is String && value.endsWith("-SNAPSHOT")) {
println("NOTE: USING SNAPSHOT VERSION: $key=$value")
someDependencyIsSnapshot = true
val hasSnapshotDependency = project.rootProject.properties.any { (key, value) ->
key.endsWith("_version") && value is String && value.endsWith("-SNAPSHOT").also {
if (it) println("NOTE: USING SNAPSHOT VERSION: $key=$value")
}
}
return isSnapshotTrainEnabled(project) || someDependencyIsSnapshot
return hasSnapshotDependency || isSnapshotTrainEnabled(project)
}

0 comments on commit 8adb37c

Please sign in to comment.