amazon-ion / ion-element-kotlin

IonElement is an immutable in-memory representation of the Ion data format. IonElement's API is idiomatic to Kotlin.
Apache License 2.0
8 stars 8 forks source link

Adds Ktlint and Kotlin/binary-compatibility-validator checks #72

Closed popematt closed 2 years ago

popematt commented 2 years ago

Issue #, if available:

None

Description of changes:

Adds ktlint and Kotlin/binary-compatibility-validator as Gradle build checks.

This PR is large, but I've split each change into a separate commit so that you can view them independently if you like.

There's really only three files that need to be reviewed—README.md, .editorconfig, and build.gradle. All of the other changes are automated changes.

There are two new files that you may not be familiar with.

api/IonElement.api – this is an automatically generated file that lists the binary APIs of this library. There is now an apiCheck Gradle task that will compare the binary API of the build against the binary API that is stored in this file. If there is a difference, the apiCheck task will fail. If the API change is intentional, run apiDump to regenerate the api file. Why add this? First, it means that changes to the binary API cannot be introduced by accident. (It does not protect against source-incompatible changes, such as changes to reified inline functions.) Second, we can look at the diff of this file when preparing a release. If the file has no changes, it's probably a patch release. If the file has only additive changes, it's a minor version. Anything else is a new major version. .editorconfig – This file defines style settings. It is supported in most IDEs, including IntelliJ, and Ktlint uses it for some configuration as well. Here, we are using it to require newlines at the end of every file, we're making IntelliJ and Ktlint have consistent behavior regarding ordering of imports and whether wildcard imports are allowed, and we're disabling one Ktlint rule for the test files. See https://editorconfig.org/ for more info about .editorconfig files in general.

By submitting this pull request, I confirm that my contribution is made under the terms of the Apache 2.0 license.