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

[Feature] Support Kotlin 2 #116

Open
Nillerr opened this issue May 16, 2024 · 3 comments
Open

[Feature] Support Kotlin 2 #116

Nillerr opened this issue May 16, 2024 · 3 comments

Comments

@Nillerr
Copy link
Collaborator

Nillerr commented May 16, 2024

This issue aims to track the resources and steps necessary to support Kotlin 2 and the K2 compiler. The work for this effort is being performed in https://github.com/mockative/mockative/tree/kotlin-2.

Reported Issues

Blocking issues

Challenges

K2 introduces Separation of common and platform sources during compilation, which may be a breaking change for Mockative.

KSP2 introduces New Multiplatform Processing Scheme

@Nillerr
Copy link
Collaborator Author

Nillerr commented May 18, 2024

Unfortunately, it looks like the K2 compiler (and by extension Kotlin 2) will break functionality that Mockative relies on through the Separation of common and platform sources during compilation 😞...

What we can do to continue supporting mocking in Kotlin Multiplatform is by enforcing the use of a @Mockable annotation in the primary source set, which means code would be generated regardless of whether it's being tested or not. We may be able to mitigate this by introducing a Gradle plugin that can detect whether the Gradle tasks being executed contain a KotlinTest task and only generate code in that event. We might also have to ensure that the generated code is deleted whenever a KotlinTest Gradle task is not being executed, such that we don't end up including test-only code in the primary source set.

@Nillerr
Copy link
Collaborator Author

Nillerr commented May 29, 2024

Since google/ksp#1823 appears to be a blocking issue, and the resolution to that issue is targeting Kotlin 2.1, we may not be able to support Kotlin 2+ until this issue is addressed 😞... I will investigate alternatives.

@mustafaozhan
Copy link

issue is targeting Kotlin 2.1

That hurts... 😞

I will investigate alternatives.

Hope you will find something

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants