Kotlin / kotlinx-benchmark

Kotlin multiplatform benchmarking toolkit
Apache License 2.0
499 stars 40 forks source link

K/N: can't define cinterop in a benchmark module #190

Open fzhinkin opened 7 months ago

fzhinkin commented 7 months ago

Benchmark compilation fails when a module has cinterop configuration for a native target.

Here's an example project: https://github.com/fzhinkin/kotlinx-benchmark-cinterop-issue/blob/main/build.gradle.kts

Compilation fails with:

> Task :compileMacosArm64BenchmarkKotlinMacosArm64 FAILED
e: Could not find "org.example:kotlinx-benchmark-cinterop-issue-cinterop-nativeCalls" in [/XXX/Development/kotlinx-benchmark-cinterop-issue, /XXX/.konan/klib, /XXX/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/common, /XXX/.konan/kotlin-native-prebuilt-macos-aarch64-1.9.22/klib/platform/macos_arm64]

Sometimes, a good reference for benchmarking is some native library, so it would be nice to support cinterop for benchmark modules (or at least, explicitly warn that it's unsupported).

The workaround is to declare a separate module with cinterop and depend on it.