[bazel] Resolve external path instead of hardcoding it

We'd been hardcoding paths like external/+_repo_rules2+clang_mac
which are new with BzlMod to avoid issues where different packages
depend on different versions of a dependency. We weren't supposed
to rely on this exact name resolution being the same across Bazel
releases, but we were. This is fragile as things are added to
MODULE.bazel and hasn't broken yet, but was getting annoying as I
was adding support for Windows.

This uses repo_name [1] to resolve that properly. We need to pipe
through something with a label from the toolchain to achieve this,
thus the references to ...compile_files.

[1] https://bazel.build/rules/lib/builtins/Label#repo_name

Bug: b/256860816, b/256860364
Change-Id: Ic8b18544e17944db368e35c2c78b77918155f4df
Reviewed-on: https://skia-review.googlesource.com/c/skia/+/1287856
Reviewed-by: Eric Boren <borenet@google.com>
Commit-Queue: Kaylee Lubick <kjlubick@google.com>
3 files changed