From c3bd8feb64c0b7f199d4aeb26e3efb0fc7491beb Mon Sep 17 00:00:00 2001 From: Taylor Cramer Date: Wed, 5 Jun 2024 00:52:37 +0000 Subject: [PATCH] third_party: Symlink probe-rs binary into common location MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit This allows tools to use probe-rs via: ./bazel-bin/third_party/probe-rs/probe-rs rather than having to depend on bazel to provide the target-specific location of the binary. Change-Id: I75585385655302ccba94a31fa92079bda05d1f5e Reviewed-on: https://pigweed-review.googlesource.com/c/pigweed/pigweed/+/214057 Reviewed-by: Erik Gilling Lint: Lint 🤖 Commit-Queue: Taylor Cramer --- third_party/probe-rs/BUILD.bazel | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/third_party/probe-rs/BUILD.bazel b/third_party/probe-rs/BUILD.bazel index b4a07ea1ef..41e5505546 100644 --- a/third_party/probe-rs/BUILD.bazel +++ b/third_party/probe-rs/BUILD.bazel @@ -12,6 +12,7 @@ # License for the specific language governing permissions and limitations under # the License. +load("@bazel_skylib//rules:copy_file.bzl", "copy_file") load("per_platform_alias.bzl", "per_platform_alias") package(default_visibility = ["//visibility:public"]) @@ -19,7 +20,7 @@ package(default_visibility = ["//visibility:public"]) licenses(["notice"]) per_platform_alias( - name = "probe-rs", + name = "probe-rs-alias", platform_to_label = { "aarch64-linux": "@probe-rs-tools-aarch64-unknown-linux-gnu//:probe-rs", "aarch64-osx": "@probe-rs-tools-aarch64-apple-darwin//:probe-rs", @@ -28,3 +29,13 @@ per_platform_alias( "x86_64-windows": "@probe-rs-tools-x86_64-pc-windows-msvc//:probe-rs", }, ) + +# Symlink the `probe-rs` binary (whose path is platform-specific) into a common +# location. +copy_file( + name = "probe-rs-create-symlink", + src = ":probe-rs-alias", + out = "probe-rs", + allow_symlink = True, + is_executable = True, +)