Skip to content

Commit

Permalink
Update go_toolchain to use execution transitons. (#2286)
Browse files Browse the repository at this point in the history
  • Loading branch information
katre authored and Jay Conrod committed Jan 9, 2020
1 parent 8691abe commit 88bc72a
Show file tree
Hide file tree
Showing 6 changed files with 10 additions and 9 deletions.
3 changes: 2 additions & 1 deletion go/private/go_toolchain.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ go_toolchain = rule(
# Minimum requirements to specify a toolchain
"builder": attr.label(
mandatory = True,
cfg = "host",
cfg = "exec",
executable = True,
doc = "Tool used to execute most Go actions",
),
Expand All @@ -77,6 +77,7 @@ go_toolchain = rule(
"sdk": attr.label(
mandatory = True,
providers = [GoSDK],
cfg = "exec",
doc = "The SDK this toolchain is based on",
),
# Optional extras to a toolchain
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/info.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ _go_info = go_rule(
attrs = {
"_go_info": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = "@io_bazel_rules_go//go/tools/builders:info",
),
},
Expand Down
2 changes: 1 addition & 1 deletion go/private/rules/rule.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ def go_rule(implementation, attrs = None, toolchains = None, bootstrap = False,
toolchains = toolchains + ["@io_bazel_rules_go//go:toolchain"]

if "_nogo" in bootstrap_attrs:
attrs["_nogo"] = attr.label(default = Label("@io_bazel_rules_nogo//:nogo"), cfg = "host")
attrs["_nogo"] = attr.label(default = Label("@io_bazel_rules_nogo//:nogo"), cfg = "exec")
if "_coverdata" in bootstrap_attrs:
attrs["_coverdata"] = attr.label(default = "@io_bazel_rules_go//go/tools/coverdata", aspects = aspects)
if "_stdlib" in bootstrap_attrs:
Expand Down
4 changes: 2 additions & 2 deletions go/private/rules/sdk.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -71,15 +71,15 @@ go_sdk = rule(
),
"tools": attr.label_list(
allow_files = True,
cfg = "host",
cfg = "exec",
doc = ("List of executable files in the SDK built for " +
"the execution platform, excluding the go binary"),
),
"go": attr.label(
mandatory = True,
allow_single_file = True,
executable = True,
cfg = "host",
cfg = "exec",
doc = "The go binary",
),
},
Expand Down
2 changes: 1 addition & 1 deletion go/private/tools/path.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ go_path = rule(
"_go_path": attr.label(
default = "@io_bazel_rules_go//go/tools/builders:go_path",
executable = True,
cfg = "host",
cfg = "exec",
),
},
)
Expand Down
6 changes: 3 additions & 3 deletions proto/compiler.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -162,17 +162,17 @@ go_proto_compiler = go_rule(
"plugin": attr.label(
allow_single_file = True,
executable = True,
cfg = "host",
cfg = "exec",
default = "@com_github_golang_protobuf//protoc-gen-go",
),
"_go_protoc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = "@io_bazel_rules_go//go/tools/builders:go-protoc",
),
"_protoc": attr.label(
executable = True,
cfg = "host",
cfg = "exec",
default = "@com_google_protobuf//:protoc",
),
},
Expand Down

0 comments on commit 88bc72a

Please sign in to comment.