scala_toolchain
allows you to define global configuration to all Scala targets.
Some scala_toolchain must be registered!
In your workspace file add the following lines:
# WORKSPACE
# register default scala toolchain
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()
-
Add your own definition of
scala_toolchain
to aBUILD
file: Example assumes external libraries are resolved with rules_jvm_external# //toolchains/BUILD load("//scala:scala.bzl", "setup_scala_toolchain") setup_scala_toolchain( name = "my_toolchain", # configure toolchain dependecies parser_combinators_deps = [ "@maven//:org_scala_lang_modules_scala_parser_combinators_2_12", ], scala_compile_classpath = [ "@maven//:org_scala_lang_scala_compiler", "@maven//:org_scala_lang_scala_library", "@maven//:org_scala_lang_scala_reflect", ], scala_library_classpath = [ "@maven//:org_scala_lang_scala_library", "@maven//:org_scala_lang_scala_reflect", ], scala_macro_classpath = [ "@maven//:org_scala_lang_scala_library", "@maven//:org_scala_lang_scala_reflect", ], scala_xml_deps = [ "@maven//:org_scala_lang_modules_scala_xml_2_12", ], # example of setting attribute values scalacopts = ["-Ywarn-unused"], unused_dependency_checker_mode = "off", visibility = ["//visibility:public"] )
-
Register your custom toolchain from
WORKSPACE
:# WORKSPACE register_toolchains("//toolchains:my_scala_toolchain")
Attributes | |
---|---|
dep_providers |
Allows to configure dependencies lists by configuring |
scalacopts |
Extra compiler options for this binary to be passed to scalac. |
scalac_jvm_flags |
List of JVM flags to be passed to scalac. For example
This is overridden by the |
scala_test_jvm_flags |
List of JVM flags to be passed to the ScalaTest runner. For example
This is overridden by the |
unused_dependency_checker_mode |
Enable unused dependency checking (see Unused dependency checking).
Possible values are: |
dependency_tracking_strict_deps_patterns |
List of target prefixes included for strict deps analysis. Exclude patetrns with '-' |
dependency_tracking_unused_deps_patterns |
List of target prefixes included for unused deps analysis. Exclude patetrns with '-' |
enable_semanticdb |
Enables semanticdb output. |
semanticdb_bundle_in_jar |
When False, *.semanticdb files are added to the filesystem in a directory. When True, *.semanticdb files will be bundled inside the jar file. |