Skip to content

Stop propagating duplicate SwiftUsageInfo providers from swift_usage_aspect#306

Merged
swiple-rules-gardener merged 1 commit intobazelbuild:masterfrom
kastiglione:dl/stop-propagating-duplicate-swiftusageinfo-providers-from-swift_usage_aspect
Sep 9, 2019
Merged

Stop propagating duplicate SwiftUsageInfo providers from swift_usage_aspect#306
swiple-rules-gardener merged 1 commit intobazelbuild:masterfrom
kastiglione:dl/stop-propagating-duplicate-swiftusageinfo-providers-from-swift_usage_aspect

Conversation

@kastiglione
Copy link
Copy Markdown
Contributor

@kastiglione kastiglione commented Sep 9, 2019

With the changes in bazelbuild/rules_apple#566, the swift_usage_aspect needs to handle a new case.

If a rule and an aspect both provide the same provider type, bazel raises this error:

src/main/java/com/google/devtools/build/lib/analysis/configuredtargets/MergedConfiguredTarget.java#L167

This changes swift_usage_aspect to not propagate a SwiftUsageInfo if the target already does. Specifically, this makes the updated apple_static_framework_import work in apps that have other swift deps.

Copy link
Copy Markdown
Contributor

@sergiocampama sergiocampama left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this looks reasonable to me, but I'll defer to Tony, since perhaps he didn't intend for this to be a use case, in which case, we'll need to figure out another path

Copy link
Copy Markdown
Member

@allevato allevato left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It makes sense to do this, since some custom rules may need to indicate that they "use Swift" in ways that the aspect can't otherwise detect.

Honestly, if provider already there: return [] should probably be present at the beginning of 99% of aspect implementation functions anyway.

swiple-rules-gardener added a commit that referenced this pull request Sep 9, 2019
…e-swiftusageinfo-providers-from-swift_usage_aspect

PiperOrigin-RevId: 267991298
@swiple-rules-gardener swiple-rules-gardener merged commit 0b17773 into bazelbuild:master Sep 9, 2019
@kastiglione kastiglione deleted the dl/stop-propagating-duplicate-swiftusageinfo-providers-from-swift_usage_aspect branch September 9, 2019 15:15
tymurmustafaiev pushed a commit to tymurmustafaiev/rules_swift that referenced this pull request Jul 19, 2023
…g-duplicate-swiftusageinfo-providers-from-swift_usage_aspect

PiperOrigin-RevId: 267991298
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

5 participants