Fix deployable JARs created by Scala rules. #61
Merged
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
"Deployable" Jars, as created by the java_binary rule, are Jars with all runtime dependencies included. These are usable as standalone Jars that can be deployed onto servers and such. The reason why we need these for Scala binaries and libraries is as a bandaid fix for Java/Scala interop in Bazel. The Java ecosystem of rules is closed: AFAICT, only known-good rules (cc_library, java_library, java_import, ...) can be used as dependencies of java libraries and binaries. To work around this, the scala_export_to_java macro injects scala into the java ecosystem via "precompiled" jars in the java_imports rule. However, this rule does not pick up transitive runtime dependencies of the imported Jars, so when using these Jars in java_tests, the tests fail because they do not have access to the runtime dependencies of the imported Scala Jar. To make these imports work, the imported Jar must therefore be one that includes the full runtime dependencies in the Jar itself, which is what correctly-built "deploy" Jars provide.