I am a Bazel novice and don't have any practical experience yet.
What is a Bazel analogue of .PHONY
rules (in GNU Make), that is targets that possibly don't create actual files in the filesystem and rebuilt whether the target exists or no?
That is, how to create and to pass to Bazel an intermediary rule that does not create a target file? For example, what may be Bazel code for install
rules?
Create a binary and use bazel run
. Put everything it needs from other Bazel rules (files to install, dependencies, etc) in its runfiles. Binaries are created using a rule with executable = True, either a builtin one like sh_binary
or cc_binary
or a custom one.