diff --git a/WORKSPACE b/WORKSPACE index 224c7656b..be58d35da 100644 --- a/WORKSPACE +++ b/WORKSPACE @@ -4,6 +4,15 @@ load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") load("@bazel_tools//tools/build_defs/repo:git.bzl", "git_repository") load("@bazel_tools//tools/build_defs/repo:jvm.bzl", "jvm_maven_import_external") +skylib_version = "1.0.3" + +http_archive( + name = "bazel_skylib", + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", + type = "tar.gz", + url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), +) + _build_tools_release = "3.3.0" http_archive( @@ -119,8 +128,11 @@ format_repositories() http_archive( name = "io_bazel_rules_go", - sha256 = "45409e6c4f748baa9e05f8f6ab6efaa05739aa064e3ab94e5a1a09849c51806a", - url = "https://github.com/bazelbuild/rules_go/releases/download/0.18.7/rules_go-0.18.7.tar.gz", + sha256 = "d1ffd055969c8f8d431e2d439813e42326961d0942bdf734d2c95dc30c369566", + urls = [ + "https://mirror.bazel.build/github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", + "https://github.com/bazelbuild/rules_go/releases/download/v0.24.5/rules_go-v0.24.5.tar.gz", + ], ) load( diff --git a/examples/testing/scalatest_repositories/BUILD b/examples/testing/scalatest_repositories/BUILD new file mode 100644 index 000000000..e69de29bb diff --git a/examples/testing/scalatest_repositories/WORKSPACE b/examples/testing/scalatest_repositories/WORKSPACE new file mode 100644 index 000000000..725a396a7 --- /dev/null +++ b/examples/testing/scalatest_repositories/WORKSPACE @@ -0,0 +1,35 @@ +workspace(name = "scalatest_repositories") + +load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") + +skylib_version = "1.0.3" + +http_archive( + name = "bazel_skylib", + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", + type = "tar.gz", + url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), +) + +local_repository( + name = "io_bazel_rules_scala", + path = "../../..", +) + +load("@io_bazel_rules_scala//:version.bzl", "bazel_version") + +bazel_version(name = "bazel_version") + +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories") + +scala_repositories() + +load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains") + +scala_register_toolchains() + +load("@io_bazel_rules_scala//testing:scalatest.bzl", "scalatest_repositories", "scalatest_toolchain") + +scalatest_repositories() + +scalatest_toolchain() diff --git a/examples/testing/scalatest_repositories/example/BUILD b/examples/testing/scalatest_repositories/example/BUILD new file mode 100644 index 000000000..d98d9a313 --- /dev/null +++ b/examples/testing/scalatest_repositories/example/BUILD @@ -0,0 +1,6 @@ +load("@io_bazel_rules_scala//scala:scala.bzl", "scala_test") + +scala_test( + name = "example", + srcs = ["ExampleTest.scala"], +) diff --git a/examples/testing/scalatest_repositories/example/ExampleTest.scala b/examples/testing/scalatest_repositories/example/ExampleTest.scala new file mode 100644 index 000000000..01ed9bb61 --- /dev/null +++ b/examples/testing/scalatest_repositories/example/ExampleTest.scala @@ -0,0 +1,9 @@ +package examples.testing.scalatest_repositories.example + +import org.scalatest.{FlatSpec, MustMatchers} + +class ExampleTest extends FlatSpec with MustMatchers { + "Exmaple" should "pass" in { + 1 must be(1) + } +} diff --git a/test/shell/test_examples.sh b/test/shell/test_examples.sh new file mode 100755 index 000000000..4280d5554 --- /dev/null +++ b/test/shell/test_examples.sh @@ -0,0 +1,11 @@ +# shellcheck source=./test_runner.sh +dir=$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd ) +. "${dir}"/test_runner.sh +. "${dir}"/test_helper.sh +runner=$(get_test_runner "${1:-local}") + +function scalatest_repositories_example() { + (cd examples/testing/scalatest_repositories; bazel test //...) +} + +$runner scalatest_repositories_example diff --git a/test_rules_scala.sh b/test_rules_scala.sh index dc6ef5666..81458a83f 100755 --- a/test_rules_scala.sh +++ b/test_rules_scala.sh @@ -46,3 +46,4 @@ $runner bazel test //test/... --extra_toolchains="//test_expect_failure/plus_one . "${test_dir}"/test_toolchain.sh . "${test_dir}"/test_unused_dependency.sh . "${test_dir}"/test_twitter_scrooge.sh +. "${test_dir}"/test_examples.sh diff --git a/test_version/WORKSPACE.template b/test_version/WORKSPACE.template index f974dfcd3..9e63d49b3 100644 --- a/test_version/WORKSPACE.template +++ b/test_version/WORKSPACE.template @@ -2,13 +2,13 @@ workspace(name = "io_bazel_rules_scala_test") load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive") -# bazel-skylib 0.8.0 released 2019.03.20 (https://github.com/bazelbuild/bazel-skylib/releases/tag/0.8.0) -skylib_version = "0.8.0" +skylib_version = "1.0.3" + http_archive( name = "bazel_skylib", + sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c", type = "tar.gz", - url = "https://github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib.{}.tar.gz".format (skylib_version, skylib_version), - sha256 = "2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e", + url = "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/{}/bazel-skylib-{}.tar.gz".format(skylib_version, skylib_version), ) local_repository( diff --git a/testing/scalatest.bzl b/testing/scalatest.bzl index e432fff1c..210b082b3 100644 --- a/testing/scalatest.bzl +++ b/testing/scalatest.bzl @@ -3,4 +3,4 @@ def scalatest_repositories(): pass def scalatest_toolchain(): - native.register_toolchain("//testing:scalatest_toolchain") + native.register_toolchains("@io_bazel_rules_scala//testing:scalatest_toolchain")