-
Notifications
You must be signed in to change notification settings - Fork 4.1k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow access or generation of repo mapping files in Starlark #19937
Comments
I also think that this should be solved in 7.0 since this will make migrations to bzlmod more painful. |
Exposing the repo mapping on @purkhusid Would this be sufficient for your use case? Edit: Whatever we decide to do here, the change should be straightforward and cherry-pickable. |
My exact use case i only packaging a single executable with it's runfiles so that would be sufficient for me. It could be a first step if you want to think a bit better about an public API for generating mappings files for arbitrary runfiles. |
The new `repo_mapping_manifest` field on `FilesToRunProvider` allows Starlark rule implementations to access the `File` containing the repo mapping manifest for an executable target, e.g. to include the manifest into a synthetic runfiles structure for packaging purposes. Fixes bazelbuild#19937 Closes bazelbuild#19944. PiperOrigin-RevId: 578735848 Change-Id: Ida78778af5aef4ba0c216815563aef4b54c9d1db
The new `repo_mapping_manifest` field on `FilesToRunProvider` allows Starlark rule implementations to access the `File` containing the repo mapping manifest for an executable target, e.g. to include the manifest into a synthetic runfiles structure for packaging purposes. Fixes #19937 Closes #19944. Commit 3575211 PiperOrigin-RevId: 578735848 Change-Id: Ida78778af5aef4ba0c216815563aef4b54c9d1db Co-authored-by: Fabian Meumertzheim <fabian@meumertzhe.im>
A fix for this issue has been included in Bazel 7.0.0 RC5. Please test out the release candidate and report any issues as soon as possible. Thanks! |
Description of the feature request:
There is currently no way to access the repo mapping file in Starlark. This causes problems when you need to make an binary that uses a runfiles libraries runnable outside of Bazel e.g. in an container or if you just want to package the binary in some way.
To make the binary runnable outside of bazel the
.repo_mapping
file is required so that runfiles lookups don't fail. That means that there needs to be an way to either generate or copy the.repo_mapping
file in starlark so that e.g. a tar rule can list the repo mapping file in it's inputs.There is currently an workaround for this for Python zip that is not available to others: 4e60992#diff-06b3fa5571583c2c73ec269859f1b9194038c26cc6c0e9c8897f53b992731658R382
This API could be publicly exposed or if it's possible the repo mapping could be exposed on the
FilesToRunProvider
like the runfiles manifest is exposed today.Tagging @fmeum and @Wyverald since there is some context in a couple of Slack threads that they were part of:
https://bazelbuild.slack.com/archives/C014RARENH0/p1698153613312699
https://bazelbuild.slack.com/archives/CA3NW13MH/p1697050350018059?thread_ts=1697034827.979009&cid=CA3NW13MH
Which category does this issue belong to?
Rules API
The text was updated successfully, but these errors were encountered: