-
Notifications
You must be signed in to change notification settings - Fork 432
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add
Runfiles::current_repository
to runfiles library
- Loading branch information
1 parent
2f05117
commit bec16e1
Showing
8 changed files
with
75 additions
and
37 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
package(default_visibility = ["//tools/runfiles:__pkg__"]) | ||
|
||
filegroup( | ||
name = "distro", | ||
srcs = glob([ | ||
"**/*.bzl", | ||
]) + [ | ||
"BUILD.bazel", | ||
], | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
"""Utilities for the `@rules_rust//tools/runfiles` library""" | ||
|
||
_RULES_RUST_RUNFILES_WORKSPACE_NAME = "RULES_RUST_RUNFILES_WORKSPACE_NAME" | ||
|
||
def _workspace_name_impl(ctx): | ||
output = ctx.actions.declare_file(ctx.label.name) | ||
|
||
ctx.actions.write( | ||
output = output, | ||
content = "{}={}\n".format( | ||
_RULES_RUST_RUNFILES_WORKSPACE_NAME, | ||
ctx.workspace_name, | ||
), | ||
) | ||
|
||
return [DefaultInfo( | ||
files = depset([output]), | ||
)] | ||
|
||
workspace_name = rule( | ||
implementation = _workspace_name_impl, | ||
doc = """\ | ||
A rule for detecting the current workspace name and writing it to a file for | ||
for use with `rustc_env_files` attributes on `rust_*` rules. The workspace | ||
name is exposed by the variable `{}`.""".format(_RULES_RUST_RUNFILES_WORKSPACE_NAME), | ||
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters