Jurriaan Mous
04/06/2022, 7:44 PMdarwinMain
shared sourceSet and platform specific cinterop implementations. It all works well to run macosArm64Test
tasks and succeeds with all building and tests. But as soon I want to publish my library it wants to run compileDarwinMainKotlinMetadata
it fails with the following exception failing to find cinterop based code which is only present in specific implementations:
> Task :compileDarwinMainKotlinMetadata FAILED
e: /Users/jurmous/space/rocksdb-multiplatform/src/appleMain/kotlin/maryk/rocksdb/AbstractComparator.kt: (5, 8): Unresolved reference: rocksdb
The build.gradle.kts setup I use:
https://github.com/marykdb/rocksdb-multiplatform/blob/master/build.gradle.kts
Project can be checked out and build but macOS is needed.
What am I missing so publishing completes successfully? And is publishing the metadata of that shared darwinMain sourceSet needed?mkrussel
04/06/2022, 7:49 PMmaven-publish
plugin. https://youtrack.jetbrains.com/issue/KT-42387
My workaround was to add a project level property that can be set on the command line to say that I'm going to publish.
When the flag is set, I avoid any shared source sets and instead create each of the target platforms and add kotlin directory to their source sets for the common code. I also have to add all dependencies and configuration settings to each of the individual targets.
I went with the flag, because without it Android Studio says there are multiple source roots for the directory and picks one of them to use. This causes a lot of false errors and warnings.mkrussel
04/06/2022, 7:50 PMAnton Lakotka [JB]
04/07/2022, 7:24 AMJurriaan Mous
05/26/2022, 10:14 AM