bazel-contrib / bazel_features

Support Bazel "feature detection" from starlark
https://docs.google.com/document/d/1HJf3gMYIrzmTRqbD4nWXH2eJRHXjLrOU0mmIeZplUzY/edit#heading=h.5mcn15i0e1ch
Apache License 2.0
19 stars 15 forks source link

`version_repo` is not updated when Bazel version changes #25

Closed meteorcloudy closed 1 year ago

meteorcloudy commented 1 year ago

When switching the Bazel version, the bazel_features_version repo generated by https://github.com/bazel-contrib/bazel_features/blob/1f1b95a6fcdc5bfcc67f7a845f3f5e8e89cc7d29/private/version_repo.bzl#L5-L5 won't be automatically updated, which could result wrong feature detection result.

meteorcloudy commented 1 year ago

/cc @fmeum @Wyverald

meteorcloudy commented 1 year ago

I was switching between 6.4.0rc3 and 6.4.0.

fmeum commented 1 year ago

We could replace https://github.com/bazelbuild/bazel/blob/dc4f54f9c57a27b68ae0e8c0d21ad3cb68a3dc44/src/main/java/com/google/devtools/build/lib/packages/WorkspaceFactory.java#L363 with a regular struct field method that tracks whether a repository rule invoked it and then adds the return value to the marker file.

fmeum commented 1 year ago

This would be difficult, but I think there is a much simpler solution: https://github.com/bazel-contrib/bazel_features/pull/26

meteorcloudy commented 1 year ago

Yeah, the new solution is also better since it works for existing Bazel versions! Thank you!!