Skip to content

Commit 95d43d6

Browse files
Karim Alweheshyluispadron
Karim Alweheshy
authored andcommitted
Add missing copts and linkopts to proto swift libs
1 parent c9c9d56 commit 95d43d6

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

proto/swift_proto_utils.bzl

+9-1
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,7 @@ load(
3737
# buildifier: disable=bzl-visibility
3838
load(
3939
"//swift/internal:utils.bzl",
40+
"expand_make_variables",
4041
"get_providers",
4142
"include_developer_search_paths",
4243
)
@@ -258,12 +259,18 @@ def compile_swift_protos_for_target(
258259
unsupported_features = ctx.disabled_features,
259260
)
260261

262+
# These can't use additional_inputs since expand_locations needs targets,
263+
# not files.
264+
copts = expand_make_variables(ctx, getattr(attr, "copts", []), "copts")
265+
linkopts = expand_make_variables(ctx, getattr(attr, "linkopts", []), "linkopts")
266+
261267
# Compile the generated Swift source files as a module:
262268
include_dev_srch_paths = include_developer_search_paths(attr)
263269
compile_result = swift_common.compile(
264270
actions = ctx.actions,
265271
cc_infos = get_providers(compiler_deps, CcInfo),
266-
copts = ["-parse-as-library"] + getattr(attr, "copts", []),
272+
defines = ctx.attr.defines,
273+
copts = ["-parse-as-library"] + copts,
267274
feature_configuration = feature_configuration,
268275
include_dev_srch_paths = include_dev_srch_paths,
269276
module_name = module_name,
@@ -294,6 +301,7 @@ def compile_swift_protos_for_target(
294301
],
295302
module_context = module_context,
296303
swift_toolchain = swift_toolchain,
304+
user_link_flags = linkopts,
297305
)
298306
)
299307

0 commit comments

Comments
 (0)