Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ scalatest_toolchain()
```

This will load the `rules_scala` repository at the commit sha
`rules_scala_version` into your Bazel project and register a [scala_toolchain](docs/scala_toolchain.md) at the default Scala version (2.12.18)
`rules_scala_version` into your Bazel project and register a [scala_toolchain](docs/scala_toolchain.md) at the default Scala version (2.12.20)

Then in your BUILD file just add the following so the rules will be available:
```starlark
Expand Down Expand Up @@ -143,13 +143,13 @@ Previous minor versions may work but are supported only on a best effort basis.
To configure Scala version you must call `scala_config(scala_version = "2.xx.xx")` and configure
dependencies by declaring [scala_toolchain](docs/scala_toolchain.md).
For a quick start you can use `scala_repositories()` and `scala_register_toolchains()`, which have
dependency providers configured for `2.11.12`, `2.12.18` and `2.13.14` versions.
dependency providers configured for `2.11.12`, `2.12.20` and `2.13.15` versions.


```starlark
# WORKSPACE
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")
scala_config(scala_version = "2.13.14")
scala_config(scala_version = "2.13.15")

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
rules_proto_dependencies()
Expand Down
6 changes: 6 additions & 0 deletions dt_patches/dt_patch_test.sh
Original file line number Diff line number Diff line change
Expand Up @@ -101,6 +101,8 @@ run_test_local test_compiler_patch 2.12.15
run_test_local test_compiler_patch 2.12.16
run_test_local test_compiler_patch 2.12.17
run_test_local test_compiler_patch 2.12.18
run_test_local test_compiler_patch 2.12.19
run_test_local test_compiler_patch 2.12.20

run_test_local test_compiler_patch 2.13.0
run_test_local test_compiler_patch 2.13.1
Expand All @@ -115,6 +117,7 @@ run_test_local test_compiler_patch 2.13.10
run_test_local test_compiler_patch 2.13.11
run_test_local test_compiler_patch 2.13.12
run_test_local test_compiler_patch 2.13.14
run_test_local test_compiler_patch 2.13.15

run_test_local test_compiler_srcjar_error 2.12.11
run_test_local test_compiler_srcjar_error 2.12.12
Expand All @@ -127,7 +130,10 @@ run_test_local test_compiler_srcjar 2.12.15
run_test_local test_compiler_srcjar 2.12.16
run_test_local test_compiler_srcjar_nonhermetic 2.12.17
run_test_local test_compiler_srcjar_nonhermetic 2.12.18
run_test_local test_compiler_srcjar_nonhermetic 2.12.19
run_test_local test_compiler_srcjar_nonhermetic 2.12.20

run_test_local test_compiler_srcjar_nonhermetic 2.13.11
run_test_local test_compiler_srcjar_nonhermetic 2.13.12
run_test_local test_compiler_srcjar_nonhermetic 2.13.14
run_test_local test_compiler_srcjar_nonhermetic 2.13.15
32 changes: 31 additions & 1 deletion dt_patches/test_dt_patches_user_srcjar/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ http_archive(
],
)

http_archive(
name = "rules_python",
sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
strip_prefix = "rules_python-0.36.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

local_repository(
name = "io_bazel_rules_scala",
path = "../..",
Expand Down Expand Up @@ -91,6 +102,12 @@ srcjars_by_version = {
"2.12.18": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.18/scala-compiler-2.12.18-sources.jar?foo",
},
"2.12.19": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.19/scala-compiler-2.12.19-sources.jar?foo",
},
"2.12.20": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.12.20/scala-compiler-2.12.20-sources.jar?foo",
},
"2.13.11": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.11/scala-compiler-2.13.11-sources.jar?foo",
},
Expand All @@ -100,6 +117,9 @@ srcjars_by_version = {
"2.13.14": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.14/scala-compiler-2.13.14-sources.jar?foo",
},
"2.13.15": {
"url": "https://repo1.maven.org/maven2/org/scala-lang/scala-compiler/2.13.15/scala-compiler-2.13.15-sources.jar?foo",
},
}

rules_scala_setup(scala_compiler_srcjar = srcjars_by_version[SCALA_VERSION])
Expand All @@ -111,12 +131,22 @@ rules_scala_toolchain_deps_repositories(

register_toolchains(":dt_scala_toolchain")

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

rules_proto_dependencies()

load("@rules_proto//proto:setup.bzl", "rules_proto_setup")

rules_proto_setup()

load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

rules_proto_toolchains()

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")

scala_register_toolchains()
2 changes: 1 addition & 1 deletion examples/crossbuild/1_single/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ scala_library(
scala_test(
name = "test213",
srcs = ["test.scala"],
scala_version = "2.13.14",
scala_version = "2.13.15",
)

# This one will be compiled by 3.3 compiler (the default one):
Expand Down
2 changes: 1 addition & 1 deletion examples/crossbuild/2_deps/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ scala_binary(
name = "bin213",
srcs = ["bin.scala"], # compiled with 2.13 (as per `scala_version`)
main_class = "C",
scala_version = "2.13.14",
scala_version = "2.13.15",
deps = [
":lib", # compiled 2.13 (as per `scala_version`)
":lib211", # compiled with 2.11 (that target overrides version)
Expand Down
4 changes: 2 additions & 2 deletions examples/crossbuild/3_select/BUILD
Original file line number Diff line number Diff line change
Expand Up @@ -22,14 +22,14 @@ scala_binary(
name = "bin2",
srcs = ["bin.scala"],
main_class = "B",
scala_version = "2.13.14",
scala_version = "2.13.15",
deps = [":lib"],
)

scala_binary(
name = "bin3",
srcs = ["bin.scala"],
main_class = "B",
scala_version = "3.3.1",
scala_version = "3.3.4",
deps = [":lib"],
)
29 changes: 25 additions & 4 deletions examples/crossbuild/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,17 @@ http_archive(
],
)

http_archive(
name = "rules_python",
sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
strip_prefix = "rules_python-0.36.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

local_repository(
name = "io_bazel_rules_scala",
path = "../..",
Expand All @@ -19,11 +30,11 @@ local_repository(
load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")

scala_config(
scala_version = "3.3.1",
scala_version = "3.3.4",
scala_versions = [
"2.11.12",
"2.13.14",
"3.3.1",
"2.13.15",
"3.3.4",
],
)

Expand All @@ -37,12 +48,22 @@ rules_scala_setup()

rules_scala_toolchain_deps_repositories()

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

rules_proto_dependencies()

load("@rules_proto//proto:setup.bzl", "rules_proto_setup")

rules_proto_setup()

load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

rules_proto_toolchains()

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")

scala_register_toolchains()
Expand Down
25 changes: 23 additions & 2 deletions examples/scala3/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -11,14 +11,25 @@ http_archive(
],
)

http_archive(
name = "rules_python",
sha256 = "ca77768989a7f311186a29747e3e95c936a41dffac779aff6b443db22290d913",
strip_prefix = "rules_python-0.36.0",
url = "https://github.com/bazelbuild/rules_python/releases/download/0.36.0/rules_python-0.36.0.tar.gz",
)

load("@rules_python//python:repositories.bzl", "py_repositories")

py_repositories()

local_repository(
name = "io_bazel_rules_scala",
path = "../..",
)

load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")

scala_config(scala_version = "3.3.1")
scala_config(scala_version = "3.5.2")

load(
"@io_bazel_rules_scala//scala:scala.bzl",
Expand All @@ -30,12 +41,22 @@ rules_scala_setup()

rules_scala_toolchain_deps_repositories(fetch_sources = True)

load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies", "rules_proto_toolchains")
load("@rules_proto//proto:repositories.bzl", "rules_proto_dependencies")

rules_proto_dependencies()

load("@rules_proto//proto:setup.bzl", "rules_proto_setup")

rules_proto_setup()

load("@rules_proto//proto:toolchains.bzl", "rules_proto_toolchains")

rules_proto_toolchains()

load("@com_google_protobuf//:protobuf_deps.bzl", "protobuf_deps")

protobuf_deps()

load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")

scala_register_toolchains()
2 changes: 1 addition & 1 deletion examples/semanticdb/WORKSPACE
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ local_repository(

load("@io_bazel_rules_scala//:scala_config.bzl", "scala_config")

scala_config(scala_version = "2.13.14")
scala_config(scala_version = "2.13.15")

load(
"@io_bazel_rules_scala//scala:scala.bzl",
Expand Down
2 changes: 1 addition & 1 deletion scala_config.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ load("//scala:scala_cross_version.bzl", "extract_major_version", "extract_minor_

def _default_scala_version():
"""return the scala version for use in maven coordinates"""
return "2.12.18"
return "2.12.20"

def _validate_supported_scala_version(scala_major_version, scala_minor_version):
if scala_major_version == "2.11" and int(scala_minor_version) != 12:
Expand Down
7 changes: 6 additions & 1 deletion test/shell/test_coverage_equals_in_target.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,13 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

# Default to 2.12.20 for `diff` tests because other versions change the output.
SCALA_VERSION="${SCALA_VERSION:-2.12.20}"

test_coverage_target_name_contains_equals_sign() {
bazel coverage //test/coverage_filename_encoding:name-with-equals
bazel coverage \
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
//test/coverage_filename_encoding:name-with-equals
diff test/coverage_filename_encoding/expected-coverage.dat $(bazel info bazel-testlogs)/test/coverage_filename_encoding/name-with-equals/coverage.dat
}

Expand Down
11 changes: 8 additions & 3 deletions test/shell/test_coverage_scalatest.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

# Default to 2.12.20 for `diff` tests because other versions change the output.
SCALA_VERSION="${SCALA_VERSION:-2.12.20}"

test_coverage_on() {
bazel coverage //test/coverage_scalatest:test-scalatest
bazel coverage \
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
//test/coverage_scalatest:test-scalatest
diff test/coverage_scalatest/expected-coverage.dat $(bazel info bazel-testlogs)/test/coverage_scalatest/test-scalatest/coverage.dat
}

test_coverage_includes_test_targets() {
bazel coverage \
--instrument_test_targets=True \
//test/coverage_scalatest:test-scalatest
--instrument_test_targets=True \
//test/coverage_scalatest:test-scalatest
grep -q "SF:test/coverage_scalatest/TestWithScalaTest.scala" $(bazel info bazel-testlogs)/test/coverage_scalatest/test-scalatest/coverage.dat
}

Expand Down
12 changes: 8 additions & 4 deletions test/shell/test_coverage_scalatest_resources.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,17 +4,21 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

# Default to 2.12.20 for `diff` tests because other versions change the output.
SCALA_VERSION="${SCALA_VERSION:-2.12.20}"

test_coverage_succeeds_resource_call() {
bazel coverage \
--instrumentation_filter=^//test/coverage_scalatest_resources[:/] \
//test/coverage_scalatest_resources/consumer:tests
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
--instrumentation_filter=^//test/coverage_scalatest_resources[:/] \
//test/coverage_scalatest_resources/consumer:tests
diff test/coverage_scalatest_resources/expected-coverage.dat $(bazel info bazel-testlogs)/test/coverage_scalatest_resources/consumer/tests/coverage.dat
}

test_coverage_includes_resource_test_targets() {
bazel coverage \
--instrument_test_targets=True \
//test/coverage_scalatest_resources/consumer:tests
--instrument_test_targets=True \
//test/coverage_scalatest_resources/consumer:tests
grep -q "SF:test/coverage_scalatest_resources/consumer/src/test/scala/com/example/consumer/ConsumerSpec.scala" $(bazel info bazel-testlogs)/test/coverage_scalatest_resources/consumer/tests/coverage.dat
}

Expand Down
11 changes: 8 additions & 3 deletions test/shell/test_coverage_specs2_with_junit.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,20 @@ dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )
. "${dir}"/test_helper.sh
runner=$(get_test_runner "${1:-local}")

# Default to 2.12.20 for `diff` tests because other versions change the output.
SCALA_VERSION="${SCALA_VERSION:-2.12.20}"

test_coverage_on() {
bazel coverage //test/coverage_specs2_with_junit:test-specs2-with-junit
bazel coverage \
--repo_env="SCALA_VERSION=${SCALA_VERSION}" \
//test/coverage_specs2_with_junit:test-specs2-with-junit
diff test/coverage_specs2_with_junit/expected-coverage.dat $(bazel info bazel-testlogs)/test/coverage_specs2_with_junit/test-specs2-with-junit/coverage.dat
}

test_coverage_includes_test_targets() {
bazel coverage \
--instrument_test_targets=True \
//test/coverage_specs2_with_junit:test-specs2-with-junit
--instrument_test_targets=True \
//test/coverage_specs2_with_junit:test-specs2-with-junit
grep -q "SF:test/coverage_specs2_with_junit/TestWithSpecs2WithJUnit.scala" $(bazel info bazel-testlogs)/test/coverage_specs2_with_junit/test-specs2-with-junit/coverage.dat
}

Expand Down
Loading