Skip to content
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

Better version mismatch messages #771

Open
Parth opened this issue Jun 18, 2019 · 16 comments
Open

Better version mismatch messages #771

Parth opened this issue Jun 18, 2019 · 16 comments

Comments

@Parth
Copy link
Contributor

Parth commented Jun 18, 2019

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)
@johnynek
Copy link
Member

what version of bazel did you try?

@Parth
Copy link
Contributor Author

Parth commented Jun 18, 2019

Build label: 0.27.0
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Jun 17 13:03:58 2019 (1560776638)
Build timestamp: 1560776638
Build timestamp as int: 1560776638

@johnynek
Copy link
Member

It may be that we don't work with 0.27 yet... CI is testing with 0.23: https://github.com/bazelbuild/rules_scala/blob/master/.travis.yml#L23

@Parth
Copy link
Contributor Author

Parth commented Jun 18, 2019

That was it!

@Parth Parth closed this as completed Jun 18, 2019
@Parth
Copy link
Contributor Author

Parth commented Jun 18, 2019

Thank you!

@Parth
Copy link
Contributor Author

Parth commented Jun 18, 2019

Maybe we should rename the title and re-open with the intention of providing better error reporting to users?

Something like This is the wrong version would go a long way, as this sort of error was un-googlable.

@Parth Parth reopened this Jun 18, 2019
@Parth Parth changed the title README instructions seem to be failing me: Better version mismatch messages Jun 18, 2019
@ittaiz
Copy link
Member

ittaiz commented Jun 19, 2019 via email

@anchlovi
Copy link
Contributor

We didn't

@ittaiz
Copy link
Member

ittaiz commented Jun 19, 2019

@Parth AFK so not sure, did you use an up to date version of rules_scala? Trying to understand if we just need to update the docs or rules scala itself

@Parth
Copy link
Contributor Author

Parth commented Jun 19, 2019

Basically all I did was brew install bazel (this downloaded 0.27 by default, I'm sure anyone new to bazel will do something similar), and then attempted to do the most minimal hello world and failed to do so. I tried a handful of hashes, none seemed to work.

The other scala rules guys plan to add this message: "The requested Bazel version '$bazel_version' is not supported" though their's failed to tell me anything useful at the current moment.

@Parth
Copy link
Contributor Author

Parth commented Jun 19, 2019

it seems like instead of saying 0.23 you want to say you support 0.13 -> 0.23 (and not newer) as whenever I have issues as an engineer my first instinct is to update, not downgrade.

@Parth
Copy link
Contributor Author

Parth commented Jun 19, 2019

But if it's trivial to add, I see no reason not to add it to the tool.

If someone doesn't mind doing a bit of hand holding I wouldn't mind issuing the PR and doing the dirty work of installing the various bazel versions and testing etc.

@johnynek
Copy link
Member

If you update the .travis.yml to install a newer bazel, we can test with 0.27. We used to test with a range, but we disabled the lower bound when it got too old. Doing 0.23 and 0.27 would be good. Changes needed are likely trivial.

@johnynek
Copy link
Member

I’m very happy to review and make suggestions and you help would be greatly appreciated and welcomed!

@Parth
Copy link
Contributor Author

Parth commented Jun 21, 2019

It seems like the table it self has some problems:

Build label: 0.23.2
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Mon Mar 11 16:50:03 2019 (1552323003)
Build timestamp: 1552323003
Build timestamp as int: 1552323003
[~/Documents/devbook, master+3]: head WORKSPACE
rules_scala_version="a89d44f7ef67d93dedfc9888630f48d7723516f7" # HEAD

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,
)

[~/Documents/devbook, master+3]: bazel build
DEBUG: Rule 'io_bazel_rules_scala' modified arguments {"sha256": "e341dc30a397c77e6723a953d4a84539c050b49f163b4c50cf865c698ea598fe"}
ERROR: /private/var/tmp/_bazel_parth.mehrotra/56e65e76c6e5acbbd30fd286bccbe6a3/external/io_bazel_rules_scala/scala/scala.bzl:111:13: Using cfg = "data" on an attribute is a noop and no longer supported. Please remove it. You can use --incompatible_disallow_data_transition=false to temporarily disable this check.
ERROR: /private/var/tmp/_bazel_parth.mehrotra/56e65e76c6e5acbbd30fd286bccbe6a3/external/io_bazel_rules_scala/scala/scala.bzl:125:22: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_parth.mehrotra/56e65e76c6e5acbbd30fd286bccbe6a3/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/56e65e76c6e5acbbd30fd286bccbe6a3/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/56e65e76c6e5acbbd30fd286bccbe6a3/external/io_bazel_rules_scala/scala/scala.bzl:186:5: Traceback (most recent call last):
        File "/private/var/tmp/_bazel_parth.mehrotra/56e65e76c6e5acbbd30fd286bccbe6a3/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/56e65e76c6e5acbbd30fd286bccbe6a3/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: 0.045s
INFO: 0 processes.
FAILED: Build did NOT complete successfully (0 packages loaded)
[~/Documents/devbook, 1, master+3, 1s]: head WORKSPACE
rules_scala_version="f3113fb6e9e35cb8f441d2305542026d98afc0a2" # 0.22

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,
)


[~/Documents/devbook, master+3]:
[~/Documents/devbook, master+3]: bazel build
INFO: SHA256 (https://github.com/bazelbuild/rules_scala/archive/f3113fb6e9e35cb8f441d2305542026d98afc0a2.zip) = 17f6a289c8c8af623c37b212ce4718055e44a69174bf8dc91fe442758130db65
DEBUG: Rule 'io_bazel_rules_scala' modified arguments {"sha256": "17f6a289c8c8af623c37b212ce4718055e44a69174bf8dc91fe442758130db65"}
INFO: Analysed 0 targets (0 packages loaded, 0 targets configured).
INFO: Found 0 targets...
INFO: Elapsed time: 0.960s, Critical Path: 0.00s
INFO: 0 processes.
INFO: Build completed successfully, 1 total action
[~/Documents/devbook, master+3, 1s]:

Steps to reproduce:

  1. Have bazel 0.23
  2. Grab head workspace file
  3. bazel build => Fail
  4. Change githash to the one for 0.22
    5 bazel build => Success

@johnynek
Copy link
Member

something seems weird here...

Others aren't seeing the errors you are. E.g #771 (comment)

also, stripe is using a later version, and not seeing this error.

Also, we haven't checked the minor versions (0.23.0 vs 0.23.2) etc... so I assume that is part of the issue too. Bazel breaks compatibility very frequently, so maybe those minor versions hit some issue.

Also, the best thing for us to do is update the CI to the latest bazel and fix whatever issue is now causing it to complain.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants