Skip to content

Commit

Permalink
Add RunfilesLibraryInfo provider
Browse files Browse the repository at this point in the history
The new Starlark-defined RunfilesLibraryInfo provider may be used in the
future to decide whether additional information has to be emitted by a
rule for a target to find its runfiles at runtime. This may include
serializing repository mapping information to a runfile and/or
generating code that provides the canonical name of the current
repository.

The provider is added now rather than later so that third-party runfiles
libraries can rely on it being present earlier - they have to wait for
their minimum supported Bazel version to offer it. If it should turn out
not to be needed, it can safely be removed before any ruleset would have
a reason to depend on it.

Work towards bazelbuild/proposals#269
  • Loading branch information
fmeum committed Aug 10, 2022
1 parent db64be5 commit 91ca218
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 1 deletion.
1 change: 1 addition & 0 deletions tools/BUILD
Expand Up @@ -87,6 +87,7 @@ filegroup(
"//tools/jdk:bzl_srcs",
"//tools/osx:bzl_srcs",
"//tools/python:bzl_srcs",
"//tools/runfiles:bzl_srcs",
"//tools/sh:bzl_srcs",
"//tools/test:bzl_srcs",
"//tools/windows:bzl_srcs",
Expand Down
10 changes: 9 additions & 1 deletion tools/runfiles/BUILD
Expand Up @@ -11,6 +11,14 @@ filegroup(

filegroup(
name = "embedded_tools",
srcs = ["BUILD.tools"],
srcs = [
"BUILD.tools",
"runfiles.bzl",
],
visibility = ["//tools:__pkg__"],
)

filegroup(
name = "bzl_srcs",
srcs = ["runfiles.bzl"],
)
9 changes: 9 additions & 0 deletions tools/runfiles/runfiles.bzl
@@ -0,0 +1,9 @@
RunfilesLibraryInfo = provider(
doc = """
A marker for targets providing runfiles lookup functionality.
Rules may choose to emit additional information required to locate runfiles at runtime if this provider is present on a direct dependency.
Note: At this point, neither Bazel nor native rules check for the presence of this provider.
""",
)

0 comments on commit 91ca218

Please sign in to comment.