diff --git a/extras/bindata.bzl b/extras/bindata.bzl index f1b944ef6f..e5a10b8732 100644 --- a/extras/bindata.bzl +++ b/extras/bindata.bzl @@ -48,7 +48,7 @@ def _bindata_impl(ctx): inputs = ctx.files.srcs, outputs = [out], mnemonic = "GoBindata", - executable = ctx.file._bindata, + executable = ctx.executable._bindata, arguments = [arguments], ) return [ @@ -71,8 +71,6 @@ bindata = go_rule( "modtime": attr.bool(default = False), "extra_args": attr.string_list(), "_bindata": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "@com_github_kevinburke_go_bindata//go-bindata:go-bindata", diff --git a/go/private/rules/builders.bzl b/go/private/rules/builders.bzl index 2caa0c446b..12f603cb0e 100644 --- a/go/private/rules/builders.bzl +++ b/go/private/rules/builders.bzl @@ -42,50 +42,36 @@ builders = rule( _builders_impl, attrs = { "_asm": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:asm", ), "_compile": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:compile", ), "_pack": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:pack", ), "_link": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:link", ), "_cgo": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:cgo", ), "_test_generator": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:generate_test_main", ), "_cover": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "//go/tools/builders:cover", diff --git a/go/private/rules/cgo.bzl b/go/private/rules/cgo.bzl index da6463d483..70a6ce316c 100644 --- a/go/private/rules/cgo.bzl +++ b/go/private/rules/cgo.bzl @@ -324,8 +324,7 @@ _cgo_import = go_rule( _cgo_import_impl, attrs = { "cgo_o": attr.label( - allow_files = True, - single_file = True, + allow_single_file = True, ), "sample_go_srcs": attr.label_list(allow_files = True), }, diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl index f806f82fc2..e6f6c17e04 100644 --- a/go/private/rules/info.bzl +++ b/go/private/rules/info.bzl @@ -42,7 +42,6 @@ _go_info = go_rule( _go_info_impl, attrs = { "_go_info": attr.label( - single_file = True, executable = True, cfg = "host", default = "@io_bazel_rules_go//go/tools/builders:info", diff --git a/go/private/rules/sdk.bzl b/go/private/rules/sdk.bzl index 130a796545..829467bb01 100644 --- a/go/private/rules/sdk.bzl +++ b/go/private/rules/sdk.bzl @@ -31,7 +31,7 @@ def _go_sdk_impl(ctx): headers = ctx.files.headers, srcs = ctx.files.srcs, tools = ctx.files.tools, - go = ctx.file.go, + go = ctx.executable.go, )] go_sdk = rule( diff --git a/go/private/tools/files_equal_test.bzl b/go/private/tools/files_equal_test.bzl index d1e4a71fe4..503ae106b9 100644 --- a/go/private/tools/files_equal_test.bzl +++ b/go/private/tools/files_equal_test.bzl @@ -61,13 +61,11 @@ files_equal_test = rule( attrs = { "golden": attr.label( mandatory = True, - allow_files = True, - single_file = True, + allow_single_file = True, ), "actual": attr.label( mandatory = True, - allow_files = True, - single_file = True, + allow_single_file = True, ), "error_message": attr.string( default = "FILES DO NOT HAVE EQUAL CONTENTS", diff --git a/go/private/tools/gazelle.bzl b/go/private/tools/gazelle.bzl index 001772c872..fe705330df 100644 --- a/go/private/tools/gazelle.bzl +++ b/go/private/tools/gazelle.bzl @@ -30,6 +30,7 @@ $BASE/{gazelle} {args} $@ def _gazelle_script_impl(ctx): print("DEPRECATED: %s: load gazelle rule from @bazel_gazelle//:def.bzl instead of @io_bazel_rules_go//go:def.bzl" % ctx.label) + # TODO(jayconrod): add a fix to Gazelle to replace invocations of this rule # with the new one in @bazel_gazelle. Once in place, fail here. go = go_context(ctx) @@ -47,12 +48,12 @@ def _gazelle_script_impl(ctx): if ctx.attr.build_tags: args += ["-build_tags", ",".join(ctx.attr.build_tags)] args += ctx.attr.args - script_content = _script_content.format(gazelle = ctx.file._gazelle.short_path, args = " ".join(args)) + script_content = _script_content.format(gazelle = ctx.executable._gazelle.short_path, args = " ".join(args)) script_file = go.declare_file(go, ext = ".bash") ctx.actions.write(output = script_file, is_executable = True, content = script_content) return struct( files = depset([script_file]), - runfiles = ctx.runfiles([ctx.file._gazelle]), + runfiles = ctx.runfiles([ctx.executable._gazelle]), ) _gazelle_script = go_rule( @@ -85,8 +86,6 @@ _gazelle_script = go_rule( "prefix": attr.string(), "_gazelle": attr.label( default = "@bazel_gazelle//cmd/gazelle", - allow_files = True, - single_file = True, executable = True, cfg = "host", ), diff --git a/proto/compiler.bzl b/proto/compiler.bzl index e24deaa668..e6fc095dfc 100644 --- a/proto/compiler.bzl +++ b/proto/compiler.bzl @@ -98,9 +98,9 @@ def _go_proto_compiler_impl(ctx): compile = go_proto_compile, options = ctx.attr.options, suffix = ctx.attr.suffix, - go_protoc = ctx.file._go_protoc, - protoc = ctx.file._protoc, - plugin = ctx.file.plugin, + go_protoc = ctx.executable._go_protoc, + protoc = ctx.executable._protoc, + plugin = ctx.executable.plugin, valid_archive = ctx.attr.valid_archive, import_path_option = ctx.attr.import_path_option, ), @@ -117,22 +117,17 @@ go_proto_compiler = go_rule( "valid_archive": attr.bool(default = True), "import_path_option": attr.bool(default = True), "plugin": attr.label( - allow_files = True, - single_file = True, + allow_single_file = True, executable = True, cfg = "host", default = "@com_github_golang_protobuf//protoc-gen-go", ), "_go_protoc": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "@io_bazel_rules_go//go/tools/builders:go-protoc", ), "_protoc": attr.label( - allow_files = True, - single_file = True, executable = True, cfg = "host", default = "@com_google_protobuf//:protoc", diff --git a/proto/gogo.bzl b/proto/gogo.bzl index 41d3258629..237d9d5e46 100644 --- a/proto/gogo.bzl +++ b/proto/gogo.bzl @@ -34,6 +34,6 @@ proto_library( gogo_special_proto = repository_rule( _gogo_special_proto_impl, attrs = { - "proto": attr.label(single_file = True), + "proto": attr.label(allow_single_file = True), }, ) diff --git a/tests/bazel_tests.bzl b/tests/bazel_tests.bzl index cd320bf6e7..180a75321a 100644 --- a/tests/bazel_tests.bzl +++ b/tests/bazel_tests.bzl @@ -233,8 +233,7 @@ _bazel_test_script = go_rule( ), "clean_build": attr.bool(default = False), "bazelrc": attr.label( - allow_files = True, - single_file = True, + allow_single_file = True, default = "@bazel_test//:standalone_bazelrc", ), "_settings": attr.label(default = "@bazel_test//:settings"), @@ -289,7 +288,7 @@ def _md5_sum_impl(ctx): inputs = ctx.files.srcs, outputs = [out], mnemonic = "GoMd5sum", - executable = ctx.file._md5sum, + executable = ctx.executable._md5sum, arguments = [arguments], ) return struct(files = depset([out])) @@ -299,9 +298,9 @@ md5_sum = go_rule( attrs = { "srcs": attr.label_list(allow_files = True), "_md5sum": attr.label( - allow_files = True, - single_file = True, + executable = True, default = "@io_bazel_rules_go//go/tools/builders:md5sum", + cfg = "host", ), }, ) diff --git a/tests/legacy/examples/cgo/example_command/generate_test.bzl b/tests/legacy/examples/cgo/example_command/generate_test.bzl index 53ceee7ac1..c3c991dfbc 100644 --- a/tests/legacy/examples/cgo/example_command/generate_test.bzl +++ b/tests/legacy/examples/cgo/example_command/generate_test.bzl @@ -11,8 +11,7 @@ generate_script = rule( _generate_script_impl, attrs = { "binary": attr.label( - allow_files = True, - single_file = True, + allow_single_file = True, ), }, )