@@ -25,29 +25,30 @@ This project defines core build rules for [Scala](https://www.scala-lang.org/) t
25
25
26
26
## Getting started
27
27
28
- 1 . [ Install Bazel] ( https://docs.bazel.build/versions/master/install.html ) , see the [ compatibility table] ( #bazel-compatible-versions ) .
29
- 2 . Add the following to your ` WORKSPACE ` file and update the ` githash ` if needed:
28
+ 1 . [ Install Bazel] ( https://docs.bazel.build/versions/master/install.html ) ,
29
+ see the [ compatibility table] ( #bazel-compatible-versions ) .
30
+ 2 . Add the following to your ` WORKSPACE ` file and update versions with their sha256s if needed:
30
31
31
- ``` python
32
+ ``` starlark
33
+ # WORKSPACE
32
34
load(" @bazel_tools//tools/build_defs/repo:http.bzl" , " http_archive" )
33
35
34
- # bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0)
35
- skylib_version = " 0.8.0"
36
+ skylib_version = " 1.0.3"
36
37
http_archive(
37
38
name = " bazel_skylib" ,
39
+ sha256 = " 1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c" ,
38
40
type = " tar.gz" ,
39
- url = " https://github.com/bazelbuild/bazel-skylib/releases/download/{} /bazel-skylib.{} .tar.gz" .format (skylib_version, skylib_version),
40
- sha256 = " 2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e" ,
41
+ url = " https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{} /bazel-skylib-{} .tar.gz" .format(skylib_version, skylib_version),
41
42
)
42
43
43
- rules_scala_version= " a2f5852902f5b9f0302c727eead52ca2c7b6c3e2 " # update this as needed
44
+ rules_scala_version = " bc4896727a40e89d6b92e267c12a28964bc9a76b "
44
45
45
46
http_archive(
46
47
name = " io_bazel_rules_scala" ,
48
+ sha256 = " db147ab5abfe4380a441daea4420922b5416fccd70092604b6acec5262b0ff72" ,
47
49
strip_prefix = " rules_scala-%s " % rules_scala_version,
48
50
type = " zip" ,
49
- url = " https://github.com/bazelbuild/rules_scala/archive/%s .zip" % rules_scala_version,
50
- sha256 = " 8c48283aeb70e7165af48191b0e39b7434b0368718709d1bced5c3781787d8e7" ,
51
+ url = " https://github.com/liucijus/rules_scala/archive/%s .zip" % rules_scala_version,
51
52
)
52
53
53
54
# Stores Scala version and other configuration
@@ -56,31 +57,21 @@ http_archive(
56
57
load(" @io_bazel_rules_scala//:scala_config.bzl" , " scala_config" )
57
58
scala_config()
58
59
59
- load(" @io_bazel_rules_scala//scala:toolchains.bzl" , " scala_register_toolchains" )
60
- scala_register_toolchains()
61
-
62
60
load(" @io_bazel_rules_scala//scala:scala.bzl" , " scala_repositories" )
63
61
scala_repositories()
64
62
65
- protobuf_version= " 3.11.3"
66
- protobuf_version_sha256= " cf754718b0aa945b00550ed7962ddc167167bd922b842199eeb6505e6f344852"
67
-
68
- http_archive(
69
- name = " com_google_protobuf" ,
70
- url = " https://github.com/protocolbuffers/protobuf/archive/v%s .tar.gz" % protobuf_version,
71
- strip_prefix = " protobuf-%s " % protobuf_version,
72
- sha256 = protobuf_version_sha256,
73
- )
63
+ load(" @io_bazel_rules_scala//scala:toolchains.bzl" , " scala_register_toolchains" )
64
+ scala_register_toolchains()
74
65
75
- # Dependencies needed for google_protobuf.
76
- # You may need to modify this if your project uses google_protobuf for other purposes.
77
- load( " @com_google_protobuf//:protobuf_deps.bzl " , " protobuf_deps " )
78
- protobuf_deps ()
66
+ # optional: setup ScalaTest toolchain and dependencies
67
+ load( " @io_bazel_rules_scala//testing:scalatest.bzl " , " scalatest_repositories " , " scalatest_toolchain " )
68
+ scalatest_repositories( )
69
+ scalatest_toolchain ()
79
70
```
80
71
81
72
This will load the ` rules_scala ` repository at the commit sha
82
73
` rules_scala_version ` into your Bazel project and register a [ Scala
83
- toolchain] ( #scala_toolchain ) at the default Scala version (2.11.12 )
74
+ toolchain] ( #scala_toolchain ) at the default Scala version (2.12.11 )
84
75
85
76
Then in your BUILD file just add the following so the rules will be available:
86
77
``` python
@@ -137,20 +128,21 @@ Please check [coverage.md](docs/coverage.md) for more details on coverage suppor
137
128
Rules scala supports the last two released minor versions for each of Scala 2.11 and 2.12.
138
129
Previous minor versions may work but are supported only on a best effort basis.
139
130
140
- By default ` Scala 2.12.10 ` is used and to use another version you need to
141
- specify it when calling ` scala_repositories ` . ` scala_repositories ` takes a tuple ` (scala_version, scala_version_jar_shas) `
142
- as a parameter where ` scala_version ` is the scala version and ` scala_version_jar_shas ` is a ` dict ` with
143
- ` sha256 ` hashes for the maven artifacts ` scala_compiler ` , ` scala_library ` , and ` scala_reflect ` :
131
+ To configure Scala version you must call ` scala_config(scala_version = "2.xx.xx") ` and configure
132
+ dependencies by declaring [ scala_toolchain ] ( https://github.com/bazelbuild/rules_scala/blob/master/docs/scala_toolchain.md ) .
133
+ For a quick start you can use ` scala_repositories() ` and ` scala_register_toolchains() ` , which have
134
+ dependency providers configured for ` 2.11.12 ` and ` 2.12.11 ` versions.
144
135
145
- ``` python
146
- scala_repositories((
147
- " 2.11.12" ,
148
- {
149
- " scala_compiler" : " 3e892546b72ab547cb77de4d840bcfd05c853e73390fed7370a8f19acb0735a0" ,
150
- " scala_library" : " 0b3d6fd42958ee98715ba2ec5fe221f4ca1e694d7c981b0ae0cd68e97baf6dce" ,
151
- " scala_reflect" : " 6ba385b450a6311a15c918cf8688b9af9327c6104f0ecbd35933cfcd3095fe04" ,
152
- }
153
- ))
136
+ ``` starlark
137
+ # WORKSPACE
138
+ load(" @io_bazel_rules_scala//:scala_config.bzl" , " scala_config" )
139
+ scala_config(scala_version = " 2.11.12" )
140
+
141
+ load(" @io_bazel_rules_scala//scala:scala.bzl" , " scala_repositories" )
142
+ scala_repositories()
143
+
144
+ load(" @io_bazel_rules_scala//scala:toolchains.bzl" , " scala_register_toolchains" )
145
+ scala_register_toolchains()
154
146
```
155
147
156
148
If you're using any of the rules ` twitter_scrooge ` , ` tut_repositories ` , ` scala_proto_repositories `
0 commit comments