aboutsummaryrefslogtreecommitdiffhomepage
path: root/tools/build_defs/scala/README.md
diff options
context:
space:
mode:
authorGravatar oscar <oscar.boykin@gmail.com>2015-12-08 20:45:08 +0000
committerGravatar David Chen <dzc@google.com>2015-12-08 22:26:54 +0000
commit0a2fa03494a24b7153ed8856fee7e21719f78b83 (patch)
treeb28755746b4673525b6e20e65f6db9882e914b6f /tools/build_defs/scala/README.md
parent8ca78e61630f525d1f97c711952208efd14606f8 (diff)
Improve scalac: use ijar and download scalac
-- Change-Id: I22fb6cc5a37f5c6c216dc3abbc915d1be3fd5e6b Reviewed-on: https://bazel-review.googlesource.com/#/c/2410/ MOS_MIGRATED_REVID=109717610
Diffstat (limited to 'tools/build_defs/scala/README.md')
-rw-r--r--tools/build_defs/scala/README.md36
1 files changed, 27 insertions, 9 deletions
diff --git a/tools/build_defs/scala/README.md b/tools/build_defs/scala/README.md
index b72433939f..49b210bef7 100644
--- a/tools/build_defs/scala/README.md
+++ b/tools/build_defs/scala/README.md
@@ -3,7 +3,7 @@
<div class="toc">
<h2>Rules</h2>
<ul>
- <li><a href="#scala_library">scala_library</a></li>
+ <li><a href="#scala_library">scala_library/scala_macro_library</a></li>
<li><a href="#scala_binary">scala_binary</a></li>
</ul>
</div>
@@ -11,23 +11,41 @@
## Overview
This rule is used for building [Scala][scala] projects with Bazel. There are
-currently two rules, `scala_library` and `scala_binary`. More features will be
-added in the future, e.g. `scala_test`.
+currently three rules, `scala_library`, `scala_macro_library` and
+`scala_binary`. More features will be added in the future, e.g. `scala_test`.
+
+In order to use this build rule, you must add the following to your WORKSPACE
+file:
+```
+new_http_archive(
+ name = "scala",
+ strip_prefix = "scala-2.11.7",
+ sha256 = "ffe4196f13ee98a66cf54baffb0940d29432b2bd820bd0781a8316eec22926d0",
+ url = "http://downloads.typesafe.com/scala/2.11.7/scala-2.11.7.tgz",
+ build_file = "tools/build_defs/scala/scala.BUILD",
+)
+```
[scala]: http://www.scala-lang.org/
<a name="scala_library"></a>
-## scala_library
+## scala_library / scala_macro_library
```python
scala_library(name, srcs, deps, data, main_class, resources, scalacopts, jvm_flags)
+scala_macro_library(name, srcs, deps, data, main_class, resources, scalacopts, jvm_flags)
```
-`scala_library` generates a `.jar` file from `.scala` source files.
-In order to make a java rule use this jar file, use the `java_import` rule.
+`scala_library` generates a `.jar` file from `.scala` source files. This rule
+also creates an interface jar to avoid recompiling downstream targets unless
+then interface changes.
+
+`scala_macro_library` generates a `.jar` file from `.scala` source files when
+they contain macros. For macros, there are no interface jars because the macro
+code is executed at compile time. For best performance, you want very granular
+targets until such time as the zinc incremental compiler can be supported.
-The current implementation assumes that the files `/usr/bin/scalac` and
-`/usr/share/java/scala-library.jar` exist.
+In order to make a java rule use this jar file, use the `java_import` rule.
<table class="table table-condensed table-bordered table-params">
<colgroup>
@@ -124,7 +142,7 @@ The current implementation assumes that the files `/usr/bin/scalac` and
scala_binary(name, srcs, deps, data, main_class, resources, scalacopts, jvm_flags)
```
-`scala_binary` generates a Scala executable. It may depend on `scala_library`
+`scala_binary` generates a Scala executable. It may depend on `scala_library`, `scala_macro_library`
and `java_library` rules.
A `scala_binary` requires a `main_class` attribute.