Is there a way to prevent the dependency tarballs ...
# kotlin-native
s
Is there a way to prevent the dependency tarballs in the
.konan/cache
directory from being deleted, like a Gradle property of some sort? This is for CI, where caching the tarballs directly and unpacking them each time would be optimal.
s
Is there a way to prevent the dependency tarballs in the 
.konan/cache
 directory from being deleted, like a Gradle property of some sort?
I don’t think so. Does anything prevent you from preserving the entire
.konan
directory on CI?
s
Not any practical constraint, no. The main reason I'd rather just keep the cached tarballs is because it's both a time and cycle waste to re-compress those dependencies every time a CI job runs, which is what I'd end up doing for my GitLab CI setup. I could pre-download the tarballs and lock them in a prebuilt Docker image (which I'm doing for one of my projects), but I don't have the bandwidth to support this method for every single project I'm working on.
I'd actually be willing to look into contributing this behavior myself if it's something the team isn't opposed to.
s
The main reason I’d rather just keep the cached tarballs is because it’s both a time and cycle waste to re-compress those dependencies every time a CI job runs
If you just reuse the entire
.konan
directory for different invocation, you won’t need to re-compress the dependencies. Note that you can override the location of
.konan
directory using
KONAN_DATA_DIR
environment variable.
s
Oh, sorry, I should've been more clear about that. The CI jobs run in a newly spun up docker container, and the directories selected for caching (including the
.konan
directory) are compressed into a zip file for storage until the next CI job runs. If I choose to cache the entire
.konan
directory, including the decompressed dependencies, my PC will have to spend time re-compressing all the dependency files every time, and this takes a pretty substantial amount of time in comparison to just keeping the tarballs. I'm already using the
KONAN_DATA_DIR
environment variable for the alternate solution, which is packing the tarballs into the Docker image when it's built, but it would be way easier for me (and save on my bandwidth) if I could just make the tarballs persist. Does that make sense?
s
Now I see. Thanks for clarification. Why do you need to compress
.konan
into a zip?
s
That's just how GitLab's CI works. If I mark a directory as needing to be cached, it'll be compressed into the overall cache zip file when the CI job ends.
If I could cache the tarballs, I wouldn't cache the entire
.konan
directory, I'd just cache the
dependencies
directory along with the
kotlin-native-x
directory.
s
Thanks for explanation!