rules/ remove run_under
rules/ were never meant to be added to the release. Now that we are not *running* multi-arch binaries, we can remove the infrastructure that was necessary to do so. I may get back to this -- but we need to dust quite a bit off before that happens.
This commit is contained in:
parent
9779650a78
commit
3630f62053
2
ci/test
2
ci/test
@ -17,7 +17,7 @@ tools/bazel build "$@" \
|
|||||||
--experimental_use_hermetic_linux_sandbox \
|
--experimental_use_hermetic_linux_sandbox \
|
||||||
--sandbox_writable_path="$cache_prefix" \
|
--sandbox_writable_path="$cache_prefix" \
|
||||||
--sandbox_add_mount_pair=/proc \
|
--sandbox_add_mount_pair=/proc \
|
||||||
//test/c:which_libc_linux_amd64_gnu.2.19
|
//test/c:which_libc
|
||||||
|
|
||||||
# then test everything else with the standard sandbox
|
# then test everything else with the standard sandbox
|
||||||
echo "--- bazel test $* ..."
|
echo "--- bazel test $* ..."
|
||||||
|
@ -1,12 +1,7 @@
|
|||||||
# Copyright 2023 Uber Technologies, Inc.
|
# Copyright 2023 Uber Technologies, Inc.
|
||||||
# Licensed under the MIT License
|
# Licensed under the MIT License
|
||||||
|
|
||||||
def _vars_script(env, run_under, cmd):
|
load("@bazel_skylib//lib:paths.bzl", "paths")
|
||||||
ret = ["#!/bin/sh"]
|
|
||||||
for k, v in env.items():
|
|
||||||
ret += ['export {}="{}"'.format(k, v)]
|
|
||||||
ret += ['exec {} {} "$@"'.format(run_under, cmd)]
|
|
||||||
return "\n".join(ret) + "\n" # trailing newline is easier on the eyes
|
|
||||||
|
|
||||||
def _platform_transition_impl(settings, attr):
|
def _platform_transition_impl(settings, attr):
|
||||||
_ignore = settings
|
_ignore = settings
|
||||||
@ -23,22 +18,18 @@ _platform_transition = transition(
|
|||||||
)
|
)
|
||||||
|
|
||||||
def _platform_binary_impl(ctx):
|
def _platform_binary_impl(ctx):
|
||||||
source_info = ctx.attr.src[DefaultInfo]
|
platform_sanitized = ctx.attr.platform.replace("/", "_").replace(":", "_")
|
||||||
|
dst = ctx.actions.declare_file("{}-{}".format(paths.basename(ctx.file.src.path), platform_sanitized))
|
||||||
executable = None
|
src = ctx.file.src
|
||||||
if source_info.files_to_run and source_info.files_to_run.executable:
|
ctx.actions.run_shell(
|
||||||
command = _vars_script(ctx.attr.env, ctx.attr.run_under, source_info.files_to_run.executable.short_path)
|
outputs = [dst],
|
||||||
executable = ctx.actions.declare_file("{}_{}".format(ctx.file.src.basename, ctx.attr.platform))
|
inputs = [src],
|
||||||
ctx.actions.write(
|
command = "cp $1 $2",
|
||||||
output = executable,
|
arguments = [src.path, dst.path],
|
||||||
content = command,
|
)
|
||||||
is_executable = True,
|
|
||||||
)
|
|
||||||
|
|
||||||
return [DefaultInfo(
|
return [DefaultInfo(
|
||||||
executable = executable,
|
files = depset([dst]),
|
||||||
files = depset([executable]),
|
executable = dst,
|
||||||
runfiles = ctx.runfiles(files = ctx.files.src),
|
|
||||||
)]
|
)]
|
||||||
|
|
||||||
_attrs = {
|
_attrs = {
|
||||||
@ -50,12 +41,6 @@ _attrs = {
|
|||||||
"platform": attr.string(
|
"platform": attr.string(
|
||||||
doc = "The platform to build the target for.",
|
doc = "The platform to build the target for.",
|
||||||
),
|
),
|
||||||
"run_under": attr.string(
|
|
||||||
doc = "wrapper executable",
|
|
||||||
),
|
|
||||||
"env": attr.string_dict(
|
|
||||||
doc = "Environment variables for the test",
|
|
||||||
),
|
|
||||||
"_allowlist_function_transition": attr.label(
|
"_allowlist_function_transition": attr.label(
|
||||||
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
|
||||||
),
|
),
|
||||||
|
@ -9,15 +9,6 @@ cc_binary(
|
|||||||
tags = ["manual"],
|
tags = ["manual"],
|
||||||
)
|
)
|
||||||
|
|
||||||
# TODO(motiejus): bring back windows tests, not only builds
|
|
||||||
#platform_test(
|
|
||||||
# name = "winver_windows_amd64",
|
|
||||||
# src = "winver",
|
|
||||||
# platform = "//platform:windows_amd64",
|
|
||||||
# run_under = "wine64-stable",
|
|
||||||
# tags = ["no-sandbox"],
|
|
||||||
#)
|
|
||||||
|
|
||||||
platform_binary(
|
platform_binary(
|
||||||
name = "winver_windows_amd64",
|
name = "winver_windows_amd64",
|
||||||
src = "winver",
|
src = "winver",
|
||||||
|
Loading…
Reference in New Issue
Block a user