From 59cc7058def96d4d061cfeb9e39ca79028171530 Mon Sep 17 00:00:00 2001 From: Matt Mackay Date: Mon, 29 Jan 2024 12:43:32 -0500 Subject: [PATCH] perf: remove unnecessary calls to 'to_list' (#737) --- lib/private/copy_directory_toolchain.bzl | 2 +- lib/private/copy_to_directory_toolchain.bzl | 2 +- lib/private/jq_toolchain.bzl | 2 +- lib/private/yq_toolchain.bzl | 2 +- 4 files changed, 4 insertions(+), 4 deletions(-) diff --git a/lib/private/copy_directory_toolchain.bzl b/lib/private/copy_directory_toolchain.bzl index 94c4639..dcafb66 100644 --- a/lib/private/copy_directory_toolchain.bzl +++ b/lib/private/copy_directory_toolchain.bzl @@ -57,7 +57,7 @@ CopyToDirectoryInfo = provider( ) def _copy_directory_toolchain_impl(ctx): - binary = ctx.attr.bin.files.to_list()[0] + binary = ctx.file.bin default_info = DefaultInfo( files = depset([binary]), diff --git a/lib/private/copy_to_directory_toolchain.bzl b/lib/private/copy_to_directory_toolchain.bzl index 24972d8..8792ac8 100644 --- a/lib/private/copy_to_directory_toolchain.bzl +++ b/lib/private/copy_to_directory_toolchain.bzl @@ -57,7 +57,7 @@ CopyToDirectoryInfo = provider( ) def _copy_to_directory_toolchain_impl(ctx): - binary = ctx.attr.bin.files.to_list()[0] + binary = ctx.file.bin default_info = DefaultInfo( files = depset([binary]), diff --git a/lib/private/jq_toolchain.bzl b/lib/private/jq_toolchain.bzl index 9f78a66..f76eeef 100644 --- a/lib/private/jq_toolchain.bzl +++ b/lib/private/jq_toolchain.bzl @@ -65,7 +65,7 @@ JqInfo = provider( ) def _jq_toolchain_impl(ctx): - binary = ctx.attr.bin.files.to_list()[0] + binary = ctx.file.bin # Make the $(JQ_BIN) variable available in places like genrules. # See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables diff --git a/lib/private/yq_toolchain.bzl b/lib/private/yq_toolchain.bzl index ef42550..0879549 100644 --- a/lib/private/yq_toolchain.bzl +++ b/lib/private/yq_toolchain.bzl @@ -314,7 +314,7 @@ YqInfo = provider( ) def _yq_toolchain_impl(ctx): - binary = ctx.attr.bin.files.to_list()[0] + binary = ctx.file.bin # Make the $(YQ_BIN) variable available in places like genrules. # See https://docs.bazel.build/versions/main/be/make-variables.html#custom_variables