Member-only story
Building a calendar DSL in Kotlin
A couple of weeks ago at work, we identified the need to define a list of dates to represent when a Bitrise workflow should be triggered for an app. To bring some context to this, we have two mobile apps (Android and iOS) which map to two applications in Bitrise. Each of these applications have different workflows on Bitrise (for building, running tests, linting, cutting release candidates, etc).
At the beginning we thought of creating a Kotlin data class which will hold all the necessary properties to define a launch, something such as:
and then defining our “calendar” as a list of instances of that class:
This should be enough but it is also true that the syntax could be much more human friendly and less error prone. For this reason we considered writing a DSL to render something such as: