Skip to content

Commit 944063b

Browse files
committed
fix: drop unnecessary DefaultInfo in release_nostrip
The `release_nostrip_binary` rule would copy the `DefaultInfo` of the executable (binary) being transitioned. This is not entirely correct and creates issues in Bazel 8. Moreover, nothing but the resulting release binary should be necessary, so we can resolve the issue by specifying `executable` only. Additionally, the transition function is renamed for consistency.
1 parent d5b32ed commit 944063b

File tree

1 file changed

+5
-8
lines changed

1 file changed

+5
-8
lines changed

publish/defs.bzl

Lines changed: 5 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@ For example, you might want to build some targets with optimizations enabled
44
no matter what the current Bazel flags are.
55
"""
66

7-
def _release_nostrip_transition(_settings, _attr):
7+
def _release_nostrip_transition_impl(_settings, _attr):
88
return {
99
"//command_line_option:compilation_mode": "opt",
1010
"//command_line_option:strip": "never",
1111
"@rules_rust//:extra_rustc_flags": ["-Cdebug-assertions=off"],
1212
}
1313

1414
release_nostrip_transition = transition(
15-
implementation = _release_nostrip_transition,
15+
implementation = _release_nostrip_transition_impl,
1616
inputs = [],
1717
outputs = [
1818
"//command_line_option:compilation_mode",
@@ -22,14 +22,11 @@ release_nostrip_transition = transition(
2222
)
2323

2424
def _release_nostrip_impl(ctx):
25-
bin = ctx.attr.binary[0]
26-
info = bin[DefaultInfo]
27-
28-
executable = ctx.actions.declare_file(ctx.label.name)
29-
ctx.actions.symlink(output = executable, target_file = ctx.file.binary)
25+
release_bin = ctx.actions.declare_file(ctx.label.name)
26+
ctx.actions.symlink(output = release_bin, target_file = ctx.file.binary)
3027

3128
return [
32-
DefaultInfo(files = info.files, runfiles = info.default_runfiles, executable = executable),
29+
DefaultInfo(executable = release_bin),
3330
]
3431

3532
release_nostrip_binary = rule(

0 commit comments

Comments
 (0)