|
37 | 37 | # buildifier: disable=bzl-visibility
|
38 | 38 | load(
|
39 | 39 | "//swift/internal:utils.bzl",
|
| 40 | + "expand_make_variables", |
40 | 41 | "get_providers",
|
41 | 42 | "include_developer_search_paths",
|
42 | 43 | )
|
@@ -258,12 +259,18 @@ def compile_swift_protos_for_target(
|
258 | 259 | unsupported_features = ctx.disabled_features,
|
259 | 260 | )
|
260 | 261 |
|
| 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 | + |
261 | 267 | # Compile the generated Swift source files as a module:
|
262 | 268 | include_dev_srch_paths = include_developer_search_paths(attr)
|
263 | 269 | compile_result = swift_common.compile(
|
264 | 270 | actions = ctx.actions,
|
265 | 271 | 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, |
267 | 274 | feature_configuration = feature_configuration,
|
268 | 275 | include_dev_srch_paths = include_dev_srch_paths,
|
269 | 276 | module_name = module_name,
|
@@ -294,6 +301,7 @@ def compile_swift_protos_for_target(
|
294 | 301 | ],
|
295 | 302 | module_context = module_context,
|
296 | 303 | swift_toolchain = swift_toolchain,
|
| 304 | + user_link_flags = linkopts, |
297 | 305 | )
|
298 | 306 | )
|
299 | 307 |
|
|
0 commit comments