Skip to content

Releases: bazelbuild/bazel-skylib

1.0.3

27 Aug 14:23
2ec2e6d
Compare
Choose a tag to compare

New Features

  • copy_file: Add parameter to allow symlinks (#252)
  • Create Gazelle language for Starlark (#251)
  • Create a helper rule (select_file) for selecting a file from outputs of another rule (#233)

Significant Changes

  • Move Gazelle extension to //gazelle/bzl and change package name
  • Stop depending on rules_pkg through the federation. (#259)

Incompatible Changes

  • Remove links to maprules (#213)
  • Remove old_sets.bzl (#231)
    It has been deprecated for a while, the code is not really compatible with Bazel depset-related changes.

Contributors
Andrew Z Allen, Bocete, Bor Kae Hwang, irengrig, Jay Conrod, Jonathan B Coe, Marc Plano-Lesay, Robbert van Ginkel, Thomas Van Lenten, Yannic, and the Bazel team.

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "bazel_skylib",
    urls = [
        "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.3/bazel-skylib-1.0.3.tar.gz",
    ],
    sha256 = "1c531376ac7e5a180e0237938a2536de0c54d93f5c278634818e0efc952dd56c",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

Using the rules

See the source.

1.0.2

09 Oct 17:59
e59b620
Compare
Choose a tag to compare

New Features

  • Added types.is_set() to test whether an arbitrary object is a set as defined by sets.bzl.

Incompatible Changes

  • @bazel_skylib//:lib.bzl is removed. You now must specify specific modules via @bazel_skylib//lib:.bzl.
  • maprule.bzl is removed.
    Added types.is_set() to test whether an arbitrary object is a set as defined by sets.bzl.

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "bazel_skylib",
    urls = [
        "https://mirror.bazel.build/github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
        "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.2/bazel-skylib-1.0.2.tar.gz",
    ],
    sha256 = "97e70364e9249702246c0e9444bccdc4b847bed1eb03c5a3ece4f83dfe6abc44",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

Using the rules

See the source.

1.0.1

09 Oct 03:45
cff8af4
Compare
Choose a tag to compare
1.0.1 Pre-release
Pre-release

New Features

Patch release to 1.0.0 to provide toolchain for unittest library.

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "bazel_skylib",
    url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.1/bazel-skylib-1.0.1.tar.gz",
    sha256 = "f1c8360c01fcf276778d3519394805dc2a71a64274a3a0908bc9edff7b5aebc8",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

Using the rules

See the source.

1.0.0

04 Oct 19:11
e5cf539
Compare
Choose a tag to compare
1.0.0 Pre-release
Pre-release

WARNING - unittests do not work. Wait for 1.0.1

Incompatible Changes

  • @bazel_skylib//:lib.bzl is removed. You now must specify specific modules
    via @bazel_skylib//lib:.bzl.
  • maprule.bzl is removed.

New Features

  • Added types.is_set() to test whether an arbitrary object is a set as defined by sets.bzl.

WORKSPACE setup

load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
http_archive(
    name = "bazel_skylib",
    url = "https://github.com/bazelbuild/bazel-skylib/releases/download/1.0.0/bazel-skylib-1.0.0.tar.gz",
    sha256 = "e72747100a8b6002992cc0bf678f6279e71a3fd4a88cab3371ace6c73432be30",
)
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

Using the rules

See the source.

0.9.0

12 Jul 19:27
2b38b2f
Compare
Choose a tag to compare

Incompatible Changes

  • Make sets.bzl point to new_sets.bzl instead of old_sets.bzl new_sets.bzl and
    old_sets.bzl should be removed in a following skylib release.

New Features

  • common_settings.bzl: Standard data types for user defined build
    configuration. Common scalar build settings for rules to use so they don't
    recreate them locally. This fulfills part of the SBC design doc:
    https://docs.google.com/document/d/1vc8v-kXjvgZOdQdnxPTaV0rrLxtP2XwnD2tAZlYJOqw/edit#bookmark=id.iiumwic0jphr

  • selects.bzl: Add config_setting_group for config_setting AND/OR-chaining
    Implements
    https://github.com/bazelbuild/proposals/blob/master/designs/2018-11-09-config-setting-chaining.md.

  • run_binary: runs an executable as an action

    • This rule is an alternative for genrule(): it canrun a binary with the
      desired arguments, environment, inputs, and outputs, as a single build
      action, without shelling out to Bash.
    • Fixes #149
  • New native_binary() and native_test() rules let you wrap a pre-built
    binary in a binary and test rule respectively.

    • native_binary() wraps a pre-built binary or script in a *_binary rule
      interface. Rules like genrule can tool-depend on it, and it can be
      executed with "bazel run". This rule can also augment the binary with
      runfiles.
    • native_test() is similar, but creates a testable rule instead of a
      binary rule.
    • Fixes #148
  • diff_test: test rule compares two files and passes if the files match.

  • maprule: move functionality to maprule_util.bzl.
    maprule_util.bzl will benefit planned new rules (namely a genrule alternative).

This release is tested with Bazel 0.28

WORKSPACE setup

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

maybe(
    http_archive,
    name = "bazel_skylib",
    url = "https://github.com/bazelbuild/bazel-skylib/releases/download/0.9.0/bazel_skylib-0.9.0.tar.gz",
    sha256 = "1dde365491125a3db70731e25658dfdd3bc5dbdfd11b840b3e987ecf043c7ca0",
)

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
bazel_skylib_workspace()

0.8.0

20 Mar 18:50
3721d32
Compare
Choose a tag to compare

New Features

  • “Analysis Test” testing framework under unittest.bzl. See documentation for details. Some new feature highlights:
    • Support for verifying rule-under-test failure conditions
    • Support for verifying actions registered by a rule-under-test
    • Support for verifying rule behavior under non-default bazel flags
  • analysis_test rule to verify that targets under test pass Bazel’s analysis phase. This is similar to the existing build_test rule, except that actions of the underlying targets are not executed. See documentation.
  • write_file rule to write UTF-8 encoded text files. (Works for bash platforms and Windows)
  • copy_file rule to copy a file to another location. (Works for bash platforms and Windows)
  • dicts.add() now accepts kwargs to add to the resulting dict.

This release is tested with Bazel 0.23

Thanks to the following external contributors:

Please use the bazel-skylib.0.8.0.tar.gz release asset from your Bazel WORKSPACE.

SHA-256 digest: 2ef429f5d7ce7111263289644d233707dba35e39696377ebab8b0bc701f7818e

Complete list of changes

0.7.0

08 Feb 21:23
Compare
Choose a tag to compare

Incompatible Changes

  • Made an incompatible change to unittest.bzl requiring minor migration effort:
    Test implementation functions for this framework now must return the result of unittest.end(env) instead of simply invoking this method. That is:
    def _your_test(ctx):
        env = unittest.begin(ctx)
        # Assert statements go here
        unittest.end(env)
    
    must become:
    def _your_test(ctx):
        env = unittest.begin(ctx)
        # Assert statements go here
        return unittest.end(env)
    

New Features

  • Added Windows support for unittest.bzl.

  • Added maprule rules (cmd_maprule and bash_maprule under //rules/maprule.bzl for Windows and bash support, respectively)

  • Added a build_test rule (build_test under //rules/build_test.bzl) to create test targets that verify that other targets build. Note that this rule does not currently work on Windows (though support for Windows shall come at a later time).

0.6.0

26 Nov 23:08
Compare
Choose a tag to compare
  • Renamed several instances of "Skylark". The old label and symbol names remain as aliases to these new locations and names temporarily. The aliases will go away on a future release.
    //:skylark_library.bzl renamed to //:bzl_library.bzl
    skylark_library renamed to bzl_library
    SkylarkLibraryInfo renamed to StarlarkLibraryInfo

  • //:lib.bzl has been deprecated. Depend directly on the bazel-skylib modules you need instead of depending on lib.bzl.

  • //:sets.bzl has been deprecated. Depend instead on //:new_sets.bzl, which was introduced in version 0.4.0 and has better performance than sets.bzl. sets.bzl will be removed in a future release.

  • Updated Starlark code to be compatible with Bazel version 0.19.2

0.5.0

13 Jun 20:25
Compare
Choose a tag to compare

Added the types module, which provides type-checking functions (e.g., to check if a value is a string, integer, list, and so forth).

0.4.0

09 May 19:32
Compare
Choose a tag to compare
  • Added the partial module, which emulates Python's functools.partial. The functionality in this module can be used to capture a function and, optionally, a subset of its arguments in a value that can be passed to other functions or stored and then called at a later time.

  • Added a new sets module (which can be loaded from lib.bzl as new_sets or from new_sets.bzl as sets). This new module implements hashed sets via an underlying dictionary and has better performance than the original sets module, which will be removed in a future release.