@@ -28,7 +28,11 @@ def _store_config(repository_ctx):
2828 )
2929
3030 # All versions supported
31- scala_versions = [scala_version ]
31+ scala_versions = repository_ctx .attr .scala_versions
32+ if not scala_versions :
33+ scala_versions = [scala_version ]
34+ elif scala_version not in scala_versions :
35+ fail ("You have to include the default Scala version (%s) in the `scala_versions` list." % scala_version )
3236
3337 enable_compiler_dependency_tracking = repository_ctx .os .environ .get (
3438 "ENABLE_COMPILER_DEPENDENCY_TRACKING" ,
@@ -67,6 +71,11 @@ _config_repository = repository_rule(
6771 attrs = {
6872 "scala_version" : attr .string (
6973 mandatory = True ,
74+ doc = "Default Scala version" ,
75+ ),
76+ "scala_versions" : attr .string_list (
77+ mandatory = True ,
78+ doc = "List of all Scala versions to configure. Must include the default one." ,
7079 ),
7180 "enable_compiler_dependency_tracking" : attr .bool (
7281 mandatory = True ,
@@ -77,9 +86,11 @@ _config_repository = repository_rule(
7786
7887def scala_config (
7988 scala_version = _default_scala_version (),
89+ scala_versions = [],
8090 enable_compiler_dependency_tracking = False ):
8191 _config_repository (
8292 name = "io_bazel_rules_scala_config" ,
8393 scala_version = scala_version ,
94+ scala_versions = scala_versions ,
8495 enable_compiler_dependency_tracking = enable_compiler_dependency_tracking ,
8596 )
0 commit comments