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:# //toolchains/BUILD load("@io_bazel_rules_scala//scala:scala_toolchain.bzl", "scala_toolchain") load("@io_bazel_rules_scala//scala:providers.bzl", "declare_deps_provider") scala_toolchain( name = "my_toolchain_impl", dep_providers = [ ":my_scala_compile_classpath_provider", ":my_scala_library_classpath_provider", ":my_scala_macro_classpath_provider", ":my_scala_xml_provider", ":my_parser_combinators_provider", ], scalacopts = ["-Ywarn-unused"], unused_dependency_checker_mode = "off", visibility = ["//visibility:public"] ) toolchain( name = "my_scala_toolchain", toolchain_type = "@io_bazel_rules_scala//scala:toolchain_type", toolchain = "my_toolchain_impl", visibility = ["//visibility:public"] ) declare_deps_provider( name = "my_scala_compile_classpath_provider", deps_id = "scala_compile_classpath", visibility = ["//visibility:public"], deps = [ "@io_bazel_rules_scala_scala_compiler", "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect", ], ) declare_deps_provider( name = "my_scala_library_classpath_provider", deps_id = "scala_library_classpath", deps = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect", ], ) declare_deps_provider( name = "my_scala_macro_classpath_provider", deps_id = "scala_macro_classpath", deps = [ "@io_bazel_rules_scala_scala_library", "@io_bazel_rules_scala_scala_reflect", ], ) declare_deps_provider( name = "my_scala_xml_provider", deps_id = "scala_xml", deps = ["@scala_xml_dep"], ) declare_deps_provider( name = "my_parser_combinators_provider", deps_id = "parser_combinators", deps = ["@parser_combinators_dep"], )
-
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 '-' |