Skip to content

Commit c3d6068

Browse files
committed
Apply default target platform to library aliases
1 parent 696c302 commit c3d6068

1 file changed

Lines changed: 13 additions & 12 deletions

File tree

defs.bzl

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -54,18 +54,6 @@ def rust_bootstrap_library(
5454
target_compatible_with = None,
5555
visibility = None,
5656
**kwargs):
57-
target_compatible_with = target_compatible_with or _target_constraints(crate_root)
58-
59-
if name.endswith("-0.0.0"):
60-
versioned_name = name
61-
name = name.removesuffix("-0.0.0")
62-
native.alias(
63-
name = versioned_name,
64-
actual = ":{}".format(name),
65-
target_compatible_with = target_compatible_with,
66-
)
67-
visibility = ["PUBLIC"]
68-
6957
extra_deps = []
7058
extra_env = {}
7159
extra_rustc_flags = []
@@ -92,6 +80,19 @@ def rust_bootstrap_library(
9280
default_target_platform = None
9381
extra_rustc_flags.append("--cap-lints=allow")
9482

83+
target_compatible_with = target_compatible_with or _target_constraints(crate_root)
84+
85+
if name.endswith("-0.0.0"):
86+
versioned_name = name
87+
name = name.removesuffix("-0.0.0")
88+
native.alias(
89+
name = versioned_name,
90+
actual = ":{}".format(name),
91+
default_target_platform = default_target_platform,
92+
target_compatible_with = target_compatible_with,
93+
)
94+
visibility = ["PUBLIC"]
95+
9596
if proc_macro:
9697
rust_proc_macro_alias(
9798
name = name,

0 commit comments

Comments
 (0)