Skip to content

Macros for auto-upgradable Bazel build dependencies to use with --experimental_resolved_file_instead_of_workspace

License

Notifications You must be signed in to change notification settings

fenollp/bazel_upgradable

Repository files navigation

Use bazel sync to upgrade & lock your dependencies.

Notes

Getting started

Add to your .bazelrc (more info):

# Dependencies locking
sync --experimental_repository_resolved_file=resolved.bzl
build --experimental_resolved_file_instead_of_workspace=resolved.bzl
build --experimental_repository_hash_file=resolved.bzl
build --experimental_verify_repository_rules=@bazel_tools//tools/build_defs/repo:git.bzl%git_repository

And to your WORKSPACE:

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")

http_archive(
    name = "bazel_upgradable",
    strip_prefix = "bazel_upgradable-0.3.0",
    url = "https://github.com/fenollp/bazel_upgradable/archive/0.3.0.zip",
)

load("@bazel_upgradable//:rule.bzl", "upgradable_repository")

# Then add your dependencies here
# and run `bazel sync`

Track HEAD

upgradable_repository(
    name = "bazel_skylib",
    remote = "https://github.com/bazelbuild/bazel-skylib.git",
)

SemVer constraints

# Locking on major of a GitHub tag
upgradable_repository(
    name = "bazel_skylib",
    remote = "https://github.com/bazelbuild/bazel-skylib.git",
    tag = "~1",
)

# Blacklisting part of an interval of tags published on Gitlab
upgradable_repository(
    name = "radamsa",
    remote = "[email protected]:akihe/radamsa.git",
    tag = "!=0.5",
)

Depend on GitHub releases

Downstream example: https://github.com/voidstarHQ/voidstar

upgradable_repository(
    name = "glfw_osx",
    build_file = "@//third_party:glfw3_osx.BUILD",
    # {tag} and {tag_digits} are expanded during dependency resolution
    release = "glfw-{tag_digits}.bin.MACOS.zip",
    remote = "https://github.com/glfw/glfw.git",
    tag = "~3",
)

Notes

Ongoing issues:

bazel_upgradable is an iteration on bazel_lock.

TODO

About

Macros for auto-upgradable Bazel build dependencies to use with --experimental_resolved_file_instead_of_workspace

Resources

License

Stars

Watchers

Forks

Sponsor this project

 

Packages

No packages published