From 329543d78d2071ef8a54986f4cd2116e64c6c087 Mon Sep 17 00:00:00 2001 From: Ittai Zeidman Date: Mon, 16 Jul 2018 17:45:16 +0300 Subject: [PATCH] add scala stdlib to java compile classpath, relates to #526 (#558) * add scala stdlib to java compile classpath, relates to #526 * linting --- scala/private/rule_impls.bzl | 1 + test/BUILD | 5 +++++ test/JavaUsesScalaStdLib.java | 8 ++++++++ 3 files changed, 14 insertions(+) create mode 100644 test/JavaUsesScalaStdLib.java diff --git a/scala/private/rule_impls.bzl b/scala/private/rule_impls.bzl index b512e43ec..fb859d13a 100644 --- a/scala/private/rule_impls.bzl +++ b/scala/private/rule_impls.bzl @@ -263,6 +263,7 @@ def try_to_compile_java_jar(ctx, scala_output, all_srcjars, java_srcs, providers_of_dependencies = collect_java_providers_of(ctx.attr.deps) providers_of_dependencies += collect_java_providers_of( implicit_junit_deps_needed_for_java_compilation) + providers_of_dependencies += collect_java_providers_of([ctx.attr._scalalib]) scala_sources_java_provider = _interim_java_provider_for_java_compilation( scala_output) providers_of_dependencies += [scala_sources_java_provider] diff --git a/test/BUILD b/test/BUILD index c2427511a..d4ba533dd 100644 --- a/test/BUILD +++ b/test/BUILD @@ -531,6 +531,11 @@ scalapb_proto_library( ], ) +scala_library( + name = "java_uses_scala_std_lib", + srcs = ["JavaUsesScalaStdLib.java"], +) + load(":check_statsfile.bzl", "check_statsfile") check_statsfile("ScalaBinary") diff --git a/test/JavaUsesScalaStdLib.java b/test/JavaUsesScalaStdLib.java new file mode 100644 index 000000000..1b681adc6 --- /dev/null +++ b/test/JavaUsesScalaStdLib.java @@ -0,0 +1,8 @@ +package scalarules.test; + +public class JavaUsesScalaStdLib { + + public static scala.collection.immutable.Map scalaMap(java.util.Map javaMap) { + return null; + } +}