Skip to content
This repository has been archived by the owner on Jun 4, 2024. It is now read-only.

Latest commit

 

History

History
600 lines (568 loc) · 19.2 KB

scala_with_scalafmt.md

File metadata and controls

600 lines (568 loc) · 19.2 KB

scala_binary

scala_binary(name, config, data, deps, deps_unused_whitelist, deps_used_whitelist, format, 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.

config Label; optional

The Scalafmt configuration file.

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.

format Boolean; optional
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_library

scala_library(name, config, data, deps, deps_unused_whitelist, deps_used_whitelist, exports, format, 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.

config Label; optional

The Scalafmt configuration file.

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.

format Boolean; optional
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_test

scala_test(name, config, data, deps, deps_unused_whitelist, deps_used_whitelist, format, 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.

config Label; optional

The Scalafmt configuration file.

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.

format Boolean; optional
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