[all-commits] [llvm/llvm-project] b4f8a0: [Bazel] Change external_zlib attribute to string

Michael McLoughlin via All-commits all-commits at lists.llvm.org
Thu Jul 22 16:02:53 PDT 2021


  Branch: refs/heads/main
  Home:   https://github.com/llvm/llvm-project
  Commit: b4f8a000f6c907a9e9f06f85c8d40ef9c235002e
      https://github.com/llvm/llvm-project/commit/b4f8a000f6c907a9e9f06f85c8d40ef9c235002e
  Author: Michael McLoughlin <mbm at aurora.tech>
  Date:   2021-07-22 (Thu, 22 Jul 2021)

  Changed paths:
    M utils/bazel/zlib.bzl

  Log Message:
  -----------
  [Bazel] Change external_zlib attribute to string

When using `llvm_zlib_external` rule with `external_zlib` attribute set to a
label referring to the main repository, like `@//third_party/zlib`, it will be
replaced with `//third_party/zlib` after template substitution. This will then
attempt to find `//third_party/zlib` within the local repository
`@llvm_zlib//third_party/zlib`, which does not exist, rather than the intended
reference back to the main repository. The issue appears to be that the
conversion of `Label` type to string with
`str(repository_ctx.attr.external_zlib)`, which is causing the main repository
qualifier to be lost.

This diff fixes the issue by changing the `external_zlib` attribute to
`attr.string` type rather than `attr.label`.

In future a more elegant solution may be possible that preserves use of the
`Label` type, depending on resolution of the issue
https://github.com/bazelbuild/bazel/issues/13731.

Ported from Github PR https://github.com/google/llvm-bazel/pull/236.

Reviewed By: GMNGeoffrey

Differential Revision: https://reviews.llvm.org/D106606




More information about the All-commits mailing list