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

Revert "Add automatic platform detection from inbound crosstool_top a… #3468

Merged
merged 1 commit into from
Apr 19, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
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
5 changes: 0 additions & 5 deletions go/platform/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -36,8 +36,3 @@ bzl_library(
name = "apple",
srcs = ["apple.bzl"],
)

bzl_library(
name = "crosstool",
srcs = ["crosstool.bzl"],
)
60 changes: 0 additions & 60 deletions go/platform/crosstool.bzl

This file was deleted.

1 change: 0 additions & 1 deletion go/private/rules/BUILD.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -144,7 +144,6 @@ bzl_library(
"//proto:__pkg__",
],
deps = [
"//go/platform:crosstool",
"//go/private:mode",
"//go/private:platforms",
"//go/private:providers",
Expand Down
22 changes: 0 additions & 22 deletions go/private/rules/transition.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -32,13 +32,6 @@ load(
"GoLibrary",
"GoSource",
)
load(
"//go/platform:crosstool.bzl",
"platform_from_crosstool",
)

_DEFAULT_PLATFORMS_VALUE = [Label("@local_config_platform//:host")]
_PLATFORMS_LABEL = "//command_line_option:platforms"

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

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

tags = getattr(attr, "gotags", [])
if tags:
Expand Down Expand Up @@ -181,8 +161,6 @@ request_nogo_transition = transition(
go_transition = transition(
implementation = _go_transition_impl,
inputs = [
"//command_line_option:cpu",
"//command_line_option:crosstool_top",
"//command_line_option:platforms",
] + TRANSITIONED_GO_SETTING_KEYS,
outputs = [
Expand Down