-
Notifications
You must be signed in to change notification settings - Fork 20
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
_deploy.jar does not include transitive kotlin classes via kotlin classes #52
Comments
@trevorsummerssmith The documented I would recommend using the pcj should be able to help you debug your issue. |
@hsyed thank you for your reply! I tried what I understand your suggestion to be: use the java_binary rule instead of kotlin_binary on the example I gave above. I pushed the code here - trevorsummerssmith@1cf1353 Unfortunately that does not work for me either: > bazel build --nouse_ijars examples/helloworld:main_kt_java_deploy.jar
# ...
> java -jar bazel-bin/examples/helloworld/main_kt_java_deploy.jar
Exception in thread "main" java.lang.NoClassDefFoundError: examples/helloworld/KotlinBinaryRule
at examples.helloworld.MainKt.main(main.kt:11)
Caused by: java.lang.ClassNotFoundException: examples.helloworld.KotlinBinaryRule
at java.base/jdk.internal.loader.BuiltinClassLoader.loadClass(BuiltinClassLoader.java:582)
at java.base/jdk.internal.loader.ClassLoaders$AppClassLoader.loadClass(ClassLoaders.java:185)
at java.base/java.lang.ClassLoader.loadClass(ClassLoader.java:496)
... 1 more We don't get the KotlinBinaryRule class because it is a transitive dependency via our kotlin library rule now. This does show another variant of this bug that I did not previously test. I did more reading on the macro vs rule distinction and what you say makes sense to my rudimentary understanding of bazel. Is this something you are actively working on? / Do you need any help? |
@hsyed Happy new year! I am curious if you are currently working on the port of macros -> rules? Thank you. |
@trevorsummerssmith yes I have completely forked the rules alongside porting the new bazel intelij plugin extension I have been working on (these haven't been merged in yet). The fork is available here. It's a barebones rework and the documentation is minimal. We have enabled it in our mono repo and it work well enough. Happy to get feedback ! |
@hsyed ok good to know. I will take a look at what you have going on this week. |
Issue: When using the
kotlin_binary
rule to create an uberjar, one expects that direct and transitive dependencies are included. It appears that direct kotlin classes are included, but transitive kotlin classes that are transitive via a kotlin class are not. However, kotlin transitive dependencies that are transitive via a java class are included.Disclaimer: I am new to both bazel and kotlin so likely this is user error.
Reproduce: Using a modification of
rules_kotlin
examples see trevorsummerssmith@2b9cb1bWe have a new Foo kotlin class. Rules (kotlin class) is modified to depend upon Foo. Main should now transitively depend upon foo.
I am happy to do some more digging here if someone can point me in the right direction.
Hypothesis (this could be totally wrong): I saw #47 and locally changed my rules.bzl to use
transitive_compile_time_jars
instead offull_compile_jars
and then built the examples with--nouse_ijars
, thinking that this would give the full transitive dependencies. However I saw no change in behavior.The text was updated successfully, but these errors were encountered: