From 88bc72a453ec803605bb88a982d33931843d2707 Mon Sep 17 00:00:00 2001 From: katre Date: Thu, 9 Jan 2020 10:19:50 -0500 Subject: [PATCH] Update go_toolchain to use execution transitons. (#2286) --- go/private/go_toolchain.bzl | 3 ++- go/private/rules/info.bzl | 2 +- go/private/rules/rule.bzl | 2 +- go/private/rules/sdk.bzl | 4 ++-- go/private/tools/path.bzl | 2 +- proto/compiler.bzl | 6 +++--- 6 files changed, 10 insertions(+), 9 deletions(-) diff --git a/go/private/go_toolchain.bzl b/go/private/go_toolchain.bzl index b10ffa2652..26e7f05efe 100644 --- a/go/private/go_toolchain.bzl +++ b/go/private/go_toolchain.bzl @@ -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", ), @@ -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 diff --git a/go/private/rules/info.bzl b/go/private/rules/info.bzl index f2460edd01..4630bb4b8b 100644 --- a/go/private/rules/info.bzl +++ b/go/private/rules/info.bzl @@ -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", ), }, diff --git a/go/private/rules/rule.bzl b/go/private/rules/rule.bzl index 1fdad7bab9..e88ae9cf41 100644 --- a/go/private/rules/rule.bzl +++ b/go/private/rules/rule.bzl @@ -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: diff --git a/go/private/rules/sdk.bzl b/go/private/rules/sdk.bzl index 7e80a5d29f..8982a9df65 100644 --- a/go/private/rules/sdk.bzl +++ b/go/private/rules/sdk.bzl @@ -71,7 +71,7 @@ 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"), ), @@ -79,7 +79,7 @@ go_sdk = rule( mandatory = True, allow_single_file = True, executable = True, - cfg = "host", + cfg = "exec", doc = "The go binary", ), }, diff --git a/go/private/tools/path.bzl b/go/private/tools/path.bzl index 261b9696a5..2fa7b17bcd 100644 --- a/go/private/tools/path.bzl +++ b/go/private/tools/path.bzl @@ -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", ), }, ) diff --git a/proto/compiler.bzl b/proto/compiler.bzl index a506ef324f..14149d615d 100644 --- a/proto/compiler.bzl +++ b/proto/compiler.bzl @@ -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", ), },