Skip to content

Commit

Permalink
Addressing Kotlin 2.0 breaking changes (#90)
Browse files Browse the repository at this point in the history
  • Loading branch information
gmazzo authored May 29, 2024
1 parent e636e7a commit faec252
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 4 deletions.
2 changes: 1 addition & 1 deletion demo-project-kotlin/app/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ kotlin {
applyDefaultHierarchyTemplate()

sourceSets {
val jvmCommonMain by creating
val jvmCommonMain by creating { dependsOn(commonMain.get()) }

getByName("jvmMain") { dependsOn(jvmCommonMain) }
getByName("androidMain") { dependsOn(jvmCommonMain) }
Expand Down
2 changes: 2 additions & 0 deletions plugins/buildSrc/settings.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,5 @@ dependencyResolutionManagement {
}
}
}

rootProject.name = "buildSrc"
Original file line number Diff line number Diff line change
Expand Up @@ -12,16 +12,20 @@ import org.jetbrains.kotlin.backend.common.extensions.IrGenerationExtension
import org.jetbrains.kotlin.compiler.plugin.CompilerPluginRegistrar
import org.jetbrains.kotlin.compiler.plugin.ExperimentalCompilerApi
import org.jetbrains.kotlin.config.CompilerConfiguration
import org.jetbrains.kotlin.ir.backend.js.resolverLogger
import org.jetbrains.kotlin.ir.util.IrMessageLogger
import org.jetbrains.kotlin.ir.util.irMessageLogger

internal class CodeOwnersComponentRegistrar : CompilerPluginRegistrar() {

override val supportsK2 = true

override fun ExtensionStorage.registerExtensions(configuration: CompilerConfiguration) {
if (KotlinVersion.CURRENT.toString() != BuildConfig.EXPECTED_KOTLIN_VERSION) {
configuration.resolverLogger.warning("The '$COMPILER_PLUGIN_ID' plugin was designed for Kotlin " +
"${BuildConfig.EXPECTED_KOTLIN_VERSION}, but you are using ${KotlinVersion.CURRENT}")
configuration.irMessageLogger.report(
severity = IrMessageLogger.Severity.WARNING,
message = "The '$COMPILER_PLUGIN_ID' plugin was designed for Kotlin ${BuildConfig.EXPECTED_KOTLIN_VERSION}, but you are using ${KotlinVersion.CURRENT}",
location = null
)
}

val codeOwnersRoot = configuration.get(CODEOWNERS_ROOT)!!
Expand Down

0 comments on commit faec252

Please sign in to comment.