What is the best way to have the cinterop task re-...
# kotlin-native
l
What is the best way to have the cinterop task re-run if a binary it links against changes? I'm trying to implement something 'similar' to jvm's resources folder, where I can specify a folder and a task I wrote runs ld to create an object file with the binary data, then use cinterop to add the binary to my code. This works fine, but I have to run a clean after every time my resources change.
I'm converting all the object files to a .a file (static library), so I really just need a way to tell gradle's caching mechanism to check for changes to the file before skipping the task.
a
you can add files/directories as task inputs using the runtime api, and then if they change then Gradle will consider the task out-of-date and will re-run it, and any dependant tasks, if required
l
Will this work with all the new lazy configuration mechanisms? If so, I'll definitely take a look.
a
yes, for sure
so long as you don’t touch any of the footguns that Gradle leaves lying around…
l
Just when I finally learned gradle pretty well a couple years ago, now everything's new.
b
Embedded kn resources! Can you share some code? I'm very interested in this.
l
I'm trying to get it to a usable state first, then I'll create a GitHub repo. The end goal is a native Linux ktor server that serves a Compose for Web frontend. The goal right now is an app that lets me manage a linux system via a browser. Making it native Linux instead of JVM gives me better access to Linux C apis.