Skip to content

Update CommunityProjectsBuild.kt #4229

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 2 commits into from
Sep 23, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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)
}