Skip to content

Commit aaaf4bf

Browse files
authored
chore: rename release artifacts to match rust convention (#285)
### Type of change - Refactor (a code change that neither fixes a bug or adds a new feature) ### Test plan - Manual testing; please provide instructions so we can reproduce: ``` bazel build py/tools/unpack_bin:linux Target //py/tools/unpack_bin:linux up-to-date: bazel-bin/py/tools/unpack_bin/unpack-aarch64-unknown-linux-gnu bazel-bin/py/tools/unpack_bin/unpack-aarch64-unknown-linux-gnu.sha256 bazel-bin/py/tools/unpack_bin/unpack-x86_64-unknown-linux-gnu bazel-bin/py/tools/unpack_bin/unpack-x86_64-unknown-linux-gnu.sha256 ```
1 parent 25c5ceb commit aaaf4bf

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

tools/release/defs.bzl

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,17 @@
11
"Make releases for platforms supported by rules_py"
22

3-
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
43
load("@aspect_bazel_lib//lib:copy_file.bzl", "copy_file")
4+
load("@aspect_bazel_lib//lib:transitions.bzl", "platform_transition_filegroup")
55
load("@aspect_bazel_lib//tools/release:hashes.bzl", "hashes")
66

7+
def _map_os_to_triple(os):
8+
if os == "linux":
9+
# TODO: when we produce musl-linked binaries, this should change to unknown-linux-musl
10+
return "unknown-linux-gnu"
11+
if os == "macos":
12+
return "apple-darwin"
13+
fail("unrecognized os", os)
14+
715
# buildozer: disable=function-docstring
816
def multi_arch_rust_binary_release(name, src, os, archs = ["aarch64", "x86_64"], **kwargs):
917
outs = []
@@ -16,7 +24,8 @@ def multi_arch_rust_binary_release(name, src, os, archs = ["aarch64", "x86_64"],
1624
target_compatible_with = ["@platforms//os:{}".format(os)],
1725
)
1826

19-
artifact = "{}-{}-{}".format(bin, os, arch)
27+
# Artifact naming follows typical Rust "triples" convention.
28+
artifact = "{}-{}-{}".format(bin, arch, _map_os_to_triple(os))
2029
outs.append(artifact)
2130
copy_file(
2231
name = "copy_{}_{}_{}".format(bin, os, arch),

0 commit comments

Comments
 (0)