Allow TemplateDict to accept Files and expand their content #22550
Labels
P3
We're not considering working on this, but happy to review a PR. (No assignee)
team-Rules-API
API for writing rules/aspects: providers, runfiles, actions, artifacts
type: feature request
Description of the feature request:
Allow TemplateDict to accept File objects and have it expand them to the content of the file.
This idea comes from wanting to concat files together in an action. Normally this requires
run_shell
, which poses multi-platform complications.So instead of this:
One could do this:
Similarly, this would come in handy for a two-stage bootstrap I need to create: stage one is some shell code that computes some values to feed into the second stage python file. Basically a template that looks like
Having it all in one file is sort of annoying. Being able to split it in two would be handy.
Which category does this issue belong to?
Rules API
What underlying problem are you trying to solve with this feature?
Being able to use file content in template actions
Which operating system are you running Bazel on?
linux
What is the output of
bazel info release
?7.x
If
bazel info release
returnsdevelopment version
or(@non-git)
, tell us how you built Bazel.No response
What's the output of
git remote get-url origin; git rev-parse HEAD
?No response
Have you found anything relevant by searching the web?
No response
Any other information, logs, or outputs that you want to share?
No response
The text was updated successfully, but these errors were encountered: