sh_binary and sh_library confuse me.
Here's what I think I understand:
1) sh_binary targets are executable; they can have deps and data dependencies
2) sh_library targets aren't "executable" from Bazel's perspective
3) You can't list a sh_binary as a dep of a sh_binary; you have to convert it to a sh_library to do that
4) If you list a sh_binary X in as a "data" dependency of another sh_binary Y, X won't have access to its data/runfiles
5) Therefore, if you have a script that you both want to run and allow other sh_binary scripts to run it, you have to double-declare it as a sh_binary and as a sh_library. When invoking it directly, use the sh_binary; when depending on the script, use the sh_library.
Is that all true? If so, WHY is it true? It seems like an pointless distinction. sh_binary targets should be able to just declare other sh_binary targets as dependencies. What's the harm?
I suppose the same argument could be made re: py_binary targets, but at least py_binary targets have a wrapper environment script, so there it makes somewhat more sense.
-Dan