Skip to content

Commit b5050b6

Browse files
author
Karim Alweheshy
committed
Add missing copts and linkopts to proto swift libs
1 parent 1bc8f27 commit b5050b6

File tree

1 file changed

+12
-1
lines changed

1 file changed

+12
-1
lines changed

proto/swift_proto_utils.bzl

Lines changed: 12 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,6 +37,8 @@ load(
3737
# buildifier: disable=bzl-visibility
3838
load(
3939
"//swift/internal:utils.bzl",
40+
"expand_locations",
41+
"expand_make_variables",
4042
"get_providers",
4143
"include_developer_search_paths",
4244
)
@@ -258,12 +260,20 @@ def compile_swift_protos_for_target(
258260
unsupported_features = ctx.disabled_features,
259261
)
260262

263+
# These can't use additional_inputs since expand_locations needs targets,
264+
# not files.
265+
copts = expand_locations(ctx, getattr(attr, "copts", []), ctx.attr.swiftc_inputs)
266+
copts = expand_make_variables(ctx, copts, "copts")
267+
linkopts = expand_locations(ctx, getattr(attr, "linkopts", []), ctx.attr.swiftc_inputs)
268+
linkopts = expand_make_variables(ctx, linkopts, "linkopts")
269+
261270
# Compile the generated Swift source files as a module:
262271
include_dev_srch_paths = include_developer_search_paths(attr)
263272
compile_result = swift_common.compile(
264273
actions = ctx.actions,
265274
cc_infos = get_providers(compiler_deps, CcInfo),
266-
copts = ["-parse-as-library"] + getattr(attr, "copts", []),
275+
defines = ctx.attr.defines,
276+
copts = ["-parse-as-library"] + copts,
267277
feature_configuration = feature_configuration,
268278
include_dev_srch_paths = include_dev_srch_paths,
269279
module_name = module_name,
@@ -294,6 +304,7 @@ def compile_swift_protos_for_target(
294304
],
295305
module_context = module_context,
296306
swift_toolchain = swift_toolchain,
307+
user_link_flags = linkopts,
297308
)
298309
)
299310

0 commit comments

Comments
 (0)