@@ -97,11 +97,11 @@ dwp_file = rule(
97
97
},
98
98
)
99
99
100
- def _transition_library_to_platform_transition_impl (_ , attr ):
100
+ def _transition_to_platform_transition_impl (_ , attr ):
101
101
return {"//command_line_option:platforms" : str (attr .platform )}
102
102
103
- _transition_library_to_platform_transition = transition (
104
- implementation = _transition_library_to_platform_transition_impl ,
103
+ _transition_to_platform_transition = transition (
104
+ implementation = _transition_to_platform_transition_impl ,
105
105
inputs = [],
106
106
outputs = ["//command_line_option:platforms" ],
107
107
)
@@ -114,7 +114,27 @@ def _transition_library_to_platform_impl(ctx):
114
114
transition_library_to_platform = rule (
115
115
implementation = _transition_library_to_platform_impl ,
116
116
attrs = {
117
- "lib" : attr .label (mandatory = True , cfg = _transition_library_to_platform_transition ),
117
+ "lib" : attr .label (mandatory = True , cfg = _transition_to_platform_transition ),
118
+ "platform" : attr .label (mandatory = True ),
119
+ "_allowlist_function_transition" : attr .label (
120
+ default = "@bazel_tools//tools/allowlists/function_transition_allowlist" ,
121
+ ),
122
+ },
123
+ )
124
+
125
+ def _transition_binary_to_platform_impl (ctx ):
126
+ out = ctx .actions .declare_file (ctx .attr .name )
127
+ ctx .actions .symlink (output = out , target_file = ctx .file .bin )
128
+ return DefaultInfo (files = depset ([out ]))
129
+
130
+ transition_binary_to_platform = rule (
131
+ implementation = _transition_binary_to_platform_impl ,
132
+ attrs = {
133
+ "bin" : attr .label (
134
+ mandatory = True ,
135
+ allow_single_file = True ,
136
+ cfg = _transition_to_platform_transition ,
137
+ ),
118
138
"platform" : attr .label (mandatory = True ),
119
139
"_allowlist_function_transition" : attr .label (
120
140
default = "@bazel_tools//tools/allowlists/function_transition_allowlist" ,
0 commit comments