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

Ktorfit Gradle Plugin not compatible with Android Multiplatform Library plugin #638

Open
Sanlorng opened this issue Aug 19, 2024 · 4 comments
Labels
bug Something isn't working

Comments

@Sanlorng
Copy link

Sanlorng commented Aug 19, 2024

Ktorfit version

2.0.1

What happened and how can we reproduce this issue?

the ktorfit gradle plugin will add ksp depedency named 'kspAndroidTest' automatically, but it seems not exist when android multiplatform library plugin(com.android.kotlin.multiplatform.library) applied, when i change android multiplatform library to android library plugin(com.android.library), the ktorfit gradle plugin works normally.
image

What did you expect to happen?

work with android mutiplatform library plugin

Is there anything else we need to know about?

No response

@Sanlorng Sanlorng added the bug Something isn't working label Aug 19, 2024
@Foso
Copy link
Owner

Foso commented Aug 26, 2024

Hi, do you know if there is any documentation about the android multiplatform library plugin ?

@Sanlorng
Copy link
Author

Hi, do you know if there is any documentation about the android multiplatform library plugin ?

According to the official documentation of KSP, we should declare symbol processors based on the compilation target or source code directory. In Android Multiplatform Library plugin, the androidTest source code directory no longer exists. Instead, there are two configurable test source code directories: one for androidTestWithJvm (default name: AndroidTestWithJvm) and another for androidTestWithDevice (default name: AndroidTestWithDevice). These two types of directories are only created in the KotlinExtension.sourceSets when explicitly declared by the user, and their names can be modified. You can find more details in the official Android Multiplatform Library plugin documentation. In the Ktorfit Gradle Plugin, it seems that symbol processors are declared based on the compilation target, and for the test part, you may need to handle it separately by iterating through the SourceSets or allowing users to declare it themselves. This flexibility could enhance the applicability of the Ktorfit Gradle Plugin.

@Foso
Copy link
Owner

Foso commented Aug 28, 2024

Thank you very much for the informations! I think i will add a check if a sourceset with "Test" exist and only then apply KSP

Foso added a commit that referenced this issue Aug 29, 2024
Foso added a commit that referenced this issue Aug 29, 2024
Foso added a commit that referenced this issue Aug 31, 2024
@Foso
Copy link
Owner

Foso commented Sep 2, 2024

Hi with version 2.1.0 i added the check for "test". It should not lead to compilation error anymore, but you would have to add ksp manually for e.g. the androidTestWithDevice task

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

When branches are created from issues, their pull requests are automatically linked.

2 participants