Unable to use stamp information in java_binary
's MANIFEST.MF
#266
Labels
P2
We'll consider to work on this in future. (Assignee optional)
java_binary
's MANIFEST.MF
#266
As far as I can tell, it currently isn't possible to use the output from
--workspace_status_command
injava_*
rules. Specifically, it seems like a fairly common use-case (and coincidentally, what I'm currently trying to do 😉) would be to include some form of build information (revision / build date / whatever) in theMANIFEST.MF
of a.jar
file.Expected behaviour: able to
--stamp
ajava_binary
with custom variablesActual behaviour: unable to pass through any custom variables to
deploy_manifest_lines
Steps to reproduce:
As a fairly trivial reproduction:
Running
bazel build :test_deploy.jar && unzip -p bazel-bin/test_deploy.jar META-INF/MANIFEST.MF
outputs:rather than the desired:
Extra information
I'm not 100% sure if this has changed in newer versions of
rules_java
(having a quick glance at the source, it seemed not?) but at least as of v7.x the attribute fordeploy_manifest_lines
only accepts alist
of strings, and states:It seems like there are maybe two related problems*, one is specific to
rules_java
and the other is a more general Bazel thing:java_binary
only accepts fixed strings fordeploy_manifest_lines
From what I've seen in some other places (e.g.
rules_oci
) there's no good solution to (2), so the pattern seems to be to allow providing a single file to use, and then having a command that generates that file by also reading from thebazel-out/stable-status.txt
andbazel-out/volatile-status.txt
files, e.g.*
I imagine some people will argue this is a feature, but it doesn't feel like it from here!If it's possible to do it without generating an intermediate file, that would be even better, but I suspect that won't be the case (at least without some major work to Bazel itself...)!
The text was updated successfully, but these errors were encountered: