takahirom / roborazzi

Make JVM Android integration test visible 🤖📸
https://takahirom.github.io/roborazzi/
Apache License 2.0
654 stars 25 forks source link

Migrate java.io.File Usage to Kotlin Multiplatform-Compatible Abstraction #302

Closed takahirom closed 1 month ago

takahirom commented 3 months ago

We're using java.io.File which is not compatible with Kotlin Multiplatform (KMP). We need to replace it with a KMP-friendly alternative to achieve cross-platform compatibility like iOS

eyedol commented 2 months ago

Did you have any library in mind for this? I see these io libraries are available for KMP.

  1. Okio
  2. korlibs
  3. Suparnatural FS
  4. kotlinx-io

Which do you think will be more appropriate for Roborazzi? If we agree on one, I don't mind picking this issue to work on. Let me know.

takahirom commented 2 months ago

@eyedol Thank you for suggesting options. Perhaps Okio and Kotlinx-io are good choices because of their user base. Many people use Okio for their network requests, and we don't want to disrupt their builds. Thus, I think Kotlinx-io is a good choice.

@RyuNen344 I apologize for the sudden contact, but you seem knowledgeable about Roborazzi and Okio. Could you share any opinions on this matter?

eyedol commented 1 month ago

@takahirom thanks for your quick response. Yeah I think so too, kotlinx-io is a good choice to go with as it's an official library by Jetbrains. My only issue it's an experimental library and its APIs may change.

Note that the library is experimental, and the API is subject to change.

If it's not a concern, I guess we can run away with using it. And yes let's see what RyuNen344 says...

RyuNen344 commented 1 month ago

@takahirom thanks for contacts me 😉

Since kotlinx-io is built upon Okio's implementation, both libraries should function with Roborazzi. Here's a breakdown of their key features to help you decide:

kotlinx-io

Okio

Roborazzi likely doesn't necessitate stream or encryption stream handling, so kotlinx-io might suffice for basic file I/O needs. If you foresee complex file operations or stream processing in the future, Okio offers a richer feature set.

Ultimately, the choice depends on your project's requirements. Both libraries are well-maintained by reputable organizations.

eyedol commented 1 month ago

@takahirom I believe per @RyuNen344 comprehensive response, it's safe to say that we can use kotlinx.io as it has all that's needed for Roborazzi. Well, except for the fact that it's currently experimental and the API's might change. I guess we will cross that bridge when that happens.