Skip to content
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

Kotlin & KSP 2.1.10 #2029

Merged
merged 2 commits into from
Feb 14, 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
6 changes: 3 additions & 3 deletions gradle/libs.versions.toml
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.

[versions]
kotlin = "2.0.10"
kct = "0.5.1"
ksp = "2.0.0-1.0.22"
kotlin = "2.1.10"
kct = "0.7.0"
ksp = "2.1.10-1.0.30"
ktlint = "0.48.2"

[plugins]
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,6 +23,8 @@ import com.tschuchort.compiletesting.configureKsp
import com.tschuchort.compiletesting.kspProcessorOptions
import com.tschuchort.compiletesting.kspSourcesDir
import java.io.File
import org.junit.Assume.assumeFalse
import org.junit.Before
import org.junit.Rule
import org.junit.Test
import org.junit.rules.TemporaryFolder
Expand All @@ -47,6 +49,15 @@ class TestProcessorTest(private val useKsp2: Boolean) {
@JvmField
val temporaryFolder: TemporaryFolder = TemporaryFolder()

@Before
fun skipOnJdk8() {
val javaVersion = System.getProperty("java.version") ?: return // Don't skip if version unknown.
assumeFalse(
"These tests currently fail on JDK 8 when useKsp2 == false",
javaVersion.startsWith("1.8") && !useKsp2,
)
}
Comment on lines +52 to +59
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Turning off these tests for now as they fail with an "internal error". Seems okay since it's just on JDK 8.


@Test
fun smokeTest() {
val compilation = prepareCompilation(
Expand Down Expand Up @@ -577,19 +588,35 @@ class TestProcessorTest(private val useKsp2: Boolean) {
assertThat(result.exitCode).isEqualTo(KotlinCompilation.ExitCode.OK)
val generatedFileText = File(compilation.kspSourcesDir, "kotlin/test/TestTransitiveAliases.kt")
.readText()
assertThat(generatedFileText).isEqualTo(
"""
package test
if (useKsp2) {
assertThat(generatedFileText).isEqualTo(
"""
package test

import kotlin.Int
import kotlin.Unit
import kotlin.Int
import kotlin.Unit

public class TestTransitiveAliases {
public fun <T : Alias41<Alias23, out Alias77<Alias73<Int>>>> bar(vararg arg1: T): Unit = TODO()
}
public class TestTransitiveAliases {
public fun <T : Alias41<Alias43<Alias23>, Alias47<out Alias77<Alias73<Int>>>>> bar(vararg arg1: T): Unit = TODO()
Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Not sure why this started behaving differently with KSP. @ZacSweers any thoughts?

}

""".trimIndent(),
)
""".trimIndent(),
)
} else {
assertThat(generatedFileText).isEqualTo(
"""
package test

import kotlin.Int
import kotlin.Unit

public class TestTransitiveAliases {
public fun <T : Alias41<Alias23, out Alias77<Alias73<Int>>>> bar(vararg arg1: T): Unit = TODO()
}

""".trimIndent(),
)
}
}

@Test
Expand Down
Loading