Update from Forestry.io

Harsh Shandilya updated content/posts/tips-for-building-kotlin-libraries.md
This commit is contained in:
Harsh Shandilya 2020-12-08 08:03:19 +00:00 committed by Forestry.io
parent 6c9630de05
commit c999124e7d
2 changed files with 3 additions and 4 deletions

View File

@ -48,4 +48,3 @@ pages:
- content/posts/teachingkotlin-part-1-classes-and-objects-and-everything-in-between.md
- content/posts/teachingkotlin-part-2-variables.md
- content/posts/why-i-went-back-to-the-gradle-groovy-dsl.md
- content/posts/why-should-you-be-using-kotlin-s-explicit-api-mode-for-your-library-projects.md

View File

@ -5,10 +5,10 @@ description = "Building libraries is hard, and keeping track of your public API
draft = true
slug = "tips-for-building-kotlin-libraries"
social_image = "/uploads/kotlin_800x320.png"
tags = []
tags = ["android", "kotlin", "libraries"]
title = "Tips and tricks for building libraries in Kotlin"
+++
+++
Building a library is arguably a far more involved task than building an application. You need to be _extra_ mindful of your dependencies, and ensure that you are not breaking source and/or binary compatibility unintentionally. When doing so in Kotlin, you may also need to also provide an idiomatic API surface for Java callers if you're offering JVM support.
I have _some_ experience building libraries, and have had the fortune of seeing a **lot** of other, much smarter people do it. This post aims to serve as a collection of what I've learned by doing things myself and observing others, that will hopefully be helpful to people trying their hand at library development.
@ -122,4 +122,4 @@ How does that help us offer Java-only APIs though? Well, here's how Piwai [did i
fun newBuilder() = Builder(this)
```
Since the version here is set to `999.9`, which hopefully Kotlin will never be over, any attempt to use this will result in a compiler error. The only way to work around this madness is to be equally mad and pass `-api-version 999.9`, which you'd never do, right? 😬
Since the version here is set to `999.9`, which hopefully Kotlin will never be over, any attempt to use this will result in a compiler error. The only way to work around this madness is to be equally mad and pass `-api-version 999.9`, which you'd never do, right? 😬