JetBrains / kotlin-native

Kotlin/Native infrastructure
Apache License 2.0
7.02k stars 568 forks source link

Support for including arbitrary file in bundle for Kotlin Native library project? #3511

Closed cody1024d closed 4 years ago

cody1024d commented 4 years ago

Hello,

I was wondering if there was an accepted method to include an arbitrary file (for example a json file) within a Kotlin Native (in the context of multiplatform) project such that it is included within the static framework that I am generating?

A use case that I am trying to accomplish:

I am writing a library that handles authenticating against a server. This particular server needs a self-signed certificate. I want to include this certificate within the library, so each client (of this library) does not have to include the certificate themselves.

On the Android side I accomplish this by putting it inside the res/raw folder (and thus it gets bundled up correctly), but am unfamiliar with how this would work given the Kotlin Native gradle plugin.

Thanks!

artdfel commented 4 years ago

Hello! Currently, there is no such option in the plugin. But, one can extend the Gradle script with some manual copying important files into the framework. There is a conversation here, with some recommendations on it. Also, one can take a look at the library moko-resources, dealing with this problem.

cody1024d commented 4 years ago

Thank you @artdfel for the quick and thurough response. Closing this issue.