bazel-contrib / rules_jsonnet

Jsonnet rules for Bazel
https://bazelbuild.github.io/rules_jsonnet/
Apache License 2.0
68 stars 73 forks source link

no such package '@@bazel_tools//platforms' in bazel build #196

Closed simonff closed 1 month ago

simonff commented 1 month ago

Hi! I'm trying to follow the process we recommend to the external users of our repo, but I'm running into problems.

If I git clone https://github.com/google/earthengine-catalog, remove .bazelversion that pins bazel to an old version, and then run bazel build --define jsonnet_port=cpp //... in the top directory, I get:

ERROR: no such package '@@bazel_tools//platforms': BUILD file not found in directory 'platforms' of external repository @@bazel_tools. Add a BUILD file to a directory to mark it as a package.

This is probably due to the jsonnet_to_json rule that we load here, but I don't understand enough how bazel+jsonnet work together to ask a more intelligent question.

EdSchouten commented 1 month ago

I see that in addition to the old version of Bazel that this repo uses, it is also using an old version of rules_jsonnet:

https://github.com/google/earthengine-catalog/blob/main/WORKSPACE#L5-L10

My recommendation would be to remove the WORKSPACE file entirely, and write a new MODULE.bazel file that depends on the latest version of rules_jsonnet that's in BCR:

https://registry.bazel.build/modules/rules_jsonnet

simonff commented 1 month ago

Thank you very much, this helped . Now I know the new way.