Hi! I'm trying out the new built-in ABI Validation...
# library-development
r
Hi! I'm trying out the new built-in ABI Validation in Kotlin 2.4.10 and I'm not sure if I'm misunderstanding how
keepLocallyUnsupportedTargets
is supposed to work. My project has these native targets:
Copy code
kotlin {
    @OptIn(ExperimentalAbiValidation::class)
    abiValidation {
        keepLocallyUnsupportedTargets.set(true)
    }

    linuxX64()
    macosArm64()
    mingwX64()
}
I generate and update the ABI dump on an Apple Silicon Mac, so the reference dump contains:
Copy code
// Targets: [linuxX64, macosArm64, mingwX64]
However, when GitHub Actions runs on Ubuntu, I get: github.com/kingg22/kogot/…/90285638164
Copy code
w: ABI Validation: unsupported target
Target macosArm64 is not supported by the host compiler and a KLib ABI dump could not be directly generated for it.
and then
checkKotlinAbi
fails because the generated dump becomes:
Copy code
- // Targets: [linuxX64, macosArm64, mingwX64]
+ // Targets: [linuxX64, mingwX64]
So it looks like
macosArm64
is dropped from the dump header even though
keepLocallyUnsupportedTargets
is enabled or disabled. From the documentation I understood that this option should preserve unsupported targets by taking their declarations from the reference dump, so I expected
checkKotlinAbi
to succeed on Linux. Am I configuring this incorrectly, or is this current behavior expected? Is there a recommended way to run ABI validation in a multiplatform project without requiring a macOS runner for every CI build? Thanks!
👀 2
f
cc @Sergey Shanshin
s
Can't reproduce it locally with a simple project. If you disable the build cache and (or) the configuration cache, does the problem reproduce?
Also, I tried reproduce it locally on commit dec3006c it's also ok. At first, you can try to disable the build cache for the dump task by adding to the
kotlin-native/api/annotations/build.gradle.kts
code like this:
Copy code
tasks.configureEach {
    if (name == "internalDumpKotlinAbi") {
        outputs.upToDateWhen { false }
    }
}
r
Well, it only happens to me in GH actions, idk if the cache of GH is outdated and doesn't invalidate it, let me know if you are testing with windows or Linux cross system is the cause
s
I'm testing using Apple machine but with excluding target from the list of supported targets
kotlin.internal.abi.validation.klib.targets.disabled.for.testing=macosArm64
- it gives the same result as unsupport by the compiler
r
I currently don't have access to a windows or Linux machine, but I'm going to test it later. Maybe it's the GH cache 🫠
Also, I tried reproduce it locally on commit dec3006c it's also ok.
At first, you can try to disable the build cache for the dump task by adding to the
kotlin-native/api/annotations/build.gradle.kts
code like this:
Hiii, I just tested it on Linux Mint and it fails on the same commit, whether I enable or disable keepLocally option, and always with the same error.
Copy code
ABI check failed for project annotations

<<<ABI has changed>>>
--- /home/kingg22/IdeaProjects/kogot/kotlin-native/api/annotations/api/annotations.klib.api
+++ /home/kingg22/IdeaProjects/kogot/kotlin-native/api/annotations/build/kotlin/abi/annotations.klib.api
@@ -1,5 +1,5 @@
 // Klib ABI Dump
-// Targets: [linuxX64, macosArm64, mingwX64]
+// Targets: [linuxX64, mingwX64]
 // Rendering settings:
 // - Signature version: 2
 // - Show manifest properties: true

You can run ':kotlin-native:api:annotations:updateKotlinAbi' task to create or overwrite reference ABI declarations
Could you try it on a non-Mac computer or in a GH Actions instance? And if you can use the same repository, that would be better, in case it's a configuration error on my part, a conflict with another function, or something experimental. Thank u
s
Did you tested with enabled build cache?
r
Yup, my same config, but in that PC the project was a fresh clone
f
I can confirm, the issue is reproducible on Linux host.
kodee loving 1