When running aquery
on a target, I can see two actions being performed by bazel:
bazel aquery '//bazel_test/a:foo'
action 'Writing file bazel_test/a/foo.manifest'
Mnemonic: FileWrite
Target: //bazel_test/a:foo
Configuration: k8-fastbuild
ActionKey: <hash>
Inputs: []
Outputs: [bazel-out/k8-fastbuild/bin/bazel_test/a/foo.manifest]
action 'Writing: bazel-out/k8-fastbuild/bin/bazel_test/a/foo.tar'
Mnemonic: PackageTar
Target: //bazel_test/a:foo
Configuration: k8-fastbuild
ActionKey: <hash>
Inputs: [bazel-out/k8-fastbuild/bin/bazel_test/a/foo.manifest, ...]
Outputs: [bazel-out/k8-fastbuild/bin/bazel_test/a/foo.tar]
I am interested in the manifest file because I want to see the resulting file tree of the files in foo.tar
.
Is there a way to only do the first of these action and write the manifest file without writing the tar file?
I looked through different flags to use when building but I did not find a suitable one. I was thinking the maybe --nobuild
would work but that actually skips the execution phase and thus skipping both of the actions above. I have the ActionKey
, so I was thinking maybe there is a way to execute an action if you have the ActionKey
.
There is a question closely related to this but it does not specifically mention how to create the manifest file without running the action after it. How do I get output files for a given Bazel target?
Whether this is possible and how to do it depend on how the rule is implemented. The rule needs to do one of
--output_groups
flagattr.output
/attr.output_list
in the rule declaration, and ctx.outputs
in the rule implementationIf the rule does none of the above, then there's no way to ask for that specific output file.
See the rule's documentation (or source code...) or if you're writing the rule yourself see https://bazel.build/extending/rules#requesting_output_files