Skip to content

Commit

Permalink
Update to Kotlin 2.0.20-Beta2 (#3690)
Browse files Browse the repository at this point in the history
  • Loading branch information
whyoleg authored Jul 12, 2024
1 parent f414a5f commit 3a0a602
Show file tree
Hide file tree
Showing 5 changed files with 13 additions and 19 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ open class AllSupportedTestedVersionsArgumentsProvider : TestedVersionsArguments

object TestedVersions {

val LATEST = BuildVersions("8.7", "2.0.20-Beta1")
val LATEST = BuildVersions("8.7", "2.0.20-Beta2")

/**
* All supported Gradle/Kotlin versions, including [LATEST]
Expand All @@ -41,7 +41,7 @@ object TestedVersions {
val ANDROID =
BuildVersions.permutations(
gradleVersions = listOf("8.4"),
kotlinVersions = listOf("2.0.20-Beta1"),
kotlinVersions = listOf("2.0.20-Beta2"),
androidGradlePluginVersions = listOf("8.3.0")
) + BuildVersions.permutations(
gradleVersions = listOf("7.4.2", *ifExhaustive("7.0")),
Expand All @@ -67,7 +67,7 @@ object TestedVersions {
"1.9.10" to "18.2.0-pre.597",
"1.9.23" to "18.2.0-pre.682",
"2.0.0" to "18.2.0-pre.726",
"2.0.20-Beta1" to "18.3.1-pre.758",
"2.0.20-Beta2" to "18.3.1-pre.758",
)
}

Expand Down
2 changes: 1 addition & 1 deletion dokka-integration-tests/maven/projects/it-maven/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<version>1.0-SNAPSHOT</version>

<properties>
<kotlin.version>2.0.20-Beta1</kotlin.version>
<kotlin.version>2.0.20-Beta2</kotlin.version>
</properties>
<build>
<plugins>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,10 @@ package org.jetbrains.dokka.analysis.kotlin.descriptors.compiler.configuration.r

import org.jetbrains.kotlin.analyzer.ModuleInfo
import org.jetbrains.kotlin.descriptors.ModuleCapability
import org.jetbrains.kotlin.library.KotlinLibrary
import org.jetbrains.kotlin.library.metadata.DeserializedKlibModuleOrigin
import org.jetbrains.kotlin.library.metadata.KlibModuleOrigin
import org.jetbrains.kotlin.library.KotlinLibrary
import org.jetbrains.kotlin.library.isInterop
import org.jetbrains.kotlin.library.metadata.isCInteropLibrary
import org.jetbrains.kotlin.library.shortName
import org.jetbrains.kotlin.library.uniqueName
import org.jetbrains.kotlin.name.Name
Expand Down Expand Up @@ -42,7 +42,7 @@ internal class DokkaNativeKlibLibraryInfo(
get() {
val capabilities = super.capabilities.toMutableMap()
capabilities[KlibModuleOrigin.CAPABILITY] = DeserializedKlibModuleOrigin(kotlinLibrary)
capabilities[ImplicitIntegerCoercion.MODULE_CAPABILITY] = kotlinLibrary.safeRead(false) { isInterop }
capabilities[ImplicitIntegerCoercion.MODULE_CAPABILITY] = kotlinLibrary.safeRead(false) { isCInteropLibrary() }
return capabilities
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,36 +11,32 @@ import org.jetbrains.kotlin.library.metadata.KlibMetadataVersion
import org.jetbrains.kotlin.library.metadata.metadataVersion
import java.io.IOException

// File content is based on https://github.com/JetBrains/intellij-community/blob/76b51b233ad2e831c3e1fe8f7dcb0f7c77ad918a/plugins/kotlin/base/project-structure/src/org/jetbrains/kotlin/idea/base/projectStructure/moduleInfo/KlibCompatibilityInfo.kt

/**
* Whether a certain KLIB is compatible for the purposes of IDE: indexation, resolve, etc.
*/
internal sealed class KlibCompatibilityInfo(val isCompatible: Boolean) {
object Compatible : KlibCompatibilityInfo(true)
object Pre14Layout : KlibCompatibilityInfo(false)
class IncompatibleMetadata(val isOlder: Boolean) : KlibCompatibilityInfo(false)
}


internal fun <T> KotlinLibrary.safeRead(defaultValue: T, action: KotlinLibrary.() -> T) = try {
action()
} catch (_: IOException) {
defaultValue
}

internal val KotlinLibrary.compatibilityInfo: KlibCompatibilityInfo
get() {
val hasPre14Manifest = safeRead(false) { has_pre_1_4_manifest }
if (hasPre14Manifest)
return KlibCompatibilityInfo.Pre14Layout

val metadataVersion = safeRead(null) { this.metadataVersion }
@Suppress("DEPRECATION")
return when {
metadataVersion == null -> {
// Too old KLIB format, even doesn't have metadata version
KlibCompatibilityInfo.IncompatibleMetadata(true)
}

!metadataVersion.isCompatible() -> {
!metadataVersion.isCompatibleWithCurrentCompilerVersion() -> {
val isOlder = metadataVersion.isAtLeast(KlibMetadataVersion.INSTANCE)
KlibCompatibilityInfo.IncompatibleMetadata(!isOlder)
}
Expand Down
6 changes: 2 additions & 4 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[versions]

gradlePlugin-kotlin = "2.0.20-Beta1"
gradlePlugin-kotlin = "2.0.20-Beta2"
# See: https://kotlinlang.org/docs/gradle-configure-project.html#apply-the-plugin
gradlePlugin-android = "7.1.3"
gradlePlugin-dokka = "1.9.20"
Expand All @@ -11,9 +11,7 @@ kotlinx-serialization = "1.6.0"
kotlinx-bcv = "0.13.2"

## Analysis
# Version of compiler for analysis-descriptor is in sync with K2 because of updated intellij-platform in 2.0.20-dev-5055
# can be changed to just 2.0.20 after release of Kotlin 2.0.20
kotlin-compiler = "2.0.20-dev-5135"
kotlin-compiler = "2.0.20-Beta2"
kotlin-compiler-k2 = "2.0.20-dev-7572"

# MUST match the version of the intellij platform used in the kotlin compiler,
Expand Down

0 comments on commit 3a0a602

Please sign in to comment.