Giter Club home page Giter Club logo

Comments (6)

ash2k avatar ash2k commented on June 2, 2024 2

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.

jmhodges avatar jmhodges commented on June 2, 2024

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.

jin avatar jin commented on June 2, 2024

Reproduced. For some reason, homebrew Bazel does not have bazel_version in the native Skylark module. Opened bazelbuild/bazel#4566

from bazel-skylib.

promiseofcake avatar promiseofcake commented on June 2, 2024

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.

jin avatar jin commented on June 2, 2024

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.

tetromino avatar tetromino commented on June 2, 2024

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)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo 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.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.