Skip to content

Fix compilation for standalone k2 module #350

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
Jun 10, 2025
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions compiler-plugin/compiler-plugin-k2/build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import org.jetbrains.kotlin.gradle.dsl.ExplicitApiMode
import util.enableContextParameters
import util.otherwise
import util.whenForIde
import util.whenKotlinIsAtLeast
import util.whenKotlinCompilerIsAtLeast

plugins {
alias(libs.plugins.conventions.jvm)
Expand Down Expand Up @@ -69,7 +69,7 @@ tasks.jar {
kotlin {
explicitApi = ExplicitApiMode.Disabled

rootProject.whenKotlinIsAtLeast(2, 2, 0) {
rootProject.whenKotlinCompilerIsAtLeast(2, 2, 0) {
enableContextParameters()
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@ enum class ActionApplied {
}

@Suppress("unused")
inline fun ExtensionAware.whenKotlinIsAtLeast(
inline fun ExtensionAware.whenKotlinCompilerIsAtLeast(
major: Int,
minor: Int,
patch: Int = 0,
action: () -> Unit = {},
): ActionApplied {
val kotlinVersion: KotlinVersion by extra
val kotlinCompilerVersion: KotlinVersion by extra

if (kotlinVersion.isAtLeast(major, minor, patch)) {
if (kotlinCompilerVersion.isAtLeast(major, minor, patch)) {
action()

return ActionApplied.Applied
Expand All @@ -31,6 +31,7 @@ inline fun ExtensionAware.whenKotlinIsAtLeast(
return ActionApplied.NotApplied
}

@Suppress("unused")
inline fun ExtensionAware.whenKotlinLatest(action: () -> Unit): ActionApplied {
val isLatestKotlinVersion: Boolean by extra

Expand Down