The Flank fat jar size is 35.3 MB. Let's investigate where all the weight is coming from. Maybe there's an opportunity to slim down the jar?
Interestingly alot of discussion is about around reducing binary file sizes for android. I think it can be applied here.
Here is an example of reducing kotlin std lib by up to 99% by using the d8 obsfucation tool. It could possibly be applied here to reduce size if we cannot isolate out why it is so big in the first place.
https://jakewharton.com/shrinking-a-kotlin-binary/
that's awesome!
@bootstraponline ill assign it to myself as i have a good idea where to start. Ill ofcourse wait for the ranking.
Sounds good! For clarity, this ticket is about understanding the size. Once that's known, then I think we'd create another ticket to evaluate solutions.
So after some investigation,
The size of the expanded Flank jar contains many dependacies. The following dependacies are listed based on their size when expanded from a built Flank.jar file.
The largest collection of libraries come from the com.google namespace, then from io.netty, io.ktor and general kotlin libraries.
I will look into the actual dependancies in gradle and try see if there are any obvious issues.
Awesome. might be worth looking into graalvm
use a Graal native image to produce a minimal native binary
Yes, @bootstraponline thats definitely a good investigation point.
I see though from the investigation above that a-lot of the libraries are either essential to the project and/or sub-dependancies of other libraries. Especially since the google.commons is so large.
Therefore i investigated how we made the shadow jar.
There is a simple fix that can be applied for the gradle script for the shadow jar process:
https://imperceptiblethoughts.com/shadow/configuration/minimizing/
There is also a good reason to look into graalvm. i assume for graal we would be using the community edition (free).
There is also the possibility to apply the d8 optimisation tool that is well used within android (to create apks and lib files).
Lets create some sub-tasks and investigate each one independently.
I think this ticket "Understand Flank jar size" is done. We have an understanding now of why the Flank jar is large. The additional tasks will handle the actual reduction of the jar size.
@bootstraponline Sure!