Skip to content

Commit

Permalink
Modify actions in order not to need toolchain param (#455)
Browse files Browse the repository at this point in the history
All actions which use tool or executable for which is not clear if it comes from a toolchain, must set a `toolchain` parameter ( migration of Automatic Exec Groups). 

As we discussed internally, I've modified actions so that it's recognised that tools are not from the toolchain. Hence, there will not be an error which states `Couldn't identify if tools are from implicit dependencies or a toolchain. Please set the toolchain parameter. If you're not using a toolchain, set it to 'None'.`. Hence, no need for the toolchain parameter.
  • Loading branch information
kotlaja committed Aug 28, 2023
1 parent 8386b9d commit 0171c69
Show file tree
Hide file tree
Showing 10 changed files with 13 additions and 16 deletions.
4 changes: 2 additions & 2 deletions distribution/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("distribution.bzl", "remove_internal_only")
load("@bazel_skylib//:version.bzl", "version")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("@rules_pkg//:mappings.bzl", "pkg_files", "strip_prefix")
load("@rules_pkg//:pkg.bzl", "pkg_tar")
load("distribution.bzl", "remove_internal_only")

package(
default_visibility = ["//visibility:private"],
Expand Down
4 changes: 2 additions & 2 deletions docs/private/stardoc_with_diff_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -23,9 +23,9 @@ available from a third-party:
https://github.com/aspect-build/bazel-lib/blob/main/docs/docs.md
"""

load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@bazel_skylib//rules:diff_test.bzl", "diff_test")
load("@bazel_skylib//rules:write_file.bzl", "write_file")
load("@io_bazel_stardoc//stardoc:stardoc.bzl", "stardoc")

def stardoc_with_diff_test(
name,
Expand Down
2 changes: 1 addition & 1 deletion gazelle/workspace.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,9 @@

"""Dependency registration helpers for repositories which need to load bazel-skylib's gazelle plugin."""

load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")
load("@bazel_tools//tools/build_defs/repo:http.bzl", "http_archive")
load("@bazel_tools//tools/build_defs/repo:utils.bzl", "maybe")
load("@bazel_skylib//:workspace.bzl", "bazel_skylib_workspace")

def bazel_skylib_gazelle_plugin_workspace():
"""Loads dependencies required to use skylib's gazelle plugin"""
Expand Down
5 changes: 2 additions & 3 deletions rules/private/copy_file_private.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,7 @@ def copy_cmd(ctx, src, dst):
is_executable = True,
)
ctx.actions.run(
inputs = [src],
tools = [bat],
inputs = [src, bat],
outputs = [dst],
executable = "cmd.exe",
arguments = ["/C", bat.path.replace("/", "\\")],
Expand All @@ -52,7 +51,7 @@ def copy_cmd(ctx, src, dst):

def copy_bash(ctx, src, dst):
ctx.actions.run_shell(
tools = [src],
inputs = [src],
outputs = [dst],
command = "cp -f \"$1\" \"$2\"",
arguments = [src.path, dst.path],
Expand Down
4 changes: 1 addition & 3 deletions rules/run_binary.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,6 @@ load("//lib:dicts.bzl", "dicts")

def _impl(ctx):
tool_as_list = [ctx.attr.tool]
tool_inputs, tool_input_mfs = ctx.resolve_tools(tools = tool_as_list)
args = [
# Expand $(location) / $(locations) in args.
#
Expand All @@ -45,13 +44,12 @@ def _impl(ctx):
ctx.actions.run(
outputs = ctx.outputs.outs,
inputs = ctx.files.srcs,
tools = tool_inputs,
tools = [ctx.executable.tool],
executable = ctx.executable.tool,
arguments = args,
mnemonic = "RunBinary",
use_default_shell_env = False,
env = dicts.add(ctx.configuration.default_shell_env, envs),
input_manifests = tool_input_mfs,
)
return DefaultInfo(
files = depset(ctx.outputs.outs),
Expand Down
2 changes: 1 addition & 1 deletion tests/build_test_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -14,8 +14,8 @@

"""Unit tests for build_test.bzl."""

load("//rules:build_test.bzl", "build_test")
load("@rules_cc//cc:defs.bzl", "cc_library")
load("//rules:build_test.bzl", "build_test")

# buildifier: disable=unnamed-macro
def build_test_test_suite():
Expand Down
2 changes: 1 addition & 1 deletion tests/native_binary/BUILD
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//rules:copy_file.bzl", "copy_file")
load("//rules:native_binary.bzl", "native_binary", "native_test")
load("@rules_cc//cc:defs.bzl", "cc_binary")

package(
default_testonly = 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/run_binary/BUILD
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
load("@rules_cc//cc:defs.bzl", "cc_binary")
load("//rules:diff_test.bzl", "diff_test")
load("//rules:run_binary.bzl", "run_binary")
load("//rules:write_file.bzl", "write_file")
load("@rules_cc//cc:defs.bzl", "cc_binary")

package(
default_testonly = 1,
Expand Down
2 changes: 1 addition & 1 deletion tests/select_file/BUILD
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
load("//rules:select_file.bzl", "select_file")
load("//rules:diff_test.bzl", "diff_test")
load("//rules:select_file.bzl", "select_file")

licenses(["notice"])

Expand Down
2 changes: 1 addition & 1 deletion tests/types_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -13,9 +13,9 @@
# limitations under the License.
"""Unit tests for types.bzl."""

load("//lib:new_sets.bzl", "sets")
load("//lib:types.bzl", "types")
load("//lib:unittest.bzl", "asserts", "unittest")
load("//lib:new_sets.bzl", "sets")

def _a_function():
"""A dummy function for testing."""
Expand Down

0 comments on commit 0171c69

Please sign in to comment.