A playground to gain a wider and deeper knowledge of the libraries in the Kotlin ecosystem
Also the official sample for gradle refreshVersions
Run all the samples
$ ./gradlew :kotlin-jvm:run
Run all the tests
$ ./gradlew :kotlin-testing:test
Test tests called FailingXXX are expected to fail
We want to collect sample usage of Kotlin libraries, and the more the better!
You are very welcome to contribute your own library sample.
==> CONTRIBUTING.md
There are great resources to learn Kotlin.
But once you master the language, you are not done just yet.
You now face another challenging task: become familiar with its ecosystem of libraries.
With time, you want to both acquire:
There are several inefficient ways to do that:
The kotlin-libraries-playgound
contains samples for a growing number of good Kotlin libraries including
Apollo, CliKt, Kodein DI, Kodein DB, Exposed, Fuel, Hoplite, Klaxon, Konad, Konf, Kotlin Collections, Kotlin Faker, Kotlin IO, Kotlinpoet, Kotlin Statistics, Kotlinx Serialization, Ktor Client, Mordant, Moshi, OkHttp, OkIO, Picnic, Retrofit, Skrapeit, SqlDelight, Statemachine, ...,
KoTest, Mockk, Spek, Strikt, Mockito, Junit-Jupiter, ... ...
You are very welcome to contribute new samples (see contributing section below).
For each library, we have a sample usage that is:
Here is for example the sample usage for kotlinx.serialization
package playground.kotlinx.serialization
fun main() {
println("# Kotlin/kotlinx.serialization : Kotlin multiplatform / multi-format serialization")
val user = User(name = "Robert", age = 42)
val json = """{"name":"Robert","age":42}"""
Json.encodeToString(user) shouldBe json
Json.decodeFromString<User>(json) shouldBe user
}
@Serializable
internal data class User(
val name: String,
val age: Int
)
Clone this repository and make it yours.
Want to learn more about, say, OkHttp?
You don't have the hassle to create a new project.
Create a new branch called okhttp and try out things while you are reading the documentation
This playground is also the official sample for gradle refreshVersions
It makes it super easy to refresh dependencies
$ ./gradlew refreshVersions
And to add a new dependency without leaving the IDEA and with auto-completion :