rules_pkg icon indicating copy to clipboard operation
rules_pkg copied to clipboard

Add support for repo mapping

Open lamcw opened this issue 1 year ago • 0 comments

Context

When a binary is packaged with pkg_* rules, the repo_mapping manifest file is not included in the archive. For example

java_binary(
    name = "example",
    main_class = "...",
)

pkg_tar(
    name = "example_tar",
    srcs = [":example"],
    include_runfiles = True,
)

The above generates an archive that does not have _repo_mapping under runfiles directory even when bzlmod is enabled, and therefore runfiles libraries are not able to convert apparent repo names into canonical repo names.

Changes

Patch rules_pkg such that when

  1. bzlmod is enabled, and
  2. include_runfiles = True

it copies the repo mapping manifest into the archive at the correct location

i.e.

example
example.repo_mapping
example.runfiles/
├─ _repo_mapping

Closes #769

lamcw avatar Jul 25 '24 08:07 lamcw