Open tpudlik opened 5 months ago
@katre @aranguyen FYI
It looks like the executable requirement is just to setup a symlink in the parent build dir (which is nice, since otherwise bazel sticks it in a hard to find dynamic named build dir). So maybe it could only set that symlink only if executable is set?
Unfortunately, the executable
parameter to rule
is set for the rule, and can't be set during analysis.
We could in theory have a macro that redirects to platform_data
or platform_binary
based on an executable
attribute, and get the same effect with a bit more work, but then we'd need a sensible default (since the macro wouldn't be able to guess whether the target is an executable or not).
Would it make sense to have two separate rules, platform_data
and platform_binary
, differing only in the executable
parameter?
I actually think platform_binary
may be a more self-explanatory name to people who use this rule to wrap binary targets. And if the target is required to be a binary (executable) anyway, there's no loss of generality in replacing the more generic term "data".
This came up in a code review discussion for an (accidental) re-implementation of
platform_data
: thetarget
inplatform_data
is required to beexecutable = True
. I thought the reason it's calledplatform_data
and notplatform_binary
is specifically because the target doesn't have to be created by a binary rule, but can be any kind of data!It would be nice to relax this restriction.