Skip to content

Commit 5915260

Browse files
authored
Add klib api validation (#51)
1 parent fff249f commit 5915260

File tree

11 files changed

+190
-16
lines changed

11 files changed

+190
-16
lines changed

.github/workflows/CI.yml

Lines changed: 26 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ jobs:
1111
fail-fast: false
1212
matrix:
1313
os: [ macos-latest, ubuntu-latest, windows-latest ]
14+
java-version: [ 11, 19 ]
1415

1516
runs-on: ${{ matrix.os }}
1617

@@ -42,33 +43,43 @@ jobs:
4243
key: ${{ runner.os }}-gradle-caches-${{ hashFiles('**/*.gradle.kts') }}-${{ hashFiles('gradle/libs.versions.toml') }}
4344
restore-keys: ${{ runner.os }}-gradle-caches-
4445

45-
# Windows does not build ANDROID, but needs Java 11 for JPMS Multi-Release Jar build
46-
- name: Setup JDK 11
47-
if: matrix.os == 'windows-latest'
46+
- name: Setup JDK
4847
uses: actions/setup-java@v3.4.0
4948
with:
5049
distribution: 'zulu'
51-
java-version: 11
50+
java-version: ${{ matrix.java-version }}
5251

53-
- name: Setup JDK 19
54-
if: matrix.os != 'windows-latest'
55-
uses: actions/setup-java@v3.4.0
56-
with:
57-
distribution: 'zulu'
58-
java-version: 19
52+
- name: Check API Compatibility
53+
if: matrix.os == 'macos-latest' && matrix.java-version == 19
54+
run: >
55+
./gradlew apiCheck --stacktrace
5956
6057
- name: Run macOS Tests
61-
if: matrix.os == 'macos-latest'
58+
if: matrix.os == 'macos-latest' && matrix.java-version == 19
6259
run: >
6360
./gradlew check --stacktrace
64-
-PKMP_TARGETS="JVM,JS,IOS_ARM64,IOS_X64,IOS_SIMULATOR_ARM64,MACOS_ARM64,MACOS_X64,TVOS_ARM64,TVOS_X64,TVOS_SIMULATOR_ARM64,WATCHOS_ARM32,WATCHOS_ARM64,WATCHOS_DEVICE_ARM64,WATCHOS_X64,WATCHOS_SIMULATOR_ARM64,WASM_JS,WASM_WASI"
61+
-PKMP_TARGETS="IOS_ARM64,IOS_X64,IOS_SIMULATOR_ARM64,JVM,MACOS_ARM64,MACOS_X64,TVOS_ARM64,TVOS_X64,TVOS_SIMULATOR_ARM64,WATCHOS_ARM32,WATCHOS_ARM64,WATCHOS_DEVICE_ARM64,WATCHOS_X64,WATCHOS_SIMULATOR_ARM64"
62+
63+
- name: Run macOS Java11 Tests
64+
if: matrix.os == 'macos-latest' && matrix.java-version == 11
65+
run: >
66+
./gradlew check --stacktrace
67+
-PKMP_TARGETS="JS,JVM,WASM_JS,WASM_WASI"
68+
6569
- name: Run Linux Tests
66-
if: matrix.os == 'ubuntu-latest'
70+
if: matrix.os == 'ubuntu-latest' && matrix.java-version == 19
71+
run: >
72+
./gradlew check --stacktrace
73+
-PKMP_TARGETS="ANDROID,ANDROID_ARM32,ANDROID_ARM64,ANDROID_X64,ANDROID_X86,JVM,LINUX_ARM64,LINUX_X64"
74+
75+
- name: Run Linux Java11 Tests
76+
if: matrix.os == 'ubuntu-latest' && matrix.java-version == 11
6777
run: >
6878
./gradlew check --stacktrace
69-
-PKMP_TARGETS="JVM,JS,ANDROID,ANDROID_ARM32,ANDROID_ARM64,ANDROID_X64,ANDROID_X86,LINUX_ARM64,LINUX_X64,WASM_JS,WASM_WASI"
79+
-PKMP_TARGETS="JS,JVM,WASM_JS,WASM_WASI"
80+
7081
- name: Run Windows Tests
71-
if: matrix.os == 'windows-latest'
82+
if: matrix.os == 'windows-latest' && matrix.java-version == 11
7283
run: >
7384
./gradlew check --stacktrace
7485
-PKMP_TARGETS="JVM,JS,MINGW_X64,WASM_JS,WASM_WASI"

build.gradle.kts

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,11 @@ plugins.withType<YarnPlugin> {
4444
}
4545

4646
apiValidation {
47+
// Only enable when selectively enabled targets are not being passed via cli.
48+
// See https://github.com/Kotlin/binary-compatibility-validator/issues/269
49+
@OptIn(kotlinx.validation.ExperimentalBCVApi::class)
50+
klib.enabled = findProperty("KMP_TARGETS") == null
51+
4752
if (findProperty("CHECK_PUBLICATION") != null) {
4853
ignoredProjects.add("check-publication")
4954
} else {

gradle/libs.versions.toml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
[versions]
22
gradle-android = "8.2.2"
3-
gradle-binary-compat = "0.14.0"
3+
gradle-binary-compat = "0.16.3"
44
gradle-kmp-configuration = "0.3.2"
55
gradle-kotlin = "1.9.24"
66
gradle-publish-maven = "0.29.0"
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac-md>
9+
final class org.kotlincrypto.macs.hmac.md/HmacMD5 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.md/HmacMD5|null[0]
10+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.md/HmacMD5.<init>|<init>(kotlin.ByteArray){}[0]
11+
}
Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,8 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac-md5>
Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,11 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac-sha1>
9+
final class org.kotlincrypto.macs.hmac.sha1/HmacSHA1 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha1/HmacSHA1|null[0]
10+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha1/HmacSHA1.<init>|<init>(kotlin.ByteArray){}[0]
11+
}
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac-sha2>
9+
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA224 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA224|null[0]
10+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA224.<init>|<init>(kotlin.ByteArray){}[0]
11+
}
12+
13+
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA256 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA256|null[0]
14+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA256.<init>|<init>(kotlin.ByteArray){}[0]
15+
}
16+
17+
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA384 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA384|null[0]
18+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA384.<init>|<init>(kotlin.ByteArray){}[0]
19+
}
20+
21+
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA512 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA512|null[0]
22+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha2/HmacSHA512.<init>|<init>(kotlin.ByteArray){}[0]
23+
}
24+
25+
final class org.kotlincrypto.macs.hmac.sha2/HmacSHA512t : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha2/HmacSHA512t|null[0]
26+
constructor <init>(kotlin/ByteArray, kotlin/Int) // org.kotlincrypto.macs.hmac.sha2/HmacSHA512t.<init>|<init>(kotlin.ByteArray;kotlin.Int){}[0]
27+
}
28+
29+
final fun org.kotlincrypto.macs.hmac.sha2/HmacSHA512_224(kotlin/ByteArray): org.kotlincrypto.macs.hmac.sha2/HmacSHA512t // org.kotlincrypto.macs.hmac.sha2/HmacSHA512_224|HmacSHA512_224(kotlin.ByteArray){}[0]
30+
final fun org.kotlincrypto.macs.hmac.sha2/HmacSHA512_256(kotlin/ByteArray): org.kotlincrypto.macs.hmac.sha2/HmacSHA512t // org.kotlincrypto.macs.hmac.sha2/HmacSHA512_256|HmacSHA512_256(kotlin.ByteArray){}[0]
Lines changed: 39 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,39 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac-sha3>
9+
final class org.kotlincrypto.macs.hmac.sha3/HmacKeccak224 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacKeccak224|null[0]
10+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacKeccak224.<init>|<init>(kotlin.ByteArray){}[0]
11+
}
12+
13+
final class org.kotlincrypto.macs.hmac.sha3/HmacKeccak256 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacKeccak256|null[0]
14+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacKeccak256.<init>|<init>(kotlin.ByteArray){}[0]
15+
}
16+
17+
final class org.kotlincrypto.macs.hmac.sha3/HmacKeccak384 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacKeccak384|null[0]
18+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacKeccak384.<init>|<init>(kotlin.ByteArray){}[0]
19+
}
20+
21+
final class org.kotlincrypto.macs.hmac.sha3/HmacKeccak512 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacKeccak512|null[0]
22+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacKeccak512.<init>|<init>(kotlin.ByteArray){}[0]
23+
}
24+
25+
final class org.kotlincrypto.macs.hmac.sha3/HmacSHA3_224 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_224|null[0]
26+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_224.<init>|<init>(kotlin.ByteArray){}[0]
27+
}
28+
29+
final class org.kotlincrypto.macs.hmac.sha3/HmacSHA3_256 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_256|null[0]
30+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_256.<init>|<init>(kotlin.ByteArray){}[0]
31+
}
32+
33+
final class org.kotlincrypto.macs.hmac.sha3/HmacSHA3_384 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_384|null[0]
34+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_384.<init>|<init>(kotlin.ByteArray){}[0]
35+
}
36+
37+
final class org.kotlincrypto.macs.hmac.sha3/HmacSHA3_512 : org.kotlincrypto.macs.hmac/Hmac { // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_512|null[0]
38+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.hmac.sha3/HmacSHA3_512.<init>|<init>(kotlin.ByteArray){}[0]
39+
}

library/hmac/hmac/api/hmac.klib.api

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:hmac>
9+
abstract class org.kotlincrypto.macs.hmac/Hmac : org.kotlincrypto.core.mac/Mac // org.kotlincrypto.macs.hmac/Hmac|null[0]

library/kmac/api/kmac.klib.api

Lines changed: 50 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,50 @@
1+
// Klib ABI Dump
2+
// Targets: [androidNativeArm32, androidNativeArm64, androidNativeX64, androidNativeX86, iosArm64, iosSimulatorArm64, iosX64, js, linuxArm64, linuxX64, macosArm64, macosX64, mingwX64, tvosArm64, tvosSimulatorArm64, tvosX64, wasmJs, wasmWasi, watchosArm32, watchosArm64, watchosDeviceArm64, watchosSimulatorArm64, watchosX64]
3+
// Rendering settings:
4+
// - Signature version: 2
5+
// - Show manifest properties: true
6+
// - Show declarations: true
7+
8+
// Library unique name: <org.kotlincrypto.macs:kmac>
9+
final class org.kotlincrypto.macs.kmac/KMAC128 : org.kotlincrypto.macs.kmac/Kmac { // org.kotlincrypto.macs.kmac/KMAC128|null[0]
10+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.kmac/KMAC128.<init>|<init>(kotlin.ByteArray){}[0]
11+
constructor <init>(kotlin/ByteArray, kotlin/ByteArray?) // org.kotlincrypto.macs.kmac/KMAC128.<init>|<init>(kotlin.ByteArray;kotlin.ByteArray?){}[0]
12+
constructor <init>(kotlin/ByteArray, kotlin/ByteArray?, kotlin/Int) // org.kotlincrypto.macs.kmac/KMAC128.<init>|<init>(kotlin.ByteArray;kotlin.ByteArray?;kotlin.Int){}[0]
13+
14+
final object Companion : org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory<org.kotlincrypto.macs.kmac/KMAC128> { // org.kotlincrypto.macs.kmac/KMAC128.Companion|null[0]
15+
final const val MAC_LENGTH // org.kotlincrypto.macs.kmac/KMAC128.Companion.MAC_LENGTH|<get-MAC_LENGTH>(){}[0]
16+
final fun <get-MAC_LENGTH>(): kotlin/Int // org.kotlincrypto.macs.kmac/KMAC128.Companion.MAC_LENGTH.<get-MAC_LENGTH>|<get-MAC_LENGTH>(){}[0]
17+
18+
final fun xOf(kotlin/ByteArray, kotlin/ByteArray? =...): org.kotlincrypto.core.xof/Xof<org.kotlincrypto.macs.kmac/KMAC128> // org.kotlincrypto.macs.kmac/KMAC128.Companion.xOf|xOf(kotlin.ByteArray;kotlin.ByteArray?){}[0]
19+
}
20+
}
21+
22+
final class org.kotlincrypto.macs.kmac/KMAC256 : org.kotlincrypto.macs.kmac/Kmac { // org.kotlincrypto.macs.kmac/KMAC256|null[0]
23+
constructor <init>(kotlin/ByteArray) // org.kotlincrypto.macs.kmac/KMAC256.<init>|<init>(kotlin.ByteArray){}[0]
24+
constructor <init>(kotlin/ByteArray, kotlin/ByteArray?) // org.kotlincrypto.macs.kmac/KMAC256.<init>|<init>(kotlin.ByteArray;kotlin.ByteArray?){}[0]
25+
constructor <init>(kotlin/ByteArray, kotlin/ByteArray?, kotlin/Int) // org.kotlincrypto.macs.kmac/KMAC256.<init>|<init>(kotlin.ByteArray;kotlin.ByteArray?;kotlin.Int){}[0]
26+
27+
final object Companion : org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory<org.kotlincrypto.macs.kmac/KMAC256> { // org.kotlincrypto.macs.kmac/KMAC256.Companion|null[0]
28+
final const val MAC_LENGTH // org.kotlincrypto.macs.kmac/KMAC256.Companion.MAC_LENGTH|<get-MAC_LENGTH>(){}[0]
29+
final fun <get-MAC_LENGTH>(): kotlin/Int // org.kotlincrypto.macs.kmac/KMAC256.Companion.MAC_LENGTH.<get-MAC_LENGTH>|<get-MAC_LENGTH>(){}[0]
30+
31+
final fun xOf(kotlin/ByteArray, kotlin/ByteArray? =...): org.kotlincrypto.core.xof/Xof<org.kotlincrypto.macs.kmac/KMAC256> // org.kotlincrypto.macs.kmac/KMAC256.Companion.xOf|xOf(kotlin.ByteArray;kotlin.ByteArray?){}[0]
32+
}
33+
}
34+
35+
sealed class org.kotlincrypto.macs.kmac/Kmac : org.kotlincrypto.core.mac/Mac, org.kotlincrypto.core.xof/XofAlgorithm { // org.kotlincrypto.macs.kmac/Kmac|null[0]
36+
constructor <init>(kotlin/ByteArray, kotlin/ByteArray?, kotlin/Int, kotlin/Int, kotlin/Boolean) // org.kotlincrypto.macs.kmac/Kmac.<init>|<init>(kotlin.ByteArray;kotlin.ByteArray?;kotlin.Int;kotlin.Int;kotlin.Boolean){}[0]
37+
constructor <init>(org.kotlincrypto.core.mac/Mac.Engine) // org.kotlincrypto.macs.kmac/Kmac.<init>|<init>(org.kotlincrypto.core.mac.Mac.Engine){}[0]
38+
39+
sealed class <#A1: org.kotlincrypto.macs.kmac/Kmac> KMACXofFactory : org.kotlincrypto.core.xof/XofFactory<#A1> { // org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory|null[0]
40+
constructor <init>() // org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory.<init>|<init>(){}[0]
41+
42+
final inner class KMACXof : org.kotlincrypto.core.xof/XofFactory.XofDelegate<#A1> { // org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory.KMACXof|null[0]
43+
constructor <init>(#A1) // org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory.KMACXof.<init>|<init>(2:0){}[0]
44+
45+
final fun copy(): org.kotlincrypto.core.xof/Xof<#A1> // org.kotlincrypto.macs.kmac/Kmac.KMACXofFactory.KMACXof.copy|copy(){}[0]
46+
}
47+
}
48+
49+
final object Companion // org.kotlincrypto.macs.kmac/Kmac.Companion|null[0]
50+
}

test-android/api/test-android.klib.api

Whitespace-only changes.

0 commit comments

Comments
 (0)