support scala jars better
johnynek opened this issue · comments
see the code here:
these rules aren't currently touching scala signatures (and I don't know if kotlin has something similar).
cc @eed3si9n
Hi @johnynek I'm trying to use the rule for shading java and scala dependencies to build a fat scala jar.
I first use java_binary
to get the implicit <name>_deploy.jar
as a fat jar, then use bazel_jar_jar to shade dependencies.
For a simple rule like this:
inline_rules = [
"rule com.typesafe.** shaded.@0",
"zap scala.**",
"zap java.**",
],
once imported it's still asking for the unshaded version of the library.
error: Symbol 'type com.typesafe.scalalogging.LazyLogging' is missing from the classpath.
This symbol is required by 'class MyClass'.
Make sure that type LazyLogging is in your classpath and check for conflicting dependencies with `-Ylog-classpath`.
A full rebuild may help if 'MyClass.class' was compiled against an incompatible version of com.typesafe.scalalogging.
I tried this with another Java library, similar error.
Once I decompiled the bytecode into Java file, it's showing me correctly that the dependency was shaded inside MyClass.
Wonder if this has anything to do with the scala signature and reflection?
Thanks.