Skip to content

Commit 213c4f3

Browse files
fmeumjacqueline.lee
authored andcommitted
Revert "Add automatic platform detection from inbound crosstool_top and cpu (bazel-contrib#2859)" (bazel-contrib#3468)
This reverts commit 026db6d. Bazel is migrating to platforms and toolchains resolution, but this logic frequently reset platforms back based on the value of the legacy `--cpu` and `--crosstool_top` flags. Instead, users of rules that still rely on these flags should use the `platform_mappings` file.
1 parent 94700a0 commit 213c4f3

File tree

4 files changed

+0
-88
lines changed

4 files changed

+0
-88
lines changed

go/platform/BUILD.bazel

Lines changed: 0 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,3 @@ bzl_library(
3636
name = "apple",
3737
srcs = ["apple.bzl"],
3838
)
39-
40-
bzl_library(
41-
name = "crosstool",
42-
srcs = ["crosstool.bzl"],
43-
)

go/platform/crosstool.bzl

Lines changed: 0 additions & 60 deletions
This file was deleted.

go/private/rules/BUILD.bazel

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -144,7 +144,6 @@ bzl_library(
144144
"//proto:__pkg__",
145145
],
146146
deps = [
147-
"//go/platform:crosstool",
148147
"//go/private:mode",
149148
"//go/private:platforms",
150149
"//go/private:providers",

go/private/rules/transition.bzl

Lines changed: 0 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -32,13 +32,6 @@ load(
3232
"GoLibrary",
3333
"GoSource",
3434
)
35-
load(
36-
"//go/platform:crosstool.bzl",
37-
"platform_from_crosstool",
38-
)
39-
40-
_DEFAULT_PLATFORMS_VALUE = [Label("@local_config_platform//:host")]
41-
_PLATFORMS_LABEL = "//command_line_option:platforms"
4235

4336
# A list of rules_go settings that are possibly set by go_transition.
4437
# Keep their package name in sync with the implementation of
@@ -101,8 +94,6 @@ def _go_transition_impl(settings, attr):
10194

10295
goos = getattr(attr, "goos", "auto")
10396
goarch = getattr(attr, "goarch", "auto")
104-
crosstool_top = settings.pop("//command_line_option:crosstool_top")
105-
cpu = settings.pop("//command_line_option:cpu")
10697
_check_ternary("pure", pure)
10798
if goos != "auto" or goarch != "auto":
10899
if goos == "auto":
@@ -115,17 +106,6 @@ def _go_transition_impl(settings, attr):
115106
fail('pure is "off" but cgo is not supported on {} {}'.format(goos, goarch))
116107
platform = "@io_bazel_rules_go//go/toolchain:{}_{}{}".format(goos, goarch, "_cgo" if cgo else "")
117108
settings["//command_line_option:platforms"] = platform
118-
else:
119-
# If the current target platform differs from the default value (the
120-
# host platform), then we don't want to override it with a value
121-
# inferred from the legacy --cpu and --crosstool_top flags. Otherwise
122-
# it would become impossible to "platformize" a Go build without having
123-
# a matching platform mappings file.
124-
if settings[_PLATFORMS_LABEL] == _DEFAULT_PLATFORMS_VALUE:
125-
# Detect the platform the inbound crosstool/cpu.
126-
platform = platform_from_crosstool(crosstool_top, cpu)
127-
if platform:
128-
settings[_PLATFORMS_LABEL] = platform
129109

130110
tags = getattr(attr, "gotags", [])
131111
if tags:
@@ -181,8 +161,6 @@ request_nogo_transition = transition(
181161
go_transition = transition(
182162
implementation = _go_transition_impl,
183163
inputs = [
184-
"//command_line_option:cpu",
185-
"//command_line_option:crosstool_top",
186164
"//command_line_option:platforms",
187165
] + TRANSITIONED_GO_SETTING_KEYS,
188166
outputs = [

0 commit comments

Comments
 (0)