Skip to content

Commit 23db8f0

Browse files
committed
Fixup
1 parent 6172139 commit 23db8f0

File tree

4 files changed

+20
-16
lines changed

4 files changed

+20
-16
lines changed

atomicfu-gradle-plugin/build.gradle

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,8 @@
22
* Copyright 2017-2018 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
33
*/
44

5+
import static KotlinVersion.*
6+
57
apply plugin: 'kotlin'
68
apply plugin: 'java-gradle-plugin'
79

@@ -91,7 +93,7 @@ dependencies {
9193
}
9294

9395
// Skip these tests if Kotlin version >= 1.9.0, as JS Legacy is no longer supported there
94-
if (KotlinAggregateBuild.isKotlinVersionAtLeast(project, 1, 9)) {
96+
if (isKotlinVersionAtLeast(project, 1, 9)) {
9597
test {
9698
exclude "**/JsLegacyTransformationTest*", "**/MppLegacyTransformationTest*"
9799
}

atomicfu/build.gradle

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,9 @@
1-
import org.jetbrains.kotlin.gradle.dsl.KotlinVersion
2-
31
/*
42
* Copyright 2016-2020 JetBrains s.r.o. Use of this source code is governed by the Apache 2.0 license.
53
*/
64

5+
import static KotlinVersion.*
6+
77
apply plugin: 'kotlin-multiplatform'
88
apply from: rootProject.file("gradle/targets.gradle")
99

@@ -21,7 +21,7 @@ ext {
2121

2222
// TODO: this block should be removed after the switch to Kotlin language version 1.9
2323
// (right now it implements a toggle between IR and BOTH JS compiler types for testing of Kotlin dev builds)
24-
def isJsLegacyCompilerEnabled = !KotlinAggregateBuild.isKotlinVersionAtLeast(project, 1, 9)
24+
def isJsLegacyCompilerEnabled = !isKotlinVersionAtLeast(project, 1, 9)
2525

2626
kotlin {
2727
targets {
@@ -31,7 +31,7 @@ kotlin {
3131
}
3232

3333
// JS -- always
34-
// TODO: JS compiler should be switched to IR-only after the switch to Kotlin language version 1.9
34+
// TODO: JS compiler should be switched to IR-only after Kotlin version is updated to 1.9
3535
// (right now compiler type is chosen conditionally for testing of Kotlin dev builds)
3636
def jsCompiler = isJsLegacyCompilerEnabled ? BOTH : IR
3737
js(jsCompiler) {
@@ -162,7 +162,7 @@ dependencies {
162162
transformer project(":atomicfu-transformer")
163163
}
164164

165-
// TODO: this JS Legacy configuration should be removed after the switch to Kotlin language version 1.9
165+
// TODO: This JS Legacy configuration should be removed when Kotlin version is updated to 1.9.0,
166166
// (right now configurations are removed conditionally for testing of Kotlin 1.9.0-dev builds)
167167
if (isJsLegacyCompilerEnabled) {
168168

@@ -172,7 +172,7 @@ if (isJsLegacyCompilerEnabled) {
172172
? compileKotlinJsLegacy
173173
: compileKotlinJs
174174

175-
tasks.withType(compileJsLegacy).configureEach {
175+
tasks.withType(compileJsLegacy.getClass()) {
176176
kotlinOptions {
177177
moduleKind = "umd"
178178
sourceMap = true

buildSrc/src/main/kotlin/KotlinAggregateBuild.kt

Lines changed: 0 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -65,12 +65,3 @@ fun addDevRepositoryIfEnabled(rh: RepositoryHandler, project: Project) {
6565
url = URI.create(devRepoUrl)
6666
}
6767
}
68-
69-
internal fun isKotlinVersionAtLeast(project: Project, atLeastMajor: Int, atLeastMinor: Int): Boolean =
70-
(project.rootProject.properties["kotlin_version"] as? String)?.let { kotlinVersion ->
71-
val (major, minor) = kotlinVersion
72-
.split('.')
73-
.take(2)
74-
.map { it.toInt() }
75-
return major == atLeastMajor && minor >= atLeastMinor
76-
} ?: false
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
@file:JvmName("KotlinVersion")
2+
import org.gradle.api.*
3+
4+
fun Project.isKotlinVersionAtLeast(atLeastMajor: Int, atLeastMinor: Int): Boolean =
5+
(rootProject.properties["kotlin_version"] as? String)?.let { kotlinVersion ->
6+
val (major, minor) = kotlinVersion
7+
.split('.')
8+
.take(2)
9+
.map { it.toInt() }
10+
return major == atLeastMajor && minor >= atLeastMinor
11+
} ?: false

0 commit comments

Comments
 (0)