bazel-contrib / bazel-contrib/rules_scala
Better version mismatch messages
Open
Nobody has claimed this yet.
- Dominant language
- Starlark
- Stars
- 384
- Forks
- 292
- Avg merge
- 2d 21h
- Merged PRs (30d)
- 46
Description
When I add the following to my WORKSPACE file (only thing in that file),
rules_scala_version="a89d44f7ef67d93dedfc9888630f48d7723516f7" # I have tried a handful of versions here, same result
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
name = "io_bazel_rules_scala",
strip_prefix = "rules_scala-%s" % rules_scala_version,
type = "zip",
url = "https://github.com/bazelbuild/rules_scala/archive/%s.zip" % rules_scala_version,
)
load("@io_bazel_rules_scala//scala:toolchains.bzl", "scala_register_toolchains")
scala_register_toolchains()
load("@io_bazel_rules_scala//scala:scala.bzl", "scala_repositories")
scala_repositories()
protobuf_version="66dc42d891a4fc8e9190c524fd67961688a37bbe"
protobuf_version_sha256="983975ab66113cbaabea4b8ec9f3a73406d89ed74db9ae75c74888e685f956f8"
http_archive(
name = "com_google_protobuf",
url = "https://github.com/protocolbuffers/protobuf/archive/%s.tar.gz" % protobuf_version,
strip_prefix = "protobuf-%s" % protobuf_version,
sha256 = protobuf_version_sha256,
)
I see:
ERROR: /private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl:111:13: cfg must be either 'host' or 'target'.
ERROR: /private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl:125:22: Traceback (most recent call last):
File "/private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl", line 125
_common_attrs.update(_common_attrs_for_plugin_bootstr...)
File "/private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl", line 125, in _common_attrs.update
_common_attrs_for_plugin_bootstrapping
global variable '_common_attrs_for_plugin_bootstrapping' is referenced before assignment.
ERROR: /private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl:186:5: Traceback (most recent call last):
File "/private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl", line 185
_scala_library_for_plugin_bootstrapping_attrs.update(_common_attrs_for_plugin_bootstr...)
File "/private/var/tmp/_bazel_parth.mehrotra/f3d049f4cd59e2f8a0b016862811f8be/external/io_bazel_rules_scala/scala/scala.bzl", line 186, in _scala_library_for_plugin_bootstrapping_attrs.update
_common_attrs_for_plugin_bootstrapping
global variable '_common_attrs_for_plugin_bootstrapping' is referenced before assignment.
ERROR: error loading package '': Extension file 'scala/scala.bzl' has errors
ERROR: error loading package '': Extension file 'scala/scala.bzl' has errors
INFO: Elapsed time: 2.416s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the WORKSPACE setup and inspect external/io_bazel_rules_scala/scala/scala.bzl around lines 111, 125, and 186, where the reported errors originate. Trace how incompatible versions are detected and determine what information a useful mismatch diagnostic must expose. Done means a version mismatch produces a direct, actionable message instead of the cfg and uninitialized-variable errors shown.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- scala
- Domain
- build-system
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100