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

Mark go_sdk module extension as {os,arch}_dependent #3703

Merged
merged 2 commits into from
Sep 20, 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
1 change: 1 addition & 0 deletions MODULE.bazel
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ module(
repo_name = "io_bazel_rules_go",
)

bazel_dep(name = "bazel_features", version = "1.1.0")
bazel_dep(name = "bazel_skylib", version = "1.2.0")
bazel_dep(name = "platforms", version = "0.0.4")
bazel_dep(name = "rules_proto", version = "4.0.0")
Expand Down
9 changes: 9 additions & 0 deletions go/private/extensions.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@
# See the License for the specific language governing permissions and
# limitations under the License.

load("@bazel_features//:features.bzl", "bazel_features")
load("//go/private:sdk.bzl", "detect_host_platform", "go_download_sdk_rule", "go_host_sdk_rule", "go_multiple_toolchains")
load("//go/private:repositories.bzl", "go_rules_dependencies")

Expand Down Expand Up @@ -207,12 +208,20 @@ def _left_pad_zero(index, length):
fail("index must be non-negative")
return ("0" * length + str(index))[-length:]

go_sdk_extra_kwargs = {
# The choice of a host-compatible SDK is expressed in repository rule attribute values and
# depends on host OS and architecture.
"os_dependent": True,
"arch_dependent": True,
} if bazel_features.external_deps.module_extension_has_os_arch_dependent else {}

go_sdk = module_extension(
implementation = _go_sdk_impl,
tag_classes = {
"download": _download_tag,
"host": _host_tag,
},
**go_sdk_extra_kwargs
)

def _non_module_dependencies_impl(_ctx):
Expand Down