Skip to content

Commit

Permalink
Add klib api validation (#149)
Browse files Browse the repository at this point in the history
  • Loading branch information
05nelsonm committed Aug 30, 2024
1 parent ebb73c2 commit 2522117
Show file tree
Hide file tree
Showing 10 changed files with 549 additions and 5 deletions.
4 changes: 4 additions & 0 deletions .github/workflows/CI.yml
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,10 @@ jobs:
distribution: 'zulu'
java-version: 11

- name: Check API Compatibility
if: matrix.os == 'macos-latest'
run: >
./gradlew apiCheck --stacktrace
- name: Run macOS Tests
if: matrix.os == 'macos-latest'
run: >
Expand Down
7 changes: 5 additions & 2 deletions build-logic/src/main/kotlin/-KmpConfigurationExtension.kt
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,12 @@ import org.jetbrains.kotlin.gradle.targets.js.dsl.ExperimentalWasmDsl
fun KmpConfigurationExtension.configureShared(
java9ModuleName: String? = null,
publish: Boolean = false,
explicitApi: Boolean = true,
action: Action<KmpConfigurationContainerDsl>,
) {
if (publish) {
require(!java9ModuleName.isNullOrBlank()) { "publications must specify a module-info name" }
}

configure {
options {
useUniqueModuleNames = true
Expand Down Expand Up @@ -83,7 +86,7 @@ fun KmpConfigurationExtension.configureShared(
}
}

if (explicitApi) { kotlin { explicitApi() } }
if (publish) { kotlin { explicitApi() } }

action.execute(this)
}
Expand Down
5 changes: 5 additions & 0 deletions build.gradle.kts
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,11 @@ plugins.withType<YarnPlugin> {
}

apiValidation {
// Only enable when selectively enabled targets are not being passed via cli.
// See https://github.com/Kotlin/binary-compatibility-validator/issues/269
@OptIn(kotlinx.validation.ExperimentalBCVApi::class)
klib.enabled = findProperty("KMP_TARGETS") == null

if (findProperty("CHECK_PUBLICATION") != null) {
ignoredProjects.add("check-publication")
} else {
Expand Down
2 changes: 1 addition & 1 deletion gradle/libs.versions.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[versions]
gradle-binary-compat = "0.14.0"
gradle-binary-compat = "0.16.3"
gradle-kmp-configuration = "0.3.2"
gradle-kotlin = "1.9.24"
gradle-publish-maven = "0.29.0"
Expand Down
50 changes: 50 additions & 0 deletions library/base16/api/base16.klib.api
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
// Klib ABI Dump
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
// Rendering settings:
// - Signature version: 2
// - Show manifest properties: true
// - Show declarations: true

// Library unique name: <io.matthewnelson.encoding:base16>
final class io.matthewnelson.encoding.base16/Base16 : io.matthewnelson.encoding.core/EncoderDecoder<io.matthewnelson.encoding.base16/Base16.Config> { // io.matthewnelson.encoding.base16/Base16|null[0]
constructor <init>(io.matthewnelson.encoding.base16/Base16.Config) // io.matthewnelson.encoding.base16/Base16.<init>|<init>(io.matthewnelson.encoding.base16.Base16.Config){}[0]

final class Config : io.matthewnelson.encoding.core/EncoderDecoder.Config { // io.matthewnelson.encoding.base16/Base16.Config|null[0]
final val encodeToLowercase // io.matthewnelson.encoding.base16/Base16.Config.encodeToLowercase|{}encodeToLowercase[0]
final fun <get-encodeToLowercase>(): kotlin/Boolean // io.matthewnelson.encoding.base16/Base16.Config.encodeToLowercase.<get-encodeToLowercase>|<get-encodeToLowercase>(){}[0]
}

final object Companion : io.matthewnelson.encoding.core/EncoderDecoder<io.matthewnelson.encoding.base16/Base16.Config> { // io.matthewnelson.encoding.base16/Base16.Companion|null[0]
final const val CHARS_LOWER // io.matthewnelson.encoding.base16/Base16.Companion.CHARS_LOWER|{}CHARS_LOWER[0]
final fun <get-CHARS_LOWER>(): kotlin/String // io.matthewnelson.encoding.base16/Base16.Companion.CHARS_LOWER.<get-CHARS_LOWER>|<get-CHARS_LOWER>(){}[0]
final const val CHARS_UPPER // io.matthewnelson.encoding.base16/Base16.Companion.CHARS_UPPER|{}CHARS_UPPER[0]
final fun <get-CHARS_UPPER>(): kotlin/String // io.matthewnelson.encoding.base16/Base16.Companion.CHARS_UPPER.<get-CHARS_UPPER>|<get-CHARS_UPPER>(){}[0]
}
}

final class io.matthewnelson.encoding.base16/Base16ConfigBuilder { // io.matthewnelson.encoding.base16/Base16ConfigBuilder|null[0]
constructor <init>() // io.matthewnelson.encoding.base16/Base16ConfigBuilder.<init>|<init>(){}[0]
constructor <init>(io.matthewnelson.encoding.base16/Base16.Config?) // io.matthewnelson.encoding.base16/Base16ConfigBuilder.<init>|<init>(io.matthewnelson.encoding.base16.Base16.Config?){}[0]

final var encodeToLowercase // io.matthewnelson.encoding.base16/Base16ConfigBuilder.encodeToLowercase|<set-encodeToLowercase>(kotlin.Boolean){}[0]
final fun <get-encodeToLowercase>(): kotlin/Boolean // io.matthewnelson.encoding.base16/Base16ConfigBuilder.encodeToLowercase.<get-encodeToLowercase>|<get-encodeToLowercase>(){}[0]
final fun <set-encodeToLowercase>(kotlin/Boolean) // io.matthewnelson.encoding.base16/Base16ConfigBuilder.encodeToLowercase.<set-encodeToLowercase>|<set-encodeToLowercase>(kotlin.Boolean){}[0]
final var isLenient // io.matthewnelson.encoding.base16/Base16ConfigBuilder.isLenient|<set-isLenient>(kotlin.Boolean){}[0]
final fun <get-isLenient>(): kotlin/Boolean // io.matthewnelson.encoding.base16/Base16ConfigBuilder.isLenient.<get-isLenient>|<get-isLenient>(){}[0]
final fun <set-isLenient>(kotlin/Boolean) // io.matthewnelson.encoding.base16/Base16ConfigBuilder.isLenient.<set-isLenient>|<set-isLenient>(kotlin.Boolean){}[0]
final var lineBreakInterval // io.matthewnelson.encoding.base16/Base16ConfigBuilder.lineBreakInterval|<set-lineBreakInterval>(kotlin.Byte){}[0]
final fun <get-lineBreakInterval>(): kotlin/Byte // io.matthewnelson.encoding.base16/Base16ConfigBuilder.lineBreakInterval.<get-lineBreakInterval>|<get-lineBreakInterval>(){}[0]
final fun <set-lineBreakInterval>(kotlin/Byte) // io.matthewnelson.encoding.base16/Base16ConfigBuilder.lineBreakInterval.<set-lineBreakInterval>|<set-lineBreakInterval>(kotlin.Byte){}[0]

final fun build(): io.matthewnelson.encoding.base16/Base16.Config // io.matthewnelson.encoding.base16/Base16ConfigBuilder.build|build(){}[0]
final fun strict(): io.matthewnelson.encoding.base16/Base16ConfigBuilder // io.matthewnelson.encoding.base16/Base16ConfigBuilder.strict|strict(){}[0]
}

final fun (kotlin/ByteArray).io.matthewnelson.component.encoding.base16/encodeBase16ToByteArray(): kotlin/ByteArray // io.matthewnelson.component.encoding.base16/encodeBase16ToByteArray|[email protected](){}[0]
final fun (kotlin/CharArray).io.matthewnelson.component.encoding.base16/decodeBase16ToArray(): kotlin/ByteArray? // io.matthewnelson.component.encoding.base16/decodeBase16ToArray|[email protected](){}[0]
final fun io.matthewnelson.encoding.base16/Base16(io.matthewnelson.encoding.base16/Base16.Config?, kotlin/Function1<io.matthewnelson.encoding.base16/Base16ConfigBuilder, kotlin/Unit>): io.matthewnelson.encoding.base16/Base16 // io.matthewnelson.encoding.base16/Base16|Base16(io.matthewnelson.encoding.base16.Base16.Config?;kotlin.Function1<io.matthewnelson.encoding.base16.Base16ConfigBuilder,kotlin.Unit>){}[0]
final fun io.matthewnelson.encoding.base16/Base16(kotlin/Boolean =...): io.matthewnelson.encoding.base16/Base16 // io.matthewnelson.encoding.base16/Base16|Base16(kotlin.Boolean){}[0]
final fun io.matthewnelson.encoding.base16/Base16(kotlin/Function1<io.matthewnelson.encoding.base16/Base16ConfigBuilder, kotlin/Unit>): io.matthewnelson.encoding.base16/Base16 // io.matthewnelson.encoding.base16/Base16|Base16(kotlin.Function1<io.matthewnelson.encoding.base16.Base16ConfigBuilder,kotlin.Unit>){}[0]
final inline fun (kotlin/ByteArray).io.matthewnelson.component.encoding.base16/encodeBase16(): kotlin/String // io.matthewnelson.component.encoding.base16/encodeBase16|[email protected](){}[0]
final inline fun (kotlin/ByteArray).io.matthewnelson.component.encoding.base16/encodeBase16ToCharArray(): kotlin/CharArray // io.matthewnelson.component.encoding.base16/encodeBase16ToCharArray|[email protected](){}[0]
final inline fun (kotlin/String).io.matthewnelson.component.encoding.base16/decodeBase16ToArray(): kotlin/ByteArray? // io.matthewnelson.component.encoding.base16/decodeBase16ToArray|[email protected](){}[0]
Loading

0 comments on commit 2522117

Please sign in to comment.