Skip to content

Commit 46a767a

Browse files
committed
Reuse shared transition helpers
Co-authored-by: Copilot App <223556219+Copilot@users.noreply.github.com> Copilot-Session: a52f212e-fee3-4245-a5fc-e5be4cdf2cdf
1 parent 693c0f3 commit 46a767a

3 files changed

Lines changed: 22 additions & 48 deletions

File tree

misc/bazel/rust.bzl

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
load("@rules_rust//rust:defs.bzl", "rust_binary")
22
load("@semmle_code//buildutils-internal:glibc_symbols_check.bzl", "glibc_symbols_check")
33
load("@semmle_code//buildutils-internal:lipo.bzl", "universal_binary")
4-
load("//misc/bazel:transitions.bzl", "forward_binary_from_transition", "get_transition_attrs")
4+
load("@semmle_code//buildutils-internal:transitions.bzl", "forward_binary_from_transition", "get_transition_attrs")
55

66
def _full_lto_transition_impl(_settings, _attr):
77
return {"@rules_rust//rust/settings:lto": "fat"}
Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,21 @@
1+
def forward_binary_from_transition(ctx):
2+
default_info = ctx.attr.dep[0][DefaultInfo]
3+
original_executable = default_info.files_to_run.executable
4+
executable = ctx.actions.declare_file(ctx.label.name)
5+
ctx.actions.symlink(
6+
output = executable,
7+
target_file = original_executable,
8+
is_executable = True,
9+
)
10+
return [DefaultInfo(
11+
executable = executable,
12+
runfiles = default_info.default_runfiles,
13+
)]
14+
15+
def get_transition_attrs(transition_rule):
16+
return {
17+
"_allowlist_function_transition": attr.label(
18+
default = "@bazel_tools//tools/allowlists/function_transition_allowlist",
19+
),
20+
"dep": attr.label(mandatory = True, cfg = transition_rule),
21+
}

misc/bazel/transitions.bzl

Lines changed: 0 additions & 47 deletions
This file was deleted.

0 commit comments

Comments
 (0)