diff --git a/scala/unstable/BUILD b/scala/unstable/BUILD new file mode 100644 index 000000000..e69de29bb diff --git a/scala/unstable/defs.bzl b/scala/unstable/defs.bzl new file mode 100644 index 000000000..b228e7d32 --- /dev/null +++ b/scala/unstable/defs.bzl @@ -0,0 +1,40 @@ +""" +Starlark rules for building Scala projects. + +These are the core rules under active development. Their APIs are +not guaranteed stable and we anticipate some breaking changes. + +We do not recommend using these APIs for production codebases. Instead, +use the stable rules exported by scala.bzl: + +``` +load( + "@io_bazel_rules_scala//scala:scala.bzl", + "scala_library", + "scala_binary", + "scala_test" +) +``` + +""" + +load( + "@io_bazel_rules_scala//scala/private:rules/scala_binary.bzl", + _make_scala_binary = "make_scala_binary", +) +load( + "@io_bazel_rules_scala//scala/private:rules/scala_library.bzl", + _make_scala_library = "make_scala_library", +) +load( + "@io_bazel_rules_scala//scala/private:rules/scala_test.bzl", + _make_scala_test = "make_scala_test", +) + +make_scala_library = _make_scala_library +make_scala_binary = _make_scala_binary +make_scala_test = _make_scala_test + +scala_library = _make_scala_library() +scala_binary = _make_scala_binary() +scala_test = _make_scala_test() diff --git a/test/unstable/BUILD b/test/unstable/BUILD new file mode 100644 index 000000000..621ee2e25 --- /dev/null +++ b/test/unstable/BUILD @@ -0,0 +1,27 @@ +load( + "//scala/unstable:defs.bzl", + "scala_binary", + "scala_library", + "scala_test", +) + +scala_binary( + name = "binary", + srcs = ["binary.scala"], + main_class = "test.v2.Binary", + deps = [":library"], +) + +scala_library( + name = "library", + srcs = ["library.scala"], + deps = [], +) + +scala_test( + name = "test", + srcs = ["test.scala"], + deps = [ + ":library", + ], +) diff --git a/test/unstable/binary.scala b/test/unstable/binary.scala new file mode 100644 index 000000000..56486bffa --- /dev/null +++ b/test/unstable/binary.scala @@ -0,0 +1,7 @@ +package test.v2 + +object Binary { + def main(args: Array[String]): Unit = { + println(s"${Library.method1} ${Library.method2}") + } +} diff --git a/test/unstable/library.scala b/test/unstable/library.scala new file mode 100644 index 000000000..8048a67ca --- /dev/null +++ b/test/unstable/library.scala @@ -0,0 +1,6 @@ +package test.v2 + +object Library { + def method1(): String = "hello" + def method2(): String = "world" +} diff --git a/test/unstable/test.scala b/test/unstable/test.scala new file mode 100644 index 000000000..88985c7fb --- /dev/null +++ b/test/unstable/test.scala @@ -0,0 +1,13 @@ +package test.v2 + +import org.scalatest.FunSuite + +class Test extends FunSuite { + test("method1") { + assert(Library.method1 == "hello") + } + + test("method2") { + assert(Library.method2 == "world") + } +}