Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update deprecated single_file -> allow_single_file attribute #1628

Merged
Merged
Show file tree
Hide file tree
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions extras/bindata.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 [
Expand All @@ -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 = Label("@com_github_kevinburke_go_bindata//go-bindata:go-bindata"),
Expand Down
14 changes: 0 additions & 14 deletions go/private/rules/builders.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
3 changes: 1 addition & 2 deletions go/private/rules/cgo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
Expand Down
1 change: 0 additions & 1 deletion go/private/rules/info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,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(
Expand Down
6 changes: 2 additions & 4 deletions go/private/tools/files_equal_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 2 additions & 4 deletions go/private/tools/gazelle.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -47,12 +47,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(
Expand Down Expand Up @@ -85,8 +85,6 @@ _gazelle_script = go_rule(
"prefix": attr.string(),
"_gazelle": attr.label(
default = Label("@bazel_gazelle//cmd/gazelle"),
allow_files = True,
single_file = True,
executable = True,
cfg = "host",
),
Expand Down
13 changes: 4 additions & 9 deletions proto/compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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,
),
Expand All @@ -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 = Label("@com_github_golang_protobuf//protoc-gen-go"),
),
"_go_protoc": attr.label(
allow_files = True,
single_file = True,
executable = True,
cfg = "host",
default = Label("@io_bazel_rules_go//go/tools/builders:go-protoc"),
),
"_protoc": attr.label(
allow_files = True,
single_file = True,
executable = True,
cfg = "host",
default = Label("@com_google_protobuf//:protoc"),
Expand Down
2 changes: 1 addition & 1 deletion proto/gogo.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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),
},
)
11 changes: 5 additions & 6 deletions tests/bazel_tests.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -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 = Label("@bazel_test//:settings")),
Expand Down Expand Up @@ -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]))
Expand All @@ -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,
default = Label("@io_bazel_rules_go//go/tools/builders:md5sum"),
executable = True,
default = "@io_bazel_rules_go//go/tools/builders:md5sum",
cfg = "host",
),
},
)
Expand Down
3 changes: 1 addition & 2 deletions tests/legacy/examples/cgo/example_command/generate_test.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,7 @@ generate_script = rule(
_generate_script_impl,
attrs = {
"binary": attr.label(
allow_files = True,
single_file = True,
allow_single_file = True,
),
},
)