mirror of
https://github.com/edgelesssys/constellation.git
synced 2025-09-27 20:10:51 -04:00
bazel: use host platform by default (#1434)
This commit is contained in:
parent
0fc15b2393
commit
62e2e70699
9 changed files with 107 additions and 21 deletions
|
@ -3,16 +3,16 @@ load("//bazel/sh:def.bzl", "sh_template")
|
|||
sh_template(
|
||||
name = "devbuild",
|
||||
data = [
|
||||
"//bootstrapper/cmd/bootstrapper",
|
||||
"//bootstrapper/cmd/bootstrapper:bootstrapper_linux_amd64",
|
||||
"//cli:cli_oss_host",
|
||||
"//debugd/cmd/cdbg:cdbg_host",
|
||||
"//upgrade-agent/cmd",
|
||||
"//upgrade-agent/cmd:upgrade_agent_linux_amd64",
|
||||
],
|
||||
substitutions = {
|
||||
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper)",
|
||||
"@@BOOTSTRAPPER@@": "$(rootpath //bootstrapper/cmd/bootstrapper:bootstrapper_linux_amd64)",
|
||||
"@@CDBG@@": "$(rootpath //debugd/cmd/cdbg:cdbg_host)",
|
||||
"@@CLI@@": "$(rootpath //cli:cli_oss_host)",
|
||||
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd)",
|
||||
"@@UPGRADE_AGENT@@": "$(rootpath //upgrade-agent/cmd:upgrade_agent_linux_amd64)",
|
||||
},
|
||||
template = "prepare_developer_workspace.sh.in",
|
||||
visibility = ["//visibility:public"],
|
||||
|
|
49
bazel/go/platform.bzl
Normal file
49
bazel/go/platform.bzl
Normal file
|
@ -0,0 +1,49 @@
|
|||
"""A rule to build a single executable for a specific platform."""
|
||||
|
||||
def _platform_transition_impl(settings, attr):
|
||||
_ignore = settings # @unused
|
||||
return {
|
||||
"//command_line_option:platforms": "{}".format(attr.platform),
|
||||
}
|
||||
|
||||
_platform_transition = transition(
|
||||
implementation = _platform_transition_impl,
|
||||
inputs = [],
|
||||
outputs = [
|
||||
"//command_line_option:platforms",
|
||||
],
|
||||
)
|
||||
|
||||
def _platform_binary_impl(ctx):
|
||||
out = ctx.actions.declare_file("{}_{}".format(ctx.file.target_file.basename, ctx.attr.platform))
|
||||
ctx.actions.symlink(output = out, target_file = ctx.file.target_file)
|
||||
|
||||
return [
|
||||
DefaultInfo(
|
||||
executable = out,
|
||||
files = depset([out]),
|
||||
runfiles = ctx.runfiles(files = ctx.files.target_file),
|
||||
),
|
||||
]
|
||||
|
||||
_attrs = {
|
||||
"platform": attr.string(
|
||||
doc = "The platform to build the target for.",
|
||||
),
|
||||
"target_file": attr.label(
|
||||
allow_single_file = True,
|
||||
mandatory = True,
|
||||
doc = "Target to build.",
|
||||
),
|
||||
"_allowlist_function_transition": attr.label(
|
||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||
),
|
||||
}
|
||||
|
||||
# wrap a single exectable and build it for the specified platform.
|
||||
platform_binary = rule(
|
||||
implementation = _platform_binary_impl,
|
||||
cfg = _platform_transition,
|
||||
attrs = _attrs,
|
||||
executable = True,
|
||||
)
|
Loading…
Add table
Add a link
Reference in a new issue