Comments (6)
I've just ran into this issue. But I think everything is working as intended - native.bazel_version
is only available to repository rules i.e. it cannot be used from a BUILD
file, only from WORKSPACE
or from load()
ed files.
from bazel-skylib.
Oh, this is with:
http_archive(
name = "bazel_skylib",
sha256 = "bbccf674aa441c266df9894182d80de104cabd19be98be002f6d478aaa31574d",
strip_prefix = "bazel-skylib-2169ae1c374aab4a09aa90e65efe1a3aad4e279b",
urls = [
"https://github.com/bazelbuild/bazel-skylib/archive/2169ae1c374aab4a09aa90e65efe1a3aad4e279b.tar.gz",
],
)
in my WORKSPACE
from bazel-skylib.
Reproduced. For some reason, homebrew Bazel does not have bazel_version
in the native
Skylark module. Opened bazelbuild/bazel#4566
from bazel-skylib.
I am on current HEAD ff23a62, and provided that I am not looking for an absolute value and using minimum_bazel_version
/ maximum_bazel_version
I am not having issues with homebrew installs.
from bazel-skylib.
Weird, I can't reproduce it anymore with 0.10.0-homebrew
with bazel-skylib
itself on HEAD.
→ bazel version
Build label: 0.10.0-homebrew
Build target: bazel-out/darwin-opt/bin/src/main/java/com/google/devtools/build/lib/bazel/BazelServer_deploy.jar
Build time: Tue Jan 9 21:07:27 +50057 (1517479996047)
Build timestamp: 1517479996047
Build timestamp as int: 1517479996047
→ cat WORKSPACE
workspace(name = "bazel_skylib")
load(":lib.bzl", "versions")
versions.check(minimum_bazel_version="0.9.0")
→ bazel build //...
INFO: Analysed 38 targets (11 packages loaded).
INFO: Found 38 targets...
INFO: Elapsed time: 0.698s, Critical Path: 0.02s
INFO: Build completed successfully, 1 total action
And the expected failure:
→ cat WORKSPACE
workspace(name = "bazel_skylib")
load(":lib.bzl", "versions")
versions.check(minimum_bazel_version="0.11.0")
→ bazel build //...
ERROR: /Users/jin/Code/bazel-skylib/WORKSPACE:5:1: Traceback (most recent call last):
File "/Users/jin/Code/bazel-skylib/WORKSPACE", line 5
versions.check(minimum_bazel_version = "0.11.0")
File "/Users/jin/Code/bazel-skylib/lib/versions.bzl", line 107, in versions.check
fail("\nCurrent Bazel version is {}, ...))
Current Bazel version is 0.10.0-homebrew, expected at least 0.11.0
ERROR: Error evaluating WORKSPACE file
ERROR: error loading package 'external': Package 'external' contains errors
INFO: Elapsed time: 0.167s
FAILED: Build did NOT complete successfully (0 packages loaded)
from bazel-skylib.
The problem is that versions.bzl
can only be used in repository rule context - which is something we ought to (1) actually document in versionz.bzl
, and (2) (ideally) check for in each exported function in versions
.
See also bazelbuild/bazel#8305 (maybe Bazel ought to allow native.bazel_version
in macros and non-repository rules).
from bazel-skylib.
Related Issues (20)
- native_test and native_binary break shared libraries with remote execution HOT 3
- `run_binary` does not expand `$(RULEDIR)` in args
- Variation of `run_binary` to capture `stdout` and/or `stderr` HOT 2
- Expand make variables in write_file content and expand_template substitutions HOT 4
- Bazel skylib fails on Bazel@HEAD in downstream CI HOT 2
- zlib not found HOT 2
- [feature] Add repository rule for translation of "properties" file into a .bzl HOT 3
- Gazelle plugin just deleting `srcs` from some libraries HOT 7
- analysis_test_e2e_test is failing with Bazel@HEAD HOT 7
- bazel-skylib is failing at BAZEL@HEAD HOT 2
- Search runfiles in `select_file` rule HOT 1
- Error in rule: Use of Starlark transition without allowlist attribute '_allowlist_function_transition' with Bazel@HEAD HOT 3
- Version 1.4.2 is broken in bzlmod HOT 2
- Requesting New Release/Tag
- Set up publish-to-bcr for skylib HOT 2
- Brings in very old version of rules_cc: Eliminate or update? HOT 2
- ERROR: no such package '@@rules_java~7.1.0~toolchains~remote_java_tools with BAZEL@HEAD HOT 2
- RELEASE NOTES TYPO FOR 1.5.0: Missing comma for WORKSPACE sha256
- `build_test` shows test as cached even if the build was not up-to-date HOT 1
- `diff_test` relies on a `diff` binary being installed on the host
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from bazel-skylib.