Skip to content

Latest commit

 

History

History
951 lines (850 loc) · 27.3 KB

scala.md

File metadata and controls

951 lines (850 loc) · 27.3 KB

configure_bootstrap_scala

configure_bootstrap_scala(name, compiler_classpath, global_plugins, global_scalacopts, runtime_classpath, version)

Attributes

name Name; required

A unique name for this target.

compiler_classpath List of labels; required
global_plugins List of labels; optional

Scalac plugins that will always be enabled.

global_scalacopts List of strings; optional

Scalac options that will always be enabled.

runtime_classpath List of labels; required
version String; required

scala_binary

scala_binary(name, data, deps, deps_unused_whitelist, deps_used_whitelist, javacopts, jvm_flags, main_class, plugins, resource_jars, resource_strip_prefix, resources, runtime_deps, scala, scalacopts, srcs)

Compiles and links a Scala JVM executable.

Produces the following implicit outputs:

  • <name>_deploy.jar: a single jar that contains all the necessary information to run the program
  • <name>.jar: a jar file that contains the class files produced from the sources
  • <name>-bin: the script that's used to run the program in conjunction with the generated runfiles

To run the program: bazel run <target>

Attributes

name Name; required

A unique name for this target.

data List of labels; optional

The additional runtime files needed by this library.

deps List of labels; optional

The JVM library dependencies.

deps_unused_whitelist List of labels; optional

The JVM library dependencies to always consider unused for `scala_deps_direct` checks.

deps_used_whitelist List of labels; optional

The JVM library dependencies to always consider used for `scala_deps_used` checks.

javacopts List of strings; optional

The Javac options.

jvm_flags List of strings; optional

The JVM runtime flags.

main_class String; optional

The main class. If not provided, it will be inferred by its type signature.

plugins List of labels; optional

The Scalac plugins.

resource_jars List of labels; optional

The JARs to merge into the output JAR.

resource_strip_prefix String; optional

The path prefix to strip from classpath resources.

resources List of labels; optional

The files to include as classpath resources.

runtime_deps List of labels; optional

The JVM runtime-only library dependencies.

scala Label; optional

The `ScalaConfiguration`. Among other things, this specifies which scala version to use. Defaults to the default_scala target specified in the WORKSPACE file.

scalacopts List of strings; optional

The Scalac options.

srcs List of labels; optional

The source Scala and Java files (and `.srcjar` files of those).

scala_import

scala_import(name, deps, exports, jars, neverlink, runtime_deps, srcjar)

Creates a Scala JVM library.

Use this only for libraries with macros. Otherwise, use java_import.

Attributes

name Name; required

A unique name for this target.

deps List of labels; optional
exports List of labels; optional
jars List of labels; optional
runtime_deps List of labels; optional
srcjar Label; optional

scala_library

scala_library(name, data, deps, deps_unused_whitelist, deps_used_whitelist, exports, javacopts, macro, neverlink, plugins, resource_jars, resource_strip_prefix, resources, runtime_deps, scala, scalacopts, srcs)

Compiles a Scala JVM library.

Attributes

name Name; required

A unique name for this target.

data List of labels; optional

The additional runtime files needed by this library.

deps List of labels; optional

The JVM library dependencies.

deps_unused_whitelist List of labels; optional

The JVM library dependencies to always consider unused for `scala_deps_direct` checks.

deps_used_whitelist List of labels; optional

The JVM library dependencies to always consider used for `scala_deps_used` checks.

exports List of labels; optional

The JVM libraries to add as dependencies to any libraries dependent on this one.

javacopts List of strings; optional

The Javac options.

macro Boolean; optional

Whether this library provides macros.

plugins List of labels; optional

The Scalac plugins.

resource_jars List of labels; optional

The JARs to merge into the output JAR.

resource_strip_prefix String; optional

The path prefix to strip from classpath resources.

resources List of labels; optional

The files to include as classpath resources.

runtime_deps List of labels; optional

The JVM runtime-only library dependencies.

scala Label; optional

The `ScalaConfiguration`. Among other things, this specifies which scala version to use. Defaults to the default_scala target specified in the WORKSPACE file.

scalacopts List of strings; optional

The Scalac options.

srcs List of labels; optional

The source Scala and Java files (and `.srcjar` files of those).

scala_repl

scala_repl(name, data, deps, jvm_flags, scala, scalacopts)

Launches a REPL with all given dependencies available.

To run: bazel run <target>

Attributes

name Name; required

A unique name for this target.

data List of labels; optional

The additional runtime files needed by this REPL.

deps List of labels; optional
jvm_flags List of strings; optional

The JVM runtime flags.

scala Label; optional

The `ScalaConfiguration`.

scalacopts List of strings; optional

The Scalac options.

scala_test

scala_test(name, data, deps, deps_unused_whitelist, deps_used_whitelist, frameworks, isolation, javacopts, jvm_flags, plugins, resource_jars, resource_strip_prefix, resources, runner, runtime_deps, scala, scalacopts, shared_deps, srcs, subprocess_runner)

Compiles and links a collection of Scala tests.

To buid and run all tests: bazel test <target>

To build and run a specific test: bazel test <target> --test_filter=<filter_expression>
(Note: the syntax of the <filter_expression> varies by test framework, and not all test frameworks support the test_filter option at this time.)

More Info

Attributes

name Name; required

A unique name for this target.

data List of labels; optional

The additional runtime files needed by this library.

deps List of labels; optional

The JVM library dependencies.

deps_unused_whitelist List of labels; optional

The JVM library dependencies to always consider unused for `scala_deps_direct` checks.

deps_used_whitelist List of labels; optional

The JVM library dependencies to always consider used for `scala_deps_used` checks.

frameworks List of strings; optional
isolation String; optional

The isolation level to apply

javacopts List of strings; optional

The Javac options.

jvm_flags List of strings; optional

The JVM runtime flags.

plugins List of labels; optional

The Scalac plugins.

resource_jars List of labels; optional

The JARs to merge into the output JAR.

resource_strip_prefix String; optional

The path prefix to strip from classpath resources.

resources List of labels; optional

The files to include as classpath resources.

runner Label; optional
runtime_deps List of labels; optional

The JVM runtime-only library dependencies.

scala Label; optional

The `ScalaConfiguration`. Among other things, this specifies which scala version to use. Defaults to the default_scala target specified in the WORKSPACE file.

scalacopts List of strings; optional
shared_deps List of labels; optional

If isolation is "classloader", the list of deps to keep loaded between tests

srcs List of labels; optional

The source Scala and Java files (and `.srcjar` files of those).

subprocess_runner Label; optional

scaladoc

scaladoc(name, compiler_deps, deps, scala, scalacopts, srcs, title)

Generates Scaladocs.

Attributes

name Name; required

A unique name for this target.

compiler_deps List of labels; optional
deps List of labels; optional
scala Label; optional
scalacopts List of strings; optional
srcs List of labels; optional
title String; optional

configure_zinc_scala

configure_zinc_scala(kwargs)

Parameters

kwargs optional.

make_scala_binary

make_scala_binary(extras)

Parameters

extras optional.

make_scala_library

make_scala_library(extras)

Parameters

extras optional.

make_scala_test

make_scala_test(extras)

Parameters

extras optional.