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