@@ -95,17 +95,21 @@ def _register_static_library_link_action(
95
95
)
96
96
97
97
def register_libraries_to_link (
98
+ owning_label ,
98
99
actions ,
99
100
alwayslink ,
100
101
cc_feature_configuration ,
101
102
is_dynamic ,
102
103
is_static ,
103
104
library_name ,
104
105
objects ,
105
- swift_toolchain ):
106
+ swift_toolchain ,
107
+ user_link_flags ,
108
+ additional_inputs ):
106
109
"""Declares the requested libraries and registers actions to link them.
107
110
108
111
Args:
112
+ owning_label: Label executing rule (i.e., ctx.label).
109
113
actions: The object used to register actions.
110
114
alwayslink: If True, create a static library that should be
111
115
always-linked (having a `.lo` extension instead of `.a`). This
@@ -120,9 +124,11 @@ def register_libraries_to_link(
120
124
linked.
121
125
swift_toolchain: The Swift toolchain provider to use when constructing
122
126
the action.
127
+ user_link_flags: Extra link flags to be passed with the library.
128
+ additional_inputs: Extra inputs for a link action involving the library.
123
129
124
130
Returns:
125
- A `LibraryToLink ` object containing the libraries that were created.
131
+ A `LinkerInput ` object containing the libraries that were created.
126
132
"""
127
133
dynamic_library = None
128
134
if is_dynamic :
@@ -145,16 +151,24 @@ def register_libraries_to_link(
145
151
else :
146
152
static_library = None
147
153
148
- return cc_common .create_library_to_link (
149
- actions = actions ,
150
- alwayslink = alwayslink ,
151
- cc_toolchain = swift_toolchain .cc_toolchain_info ,
152
- feature_configuration = cc_feature_configuration ,
153
- pic_static_library = static_library ,
154
- dynamic_library = dynamic_library ,
154
+ return cc_common .create_linker_input (
155
+ owner = owning_label ,
156
+ libraries = depset (direct = [
157
+ cc_common .create_library_to_link (
158
+ actions = actions ,
159
+ alwayslink = alwayslink ,
160
+ cc_toolchain = swift_toolchain .cc_toolchain_info ,
161
+ feature_configuration = cc_feature_configuration ,
162
+ pic_static_library = static_library ,
163
+ dynamic_library = dynamic_library ,
164
+ ),
165
+ ]),
166
+ additional_inputs = depset (direct = additional_inputs ),
167
+ user_link_flags = depset (direct = user_link_flags ),
155
168
)
156
169
157
170
def register_link_binary_action (
171
+ owning_label ,
158
172
actions ,
159
173
additional_inputs ,
160
174
additional_linking_contexts ,
@@ -170,6 +184,7 @@ def register_link_binary_action(
170
184
"""Registers an action that invokes the linker to produce a binary.
171
185
172
186
Args:
187
+ owning_label: Label of the rule creating the link action.
173
188
actions: The object used to register actions.
174
189
additional_inputs: A list of additional inputs to the link action,
175
190
such as those used in `$(location ...)` substitution, linker
@@ -231,7 +246,12 @@ def register_link_binary_action(
231
246
232
247
linking_contexts .append (
233
248
cc_common .create_linking_context (
234
- user_link_flags = dep_link_flags ,
249
+ linker_inputs = depset (direct = [
250
+ cc_common .create_linker_input (
251
+ owner = owning_label ,
252
+ user_link_flags = depset (direct = dep_link_flags ),
253
+ ),
254
+ ])
235
255
),
236
256
)
237
257
0 commit comments