-
-
Notifications
You must be signed in to change notification settings - Fork 287
Fix toolchain registration call for ScalaTest #1130
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
ec91a29
9fb145b
b7395e0
9e5af80
0d7395c
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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() |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,6 @@ | ||
| load("@io_bazel_rules_scala//scala:scala.bzl", "scala_test") | ||
|
|
||
| scala_test( | ||
| name = "example", | ||
| srcs = ["ExampleTest.scala"], | ||
| ) |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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) | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -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 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -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") | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Small question- your previous CI (IIRC) was without
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. It was a mistake - all toolchains have to be registered with external name otherwise they may be treated as different
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So it's precaution rather than something actually failed? (Ok with either, trying to understand which)
Collaborator
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I tried with the example repo - it doesn't even find the toolchain:
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Amazing. Great that we have this test workspace |
||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Why did you upgrade rules_go? Because of skylib?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
yes