From 2ccfd1b5d94d58e60fd853db9302247c330a5b10 Mon Sep 17 00:00:00 2001 From: anastasiiaSpaseeva Date: Wed, 28 Dec 2022 07:59:14 +0100 Subject: [PATCH] Fix reading of build_snapshot_train gradlew property. (#3326) Reason: build_snapshot_train type had Boolean for the root project ktor, while in the rest of projects it is String? (:ktor-bom, :ktor-client, :ktor-http). That led to the java.lang.ClassCastException. --- build.gradle.kts | 6 +++--- buildSrc/src/main/kotlin/Train.kt | 11 ++++++----- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/build.gradle.kts b/build.gradle.kts index fb46e4273cb..f435b1ab28c 100644 --- a/build.gradle.kts +++ b/build.gradle.kts @@ -16,10 +16,10 @@ buildscript { * Additionally, mavenLocal and Sonatype snapshots are added to repository list and stress tests are disabled. * DO NOT change the name of these properties without adapting kotlinx.train build chain. */ - extra["build_snapshot_train"] = rootProject.properties["build_snapshot_train"].let { it != null && it != "" } - val build_snapshot_train: Boolean by extra + extra["build_snapshot_train"] = rootProject.properties["build_snapshot_train"] + val build_snapshot_train: String? by extra - if (build_snapshot_train) { + if (build_snapshot_train?.toBoolean() == true) { extra["kotlin_version"] = rootProject.properties["kotlin_snapshot_version"] val kotlin_version: String? by extra if (kotlin_version == null) { diff --git a/buildSrc/src/main/kotlin/Train.kt b/buildSrc/src/main/kotlin/Train.kt index e5657acface..4808cb550eb 100644 --- a/buildSrc/src/main/kotlin/Train.kt +++ b/buildSrc/src/main/kotlin/Train.kt @@ -6,8 +6,8 @@ import org.gradle.api.tasks.testing.* import org.gradle.kotlin.dsl.* fun Project.filterSnapshotTests() { - val build_snapshot_train: Boolean by extra - if (!build_snapshot_train) return + val build_snapshot_train: String? by extra + if (build_snapshot_train?.toBoolean() != true) return println("Hacking test tasks, removing stress and flaky tests") subprojects { @@ -47,9 +47,10 @@ fun Project.filterSnapshotTests() { fun Project.setupTrainForSubproject() { if (COMMON_JVM_ONLY) return - - val build_snapshot_train: Boolean? by extra - if (build_snapshot_train != true) return + val build_snapshot_train: String? by extra + if (build_snapshot_train?.toBoolean() != true) { + return + } val atomicfu_version: String by extra val coroutines_version: String by extra