Tools of the build trade: The making of a tiny Kotlin app

Click for: original source

Tony Robalik published the story of how to build thinks with Gradle, how to use the application and distribution plugins to build the app and bundle a distribution; how to use the shadow plugin to turn it into a fat jar.

The upshot is we turn a 1.5M jar into a 12K “fat” jar, shaving 99.2% off the final binary. This project is built with Gradle 7.1.1. This is important to keep in mind, as you would need to make some code changes if you were using Gradle 6.x.

The article then covers:

  • The app
  • The real code
  • Building an app with Gradle
  • Turning the app into a distribution
  • Layering on the Shadow plugin
  • Layering on Proguard
  • The making of a skinny-fat distribution
  • Publishing our minified distribution

All the code for this is on Github. This post is meant as a minimal example of how you might build a small Kotlin app with Gradle, which also had the requirements that it should have zero dependencies, be as small as possible, and be publishable for ease of access by potential users. Good read!

[Read More]

Tags kotlin programming web-development app-development software-architecture java