Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: bazel-contrib/bazel-lib
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.9.1
Choose a base ref
...
head repository: bazel-contrib/bazel-lib
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v2.9.2
Choose a head ref
  • 12 commits
  • 34 files changed
  • 9 contributors

Commits on Sep 26, 2024

  1. Update metadata.template.json (#950)

    Required by a BCR presubmit check, which blocked the last two releases.
    alexeagle authored Sep 26, 2024
    Configuration menu
    Copy the full SHA
    a75770b View commit details
    Browse the repository at this point in the history

Commits on Oct 1, 2024

  1. feat: support bzlmod runfiles lookups (#953)

    * feat: support bzlmod repo name aliases in tarred runfiles
    
    Under bzlmod, repos have aliases in addition to their canonical names;
    in order for lookups using these canonical names to function properly,
    a file name `_repo_mapping` is located in the root of the runfiles tree
    and consulted to perform repo-name translation.
    
    See: https://github.com/bazelbuild/proposals/blob/main/designs/2022-07-21-locating-runfiles-with-bzlmod.md
    
    * pre-commit formatting
    
    * Enable runfiles test under bzlmod
    
    It works now.
    plobsing authored Oct 1, 2024
    Configuration menu
    Copy the full SHA
    0db9fbe View commit details
    Browse the repository at this point in the history

Commits on Oct 4, 2024

  1. chore(deps): update dependency bazel to v7.3.2 (#955)

    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 4, 2024
    Configuration menu
    Copy the full SHA
    f479afd View commit details
    Browse the repository at this point in the history
  2. feat(presets): java bazelrc options (#947)

    * feat(presets): java bazelrc options
    
    * chore: improved comments
    alexeagle authored Oct 4, 2024
    Configuration menu
    Copy the full SHA
    1b4d9a7 View commit details
    Browse the repository at this point in the history
  3. Fix unknown repo error with mtree_mutate and Bzlmod (#948)

    With Bzlmod, every repo has its own namespace. Using Label() should make sure it uses the namespace of the .bzl file instead of the caller's one.
    mering authored Oct 4, 2024
    Configuration menu
    Copy the full SHA
    ca80d07 View commit details
    Browse the repository at this point in the history

Commits on Oct 8, 2024

  1. fix(bazelrc): move flag to bazel6.bazelrc (#959)

    This flag became a no-op in Bazel 7 (see [here][0]) and then was removed in
    Bazel 8 (see [here][1]).
    
    Fixes #958
    
    [0]: bazelbuild/bazel@c88f374
    [1]: bazelbuild/bazel@17ee62e
    ajwerner authored Oct 8, 2024
    Configuration menu
    Copy the full SHA
    7d901b7 View commit details
    Browse the repository at this point in the history

Commits on Oct 10, 2024

  1. Configuration menu
    Copy the full SHA
    f0e8c00 View commit details
    Browse the repository at this point in the history

Commits on Oct 13, 2024

  1. Configuration menu
    Copy the full SHA
    0ed8bdd View commit details
    Browse the repository at this point in the history
  2. perf: report unused inputs for the tar rule (#951)

    * perf: report unused inputs for the tar rule
    
    The `mtree` spec passed to the `tar` rule very often selects a subset of the
    inputs made available through the `srcs` attribute. In many cases, these
    subsets do not break down cleanly along dependency-tree lines and there
    is no simple way just pass less content to the `tar` rule.
    
    One prominent example where this occurs is when constructing the tars
    for OCI image layers. For instance when [building a Python-based
    container image](https://github.com/bazel-contrib/rules_oci/blob/main/docs/python.md),
    we might want to split the Python interpreter, third-party dependencies, and
    application code into their own layers. This is done by [filtering the
    `mtree_spec`](https://github.com/aspect-build/bazel-examples/blob/85cb2aaf8c6e51d5e9e086cc94b94ab896903fb0/oci_python_image/py_layer.bzl#L39).
    
    However, in the operation to construct a `tar` from a subsetted mtree,
    it is usually still an unsubsetted tree of `srcs` that gets passed. As
    a result, the subset tarball is considered dependent upon a larger set
    of sources than is strictly necessary.
    
    This over-scoping runs counter to a very common objective associated with
    breaking up an image into layers - isolating churn to a smaller slice of
    the application. Because of the spurious relationships established in
    Bazel's dependency graph, all tars get rebuilt anytime any content in
    the application gets changed. Tar rebuilds can even be triggered by
    changes to files that are completely filtered-out from all layers of the container.
    
    Redundent creation of archive content is usually not too computationally
    intensive, but the archives can be quite large in some cases, and
    avoiding a rebuild might free up gigabytes of disk and/or network
    bandwidth for
    better use. In addition, eliminating the spurious dependency edges
    removes erroneous constraints applied to the build action schedule;
    these tend to push all Tar-building operations towards the end of a
    build, even when some archive construction could be scheduled much earlier.
    
    ## Risk assessment and mitigation
    
    The `unused_inputs_list` mechanism used to report spurious dependency
    relationships is a bit difficult to use. Reporting an actually-used
    input as unused can create difficult to diagnose problems down the line.
    
    However, the behaviour of the `mtree`-based `tar` rule is sufficiently
    simple and self-contained that I am fairly confident that this rule's
    used/unused set can be determined accurately in a maintainable fashion.
    
    Out of an abundance of caution I have gated this feature behind a
    default-off flag. The `tar` rule will continue to operate as it had
    before - typically over-reporting dependencies - unless the
    `--@aspect_bazel_lib//lib:tar_compute_unused_inputs` flag is passed.
    
    ### Filter accuracy
    
    The `vis` encoding used by the `mtree` format to resiliently handle path
    names has a small amount of "play" to it - it is reversable but the
    encoded representation of a string is not
    unique. Two unequal encoded strings might decode to the same value; this
    can happen when at least one of the encoded strings contains unnecessary
    escapes that are nevertheless honoured by the decoder.
    
    The unused-inputs set is determined using a filter that compares
    `vis`-encoded strings. In the presence of non-canonically-encoded
    paths, false-mismatches can lead to falsely reporting that an input is
    unused.
    
    The only `vis`-encoded path content that is under the control of callers
    is the `mtree` content itself; all other `vis`-encoded strings are
    constructed internally to this package, not exposed publicly, and are
    all derived using the `lib/private/tar.bzl%_vis_encode` function; all of
    these paths are expected to compare exactly. Additionally, it is expected that
    many/most users will use this package's helpers (e.g. `mtree_spec`) when
    crafting their mtree content; such content is also safe. It is only when
    the user crafts their own mtree, or modifies an mtree spec's `content=`
    fields' encoding in some way, that a risk of inaccurate reporting
    arises. The chances for this are expected to be minor since this seems
    like an inconvenient and not-particularly-useful thing for a user to go
    out of their way to do.
    
    * Also include other bsdtar toolchain files in keep set
    
    * Add tri-state attribute to control unused-inputs behaviour
    
    This control surface provides for granular control of the feature. The
    interface is selected to mirror the common behaviour of `stamp` attributes.
    
    * Add bzl_library level dep
    
    * Update docs
    
    * pre-commit
    
    * Add reminder to change flag default on major-version bump
    
    * Add note about how to make unused input computation exactly correct
    
    * Add a test for unused_inputs listing
    
    * Support alternate contents= form
    
    This is accepted by bsdtar/libarchive. In fact `contents=` is the only of
    the pair documented in `mtree(5)`; `content=` is an undocumented
    alternate form supported by libarchive.
    
    * Don't try to prune the unprunable
    
    Bazel's interpretation of unused_inputs_list cannot accomodate certain
    things in filenames. These are also likely to mess up our own
    line-oriented protocol in the shellscript that produces this file.
    
    Co-authored-by: Sahin Yort <thesayyn@gmail.com>
    
    * Rerun docs update
    
    ---------
    
    Co-authored-by: Sahin Yort <thesayyn@gmail.com>
    plobsing and thesayyn authored Oct 13, 2024
    Configuration menu
    Copy the full SHA
    bca34bd View commit details
    Browse the repository at this point in the history
  3. fix(deps): update module github.com/bmatcuk/doublestar/v4 to v4.7.1 (#…

    …961)
    
    Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
    renovate[bot] authored Oct 13, 2024
    Configuration menu
    Copy the full SHA
    fa9bbee View commit details
    Browse the repository at this point in the history

Commits on Oct 15, 2024

  1. platform_transition_test: Use transitioned target platform (#965)

    The target platform of a test rule matters for the resolution of the execution platform of the test action, either via test toolchains or `--use_target_platform_for_tests`. With an outgoing transition, tests would run on the wrong platform in these cases, so use an incoming transition for the test rule.
    fmeum authored Oct 15, 2024
    Configuration menu
    Copy the full SHA
    64eb5f8 View commit details
    Browse the repository at this point in the history
  2. Configuration menu
    Copy the full SHA
    43f8b3e View commit details
    Browse the repository at this point in the history
Loading