Skip to content

Commit 8acecfe

Browse files
author
Stephen Twigg
committed
Using JavaProvider, requires Bazel 0.5.2
Remove scala_exports_to_java Prefer using JavaProvider over scala provider (can probably avoid using scala provider completely?)
1 parent e6a29ee commit 8acecfe

File tree

2 files changed

+7
-24
lines changed

2 files changed

+7
-24
lines changed

scala/scala.bzl

Lines changed: 7 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -358,14 +358,13 @@ def _collect_jars(targets):
358358
compile_jars = depset()
359359
runtime_jars = depset()
360360
for target in targets:
361-
if hasattr(target, "scala"):
362-
compile_jars += target.scala.compile_jars
363-
runtime_jars += target.scala.transitive_runtime_jars
364-
elif java_common.provider in target:
361+
if java_common.provider in target:
365362
java_provider = target[java_common.provider]
366-
# TODO(twigg): Use compile_jars when released (narrowly missed 0.5.0 :( )
367-
compile_jars += target.java.transitive_deps # java_provider.compile_jars
363+
compile_jars += java_provider.compile_jars
368364
runtime_jars += java_provider.transitive_runtime_jars
365+
elif hasattr(target, "scala"):
366+
compile_jars += target.scala.compile_jars
367+
runtime_jars += target.scala.transitive_runtime_jars
369368
else:
370369
# support http_file pointed at a jar. http_jar uses ijar,
371370
# which breaks scala macros
@@ -432,10 +431,9 @@ def _lib(ctx, non_macro_lib):
432431
compile_jars = next_cjars,
433432
transitive_runtime_jars = transitive_rjars,
434433
)
435-
# TODO(twigg): Linearization is concerning here.
436434
java_provider = java_common.create_provider(
437-
compile_time_jars = scalaattr.compile_jars.to_list(),
438-
runtime_jars = scalaattr.transitive_runtime_jars.to_list(),
435+
compile_time_jars = scalaattr.compile_jars,
436+
runtime_jars = scalaattr.transitive_runtime_jars,
439437
)
440438

441439
return struct(
@@ -803,20 +801,6 @@ def scala_repositories():
803801

804802
native.bind(name = "io_bazel_rules_scala/dependency/scalatest/scalatest", actual = "@scalatest//jar")
805803

806-
# With providers changes, this is completely deprecatable once bazel release includes
807-
# fixes to java rules using JavaProvider
808-
def scala_export_to_java(name, exports, runtime_deps):
809-
jars = []
810-
for target in exports:
811-
jars.append("{}_deploy.jar".format(target))
812-
813-
native.java_import(
814-
name = name,
815-
# these are the outputs of the scala_library targets
816-
jars = jars,
817-
runtime_deps = ["//external:io_bazel_rules_scala/dependency/scala/scala_library"] + runtime_deps
818-
)
819-
820804
def _sanitize_string_for_usage(s):
821805
res_array = []
822806
for c in s:

test/BUILD

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@ load("//scala:scala.bzl",
55
"scala_library",
66
"scala_test",
77
"scala_macro_library",
8-
"scala_export_to_java",
98
"scala_repl",
109
"scala_test_suite",
1110
"scala_library_suite",

0 commit comments

Comments
 (0)