mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-01-22 21:31:14 -05:00
22d093cc6f
* deps: update bazel (core) * bazel: depset -> list To comply with some breaking changes in rules_go v0.51, we explicitly need to type-cast the depsets to lists here. * bazel: migrate deprecated GoLibrary usage In rules_go v0.51.0, `GoLibrary` was deprecated and replaced by `GoInfo`. This adjusts our `protoc-gen-go` rule to use the new `GoInfo`. * deps: tidy all modules --------- Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> Co-authored-by: Moritz Sanft <58110325+msanft@users.noreply.github.com> Co-authored-by: edgelessci <edgelessci@users.noreply.github.com>
30 lines
934 B
Python
30 lines
934 B
Python
"""
|
|
Go toolchain for the host platformS
|
|
Inspired by https://github.com/bazel-contrib/rules_go/blob/6e4fdcfeb1a333b54ab39ae3413d4ded46d8958d/go/private/rules/go_bin_for_host.bzl
|
|
"""
|
|
|
|
load("@local_config_platform//:constraints.bzl", "HOST_CONSTRAINTS")
|
|
|
|
GO_TOOLCHAIN = "@io_bazel_rules_go//go:toolchain"
|
|
|
|
def _ensure_target_cfg(ctx):
|
|
if "-exec" in ctx.bin_dir.path or "/host/" in ctx.bin_dir.path:
|
|
fail("exec not found")
|
|
|
|
def _go_bin_for_host_impl(ctx):
|
|
_ensure_target_cfg(ctx)
|
|
sdk = ctx.toolchains[GO_TOOLCHAIN].sdk
|
|
sdk_files = ctx.runfiles([sdk.go] + sdk.headers.to_list() + sdk.libs.to_list() + sdk.srcs.to_list() + sdk.tools.to_list())
|
|
return [
|
|
DefaultInfo(
|
|
files = depset([sdk.go]),
|
|
runfiles = sdk_files,
|
|
),
|
|
]
|
|
|
|
go_bin_for_host = rule(
|
|
implementation = _go_bin_for_host_impl,
|
|
toolchains = [GO_TOOLCHAIN],
|
|
exec_compatible_with = HOST_CONSTRAINTS,
|
|
)
|