Skip to content

Commit c439ebf

Browse files
authored
Update README to reflect recent changes (bazel-contrib#1148)
1 parent bc48967 commit c439ebf

File tree

1 file changed

+32
-40
lines changed

1 file changed

+32
-40
lines changed

README.md

Lines changed: 32 additions & 40 deletions
Original file line numberDiff line numberDiff line change
@@ -25,29 +25,30 @@ This project defines core build rules for [Scala](https://www.scala-lang.org/) t
2525

2626
## Getting started
2727

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:
3031

31-
```python
32+
```starlark
33+
# WORKSPACE
3234
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
3335

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"
3637
http_archive(
3738
name = "bazel_skylib",
39+
sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
3840
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),
4142
)
4243

43-
rules_scala_version="a2f5852902f5b9f0302c727eead52ca2c7b6c3e2" # update this as needed
44+
rules_scala_version = "bc4896727a40e89d6b92e267c12a28964bc9a76b"
4445

4546
http_archive(
4647
name = "io_bazel_rules_scala",
48+
sha256 = "db147ab5abfe4380a441daea4420922b5416fccd70092604b6acec5262b0ff72",
4749
strip_prefix = "rules_scala-%s" % rules_scala_version,
4850
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,
5152
)
5253

5354
# Stores Scala version and other configuration
@@ -56,31 +57,21 @@ http_archive(
5657
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
5758
scala_config()
5859

59-
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
60-
scala_register_toolchains()
61-
6260
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
6361
scala_repositories()
6462

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()
7465

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()
7970
```
8071

8172
This will load the `rules_scala` repository at the commit sha
8273
`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)
8475

8576
Then in your BUILD file just add the following so the rules will be available:
8677
```python
@@ -137,20 +128,21 @@ Please check [coverage.md](docs/coverage.md) for more details on coverage suppor
137128
Rules scala supports the last two released minor versions for each of Scala 2.11 and 2.12.
138129
Previous minor versions may work but are supported only on a best effort basis.
139130

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.
144135

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()
154146
```
155147

156148
If you're using any of the rules `twitter_scrooge`, `tut_repositories`, `scala_proto_repositories`

0 commit comments

Comments
 (0)