Skip to content

Commit 87ac624

Browse files
committed
hacky workaround for using scala-2.10
1 parent b51e54c commit 87ac624

File tree

2 files changed

+58
-5
lines changed

2 files changed

+58
-5
lines changed

WORKSPACE

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
workspace(name = "io_bazel_rules_scala")
22

3-
load("//scala:scala.bzl", "scala_repositories", "scala_mvn_artifact")
3+
load("//scala:scala.bzl", "scala_repositories", "scala_210_repositories", "scala_mvn_artifact")
44
scala_repositories()
5+
scala_210_repositories()
56

67
load("//twitter_scrooge:twitter_scrooge.bzl", "twitter_scrooge", "scrooge_scala_library")
78
twitter_scrooge()

scala/scala.bzl

Lines changed: 56 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -598,9 +598,12 @@ def _scala_junit_test_impl(ctx):
598598
_implicit_deps = {
599599
"_ijar": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:ijar"), allow_files=True),
600600
"_scalac": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/scalac"), allow_files=True),
601-
"_scalalib": attr.label(default=Label("@scala//:lib/scala-library.jar"), single_file=True, allow_files=True),
602-
"_scalacompiler": attr.label(default=Label("@scala//:lib/scala-compiler.jar"), single_file=True, allow_files=True),
603-
"_scalareflect": attr.label(default=Label("@scala//:lib/scala-reflect.jar"), single_file=True, allow_files=True),
601+
#"_scalalib": attr.label(default=Label("@scala//:lib/scala-library.jar"), single_file=True, allow_files=True),
602+
#"_scalacompiler": attr.label(default=Label("@scala//:lib/scala-compiler.jar"), single_file=True, allow_files=True),
603+
#"_scalareflect": attr.label(default=Label("@scala//:lib/scala-reflect.jar"), single_file=True, allow_files=True),
604+
"_scalalib": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala210/scala_library"), single_file=True, allow_files=True),
605+
"_scalacompiler": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala210/scala_compiler"), single_file=True, allow_files=True),
606+
"_scalareflect": attr.label(default=Label("//external:io_bazel_rules_scala/dependency/scala210/scala_reflect"), single_file=True, allow_files=True),
604607
"_java": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:java"), allow_files=True),
605608
"_javac": attr.label(executable=True, cfg="host", default=Label("@bazel_tools//tools/jdk:javac"), allow_files=True),
606609
"_jar": attr.label(executable=True, cfg="host", default=Label("//src/java/io/bazel/rulesscala/jar:binary_deploy.jar"), allow_files=True),
@@ -747,6 +750,54 @@ filegroup(
747750
)
748751
"""
749752

753+
SCALA_BUILD_FILE_210 = """
754+
# scala.BUILD
755+
exports_files([
756+
"bin/scala",
757+
"bin/scalac",
758+
"bin/scaladoc",
759+
"lib/jline.jar",
760+
"lib/scala-actors.jar",
761+
"lib/scala-actors-migration.jar",
762+
"lib/scala-compiler.jar",
763+
"lib/scala-library.jar",
764+
"lib/scala-reflect.jar",
765+
"lib/scala-swing.jar",
766+
])
767+
768+
filegroup(
769+
name = "scala-library",
770+
srcs = ["lib/scala-library.jar"],
771+
visibility = ["//visibility:public"],
772+
)
773+
774+
filegroup(
775+
name = "scala-reflect",
776+
srcs = ["lib/scala-reflect.jar"],
777+
visibility = ["//visibility:public"],
778+
)
779+
780+
filegroup(
781+
name = "scala-compiler",
782+
srcs = ["lib/scala-compiler.jar"],
783+
visibility = ["//visibility:public"],
784+
)
785+
"""
786+
787+
def scala_210_repositories():
788+
native.new_http_archive(
789+
name = "scala210",
790+
strip_prefix = "scala-2.10.4",
791+
url = "http://localhost:8000/scala-2.10.4.tgz",
792+
build_file_content = SCALA_BUILD_FILE_210,
793+
)
794+
795+
native.bind(name = 'io_bazel_rules_scala/dependency/scala210/scala_library', actual = '@scala210//:scala-library')
796+
797+
native.bind(name = 'io_bazel_rules_scala/dependency/scala210/scala_reflect', actual = '@scala210//:scala-reflect')
798+
799+
native.bind(name = 'io_bazel_rules_scala/dependency/scala210/scala_compiler', actual = '@scala210//:scala-compiler')
800+
750801
def scala_repositories():
751802
native.new_http_archive(
752803
name = "scala",
@@ -797,7 +848,8 @@ def scala_export_to_java(name, exports, runtime_deps):
797848
name = name,
798849
# these are the outputs of the scala_library targets
799850
jars = jars,
800-
runtime_deps = ["@scala//:lib/scala-library.jar"] + runtime_deps
851+
#runtime_deps = ["@scala//:lib/scala-library.jar"] + runtime_deps
852+
runtime_deps = ["//external:io_bazel_rules_scala/dependency/scala210/scala_library"] + runtime_deps
801853
)
802854

803855
def _sanitize_string_for_usage(s):

0 commit comments

Comments
 (0)