Skip to content

Commit 5d5b65f

Browse files
ALikhachevSpace Team
authored and
Space Team
committed
[Build] Configure API/language version 1.7 for Gradle plugins
Also fixes part of deprecation warnings so that project sync passes. The rest is disabled to be fixed in the next commits Note that even though we could use language version 1.8, it's preferrable to have it exactly the same as the bundled compiler for Gradle Kotlin scripts for more reliable compatibility. ^KT-72329 In Progress
1 parent da3d8cc commit 5d5b65f

File tree

7 files changed

+16
-21
lines changed

7 files changed

+16
-21
lines changed

compiler/util-klib/src/org/jetbrains/kotlin/library/encodings/WobblyTF8.kt

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -29,11 +29,11 @@ object WobblyTF8 {
2929
if (char1 < '\u0080') {
3030
// U+0000..U+007F -> 0xxxxxxx
3131
// 7 meaningful bits -> 1 byte
32-
buffer[writtenBytes++] = char1.toInt()
32+
buffer[writtenBytes++] = char1.code
3333
} else if (char1 < '\u0800') {
3434
// U+0080..U+07FF -> 110xxxxx 10xxxxxx
3535
// 11 meaningful bits -> 2 bytes
36-
val codePoint = char1.toInt()
36+
val codePoint = char1.code
3737
buffer[writtenBytes++] = (codePoint ushr 6) or 0b1100_0000
3838
buffer[writtenBytes++] = (codePoint and 0b0011_1111) or 0b1000_0000
3939
} else {
@@ -55,7 +55,7 @@ object WobblyTF8 {
5555

5656
// U+0800..U+FFFF -> 1110xxxx 10xxxxxx 10xxxxxx
5757
// 16 meaningful bits -> 3 bytes
58-
val codePoint = char1.toInt()
58+
val codePoint = char1.code
5959
buffer[writtenBytes++] = (codePoint ushr 12) or 0b1110_0000
6060
buffer[writtenBytes++] = ((codePoint ushr 6) and 0b0011_1111) or 0b1000_0000
6161
buffer[writtenBytes++] = (codePoint and 0b0011_1111) or 0b1000_0000

gradle.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -90,7 +90,7 @@ kotlin.build.internal.gradle.setup=true
9090
#kotlin.build.useFirForLibraries=true
9191

9292
# Disable -Werror compiler flag
93-
#kotlin.build.disable.werror=true
93+
kotlin.build.disable.werror=true
9494

9595
# Render internal diagostic names
9696
#kotlin.build.render.diagnostic.names=true

libraries/tools/kotlin-gradle-plugin-idea/build.gradle.kts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -9,16 +9,7 @@ plugins {
99
id("org.jetbrains.kotlinx.binary-compatibility-validator")
1010
}
1111

12-
@Suppress("DEPRECATION", "DEPRECATION_ERROR")
13-
tasks.withType<KotlinCompilationTask<*>>().configureEach {
14-
compilerOptions {
15-
apiVersion.value(KotlinVersion.KOTLIN_1_5).finalizeValueOnRead()
16-
languageVersion.value(KotlinVersion.KOTLIN_1_5).finalizeValueOnRead()
17-
freeCompilerArgs.add("-Xsuppress-version-warnings")
18-
}
19-
}
20-
21-
configureRunViaKotlinBuildToolsApi()
12+
configureKotlinCompileTasksGradleCompatibility()
2213

2314
kotlin.sourceSets.configureEach {
2415
languageSettings.optIn("org.jetbrains.kotlin.gradle.InternalKotlinGradlePluginApi")

libraries/tools/kotlin-gradle-plugin/build.gradle.kts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -339,9 +339,9 @@ tasks {
339339
/*
340340
* This excludes .kotlin_module files for compiler modules from the fat jars.
341341
* These files are required only at compilation time, but we include the modules only for runtime
342-
* Hack for not limiting LV to 1.5 for those modules. To be removed after KT-70247
342+
* Hack for not limiting LV to 1.7 for those modules. To be removed after KT-70247
343343
*/
344-
pivotVersion = KotlinMetadataPivotVersion(1, 6, 0)
344+
pivotVersion = KotlinMetadataPivotVersion(1, 8, 0)
345345
}
346346
asmDeprecation {
347347
val exclusions = listOf(

native/utils/src/org/jetbrains/kotlin/konan/target/utils.kt

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55

66
package org.jetbrains.kotlin.konan.target
77

8+
import java.util.Locale
9+
810
/**
911
* Name of a preset used in the 'kotlin-multiplatform' Gradle plugin to represent this target.
1012
*/
@@ -21,3 +23,5 @@ private fun evaluatePresetName(targetName: String): String {
2123
val nameParts = targetName.split('_').mapNotNull { it.takeIf(String::isNotEmpty) }
2224
return nameParts.asSequence().drop(1).joinToString("", nameParts.firstOrNull().orEmpty()) { it.capitalize() }
2325
}
26+
27+
private fun String.capitalize(): String = replaceFirstChar { if (it.isLowerCase()) it.titlecase(Locale.getDefault()) else it.toString() }

native/utils/src/org/jetbrains/kotlin/konan/util/VisibleNamed.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55

66
package org.jetbrains.kotlin.konan.util
77

8-
val <T : Enum<T>> T.visibleName get() = name.toLowerCase()
8+
val <T : Enum<T>> T.visibleName get() = name.lowercase()
99

1010
interface Named {
1111
val name: String

repo/gradle-build-conventions/buildsrc-compat/src/main/kotlin/GradleCommon.kt

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -545,10 +545,10 @@ fun Project.configureKotlinCompileTasksGradleCompatibility() {
545545
compilerOptions {
546546
if (!kotlinBuildProperties.isInJpsBuildIdeaSync) {
547547
// check https://docs.gradle.org/current/userguide/compatibility.html#kotlin for Kotlin-Gradle versions matrix
548-
@Suppress("DEPRECATION", "DEPRECATION_ERROR") // we can't use language version greater than 1.5 as minimal supported Gradle embeds Kotlin 1.4
549-
languageVersion.set(KotlinVersion.KOTLIN_1_5)
550-
@Suppress("DEPRECATION", "DEPRECATION_ERROR") // we can't use api version greater than 1.4 as minimal supported Gradle version uses kotlin-stdlib 1.4
551-
apiVersion.set(KotlinVersion.KOTLIN_1_4)
548+
@Suppress("DEPRECATION", "DEPRECATION_ERROR") // we can't use language version greater than 1.8 as our minimal supported Gradle 7.6 embeds Kotlin 1.7.10
549+
languageVersion.set(KotlinVersion.KOTLIN_1_7)
550+
@Suppress("DEPRECATION", "DEPRECATION_ERROR") // we can't use api version greater than 1.7 as our minimal supported Gradle version 7.6 uses kotlin-stdlib 1.7
551+
apiVersion.set(KotlinVersion.KOTLIN_1_7)
552552
}
553553
freeCompilerArgs.addAll(
554554
listOf(

0 commit comments

Comments
 (0)