@@ -97,11 +97,11 @@ dwp_file = rule(
9797 },
9898)
9999
100- def _transition_library_to_platform_transition_impl (_ , attr ):
100+ def _transition_to_platform_transition_impl (_ , attr ):
101101 return {"//command_line_option:platforms" : str (attr .platform )}
102102
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 ,
105105 inputs = [],
106106 outputs = ["//command_line_option:platforms" ],
107107)
@@ -114,7 +114,27 @@ def _transition_library_to_platform_impl(ctx):
114114transition_library_to_platform = rule (
115115 implementation = _transition_library_to_platform_impl ,
116116 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+ ),
118138 "platform" : attr .label (mandatory = True ),
119139 "_allowlist_function_transition" : attr .label (
120140 default = "@bazel_tools//tools/allowlists/function_transition_allowlist" ,
0 commit comments