Open SanjayVas opened 11 months ago
Where are the native libraries coming from in the example?
Sorry, I guess I forgot to include that part in the workaround example. The native dep would be a shared library (cc_binary target with linkshared = True) specified in the deps
of the library target.
This is also true for kt_jvm_binary
. You can not add cc_library
dep via tuntime_deps
. Both kt_jvm_binary
and kt_jvm_test
fail with this error.
Error in check_provider_instances: at index 0 of runtime_deps, got element of type NoneType, want JavaInfo
For kt_jvm_binary
you can work around this by using java_binary
, and adding Kt
to the end of the class name.
But there isn't a work around for kt_jvm_test
. AFAICT there is no way to write a test that requires a .so
from the project.
@TwoClocks The workaround I mentioned above (using java_test
) does work for running tests written in Kotlin transitively depending on a native library. In my project, we've made a reference to this issue every time we've used that workaround.
@SanjayVas Works great. Thanks!
java_test
collects the paths to native libraries fromJavaInfo.transitive_native_libraries
and specifies them in thejava.library.path
property.kt_jvm_test
does not do this.The current workaround if loading native libraries is to use a combination of
java_test
andkt_jvm_library
instead. e.g.