bazelbuild / bazelbuild/rules_pkg

Automatic top level symlinks

Open
#631 0 comments 0 reactions 0 assignees View on GitHub
feature-request p4
Dominant language
Starlark
Stars
253
Forks
221
Avg merge
10h 33m
Merged PRs (30d)
1

Description

I see this idiom a lot. Where people want to package a binary and runfiles, and want the binary effectively rooted at the top of the tree.

```
pkg_tar(
name = "foo",
srcs = [
":my_binary",
],
compatible_with = ["//buildenv/target:gce"],
include_runfiles = True,
package_dir = "./my_root",
symlinks = {"./my_binary": ".my_root/path/to/my/package/my_binary"},
)
```

We could do this with
```
...
srcs = [":my_binary", ":link_to_bin"],
...)

pkg_mklink(
name = "link_to_bin",
link_name = "my_binary",
target = "my_binary.runiles/my_root/path/to/my/package/my_binary"
)
```
But that is more verbose. Easier to use syntaxes might be
```
create_top_level_symlinks_to_executables=True
```
or
```
top_level_symlinks = [":my_binary"]
```

This, of course, should not be for pkg_tar only. Zip and future formats should have the same.

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.