rules_kotlin icon indicating copy to clipboard operation
rules_kotlin copied to clipboard

kt_jvm_binary does not support non-java runtime_deps

Open TwoClocks opened this issue 1 year ago • 3 comments

If you add a non-java runtime dependency to kt_jvm_binary, it fails with the below error.

In this case, I'm adding a C++ binary build in the same project.

Workaround:

replace kt_jvm_binary with java_binary and it works without any other changes.

line 656, column 25, in kt_jvm_produce_jar_actions
		java_info = JavaInfo(
	File "/virtual_builtins_bzl/common/java/java_info.bzl", line 752, column 35, in JavaInfo
	File "/virtual_builtins_bzl/common/java/java_info.bzl", line 690, column 52, in _javainfo_init
	File "/virtual_builtins_bzl/common/java/java_info.bzl", line 526, column 28, in _javainfo_init_base
	File "/virtual_builtins_bzl/common/java/java_info.bzl", line 482, column 51, in _validate_provider_list
Error in check_provider_instances: at index 1 of runtime_deps, got element of type NoneType, want JavaInfo

TwoClocks avatar Dec 14 '24 02:12 TwoClocks

@TwoClocks If you are able to provide a sample of some sort to reproduce this, that would be super helpful! The examples directory has some scaffolding projects that you can use to make things easier, and we can potentially even just check the case in.

Bencodes avatar Dec 14 '24 19:12 Bencodes

Bit of a known issue. Haven't gotten the time to hook up the kotlin rules to JNI, as there are some truly fun usecases.

That said, we accept patches and could benefit from a an repro example.

restingbull avatar Dec 19 '24 05:12 restingbull

Here is a repro

https://github.com/TwoClocks/rules_kotlin_native_bug

But honestly, just add anything that isn't a jar to runtime_deps in a kt_jvm_binary

TwoClocks avatar May 03 '25 22:05 TwoClocks