I would like to export my dependency to the shared...
# kotlin-native
r
I would like to export my dependency to the shared lib, so I can use it in C. It is about the bignum lib. Any clue why it is not included in the output? <https://gist.github.com/RdeWilde/5fb125cd3b69d49ea483e8a824f32708> Line 66 should've done the trick, but I don't think it is executed, or at least not included in the output header file. I used this as a reference: <https://github.com/JetBrains/kotlin-native/issues/3571>
@ilya.matveev I guess it makes sense to tag you, as you are assigned to th referenced issue
i
Hi! Could you run the build with
-i
flag and provide the log here?
r
How do I do that? My IDE(A) compiles automatically when I press the hammer icon. Do I have to specify it in the gradle file?
Or cli
gradle build -i
?
i
Yes, I meant the CLI build.
r
I don't see the `
Copy code
-Xexport-library
anywhere. I think I should. So it probably isn't getting there anyway in the build file 😞
a
Hi @Robert! I also cannot see any results of the 65th line, with the
print(...
.
r
Me neither. I don't know how to debug a build file, but I guess my structure is wrong. Or the
exportDeps
or
exportDeps.resolve()
empty
i
I see. It's a known issue related to Gradle's variant-aware dependency resolution.
com.ionspin.kotlin:bignum
is a root artifact containing variants for all platforms. The problem is that all these variats are transitive dependencies of the root artifact from the Gradle's point of view. While the snippet I've published in the GitHub issue explicitly makes the
exportDeps
configuration non-transitive. So you you have two options: 1. Make this configuration transitive. It causes exporting all other transitive dependencies of
com.ionspin.kotlin:bignum
. But you can exclude some of them in the dependency resolution (see Gradle's doc for more info: <https://docs.gradle.org/current/userguide/resolution_rules.html>) 2. Explicitly specify a platform bignum variant (
com.ionspin.kotlin:bignum-linux
) instead of the root artifact.
r
Oh damn it seems to pick it up know. That is so awesome, thank you both. I have to work for a bit in the office, will continue to look at this tonight! The library includes the bignum defs now 👍 😎