Skip to content

Commit

Permalink
Fix copts and linkopts relying on input files
Browse files Browse the repository at this point in the history
In discord@32275ca when the additional_input local variable was introduced, this went from passing `ctx.attr.swiftc_inputs` to passing `ctx.files.swiftc_inputs` into `expand_locations`. This breaks, since the underlying `expand_location` only allows `Target` types, resulting in the following error when passing any file-like target to `swiftc_inputs`:

```
expected type 'Target' for 'targets' element but got type 'File' instead
```

This switches the two `expand_locations` calls back to using `ctx.attr.swiftc_inputs`.
  • Loading branch information
FuegoFro committed May 20, 2019
1 parent 8fbdee0 commit 53cf295
Showing 1 changed file with 4 additions and 2 deletions.
6 changes: 4 additions & 2 deletions swift/internal/swift_library.bzl
Original file line number Diff line number Diff line change
Expand Up @@ -52,8 +52,10 @@ def _maybe_parse_as_library_copts(srcs):

def _swift_library_impl(ctx):
additional_inputs = ctx.files.swiftc_inputs
copts = expand_locations(ctx, ctx.attr.copts, additional_inputs)
linkopts = expand_locations(ctx, ctx.attr.linkopts, additional_inputs)

# These can't use additional_inputs since expand_locations needs targets, not files.
copts = expand_locations(ctx, ctx.attr.copts, ctx.attr.swiftc_inputs)
linkopts = expand_locations(ctx, ctx.attr.linkopts, ctx.attr.swiftc_inputs)
srcs = ctx.files.srcs

module_name = ctx.attr.module_name
Expand Down

0 comments on commit 53cf295

Please sign in to comment.