Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[SR-14337] Swift Package Resources Not Found Under Test #4446

Open
jsorge opened this issue Mar 11, 2021 · 5 comments
Open

[SR-14337] Swift Package Resources Not Found Under Test #4446

jsorge opened this issue Mar 11, 2021 · 5 comments
Labels

Comments

@jsorge
Copy link

jsorge commented Mar 11, 2021

Previous ID SR-14337
Radar rdar://problem/75364848
Original Reporter @jsorge
Type Bug

Attachment: Download

Additional Detail from JIRA
Votes 1
Component/s Package Manager
Labels Bug
Assignee None
Priority Medium

md5: 494aa024e80ea736ccce56d26988d77a

Issue Description:

I'm encountering a fatal error when running tests on a framework which depends on a Swift Package that is trying to load its resource bundle using `Bundle.module`. Attached is a sample project that can reproduce the error by running the tests on the PhoneEntryKit target.

Setup:

  • PhoneEntryKit framework depends on PhoneNumberKit Swift Package

  • PhoneEntryKitTest target uses PhoneNumberEntry app as its test host

  • PhoneEntryKit uses a type from PhoneNumberKit which attempts to load a resource from the resource bundle generated by Swift Package Manager.

What happens:

The built products when running the tests in Xcode yields the xctest bundle inside of the test host's Plugins directory, but the generated accessor for `Bundle.module` doesn't account for that situation, which leads to the fatal error (https://github.com/apple/swift-package-manager/blob/1f2eda34deec3c92b97d116f192fd734657c4613/Sources/Build/BuildPlan.swift#L639).

I've tried this both in Xcode 12.4 as well as 12.5 beta 3.

@typesanitizer
Copy link

@swift-ci create

@neonichu
Copy link
Member

Just a note: the code from `BuildPlan` is not relevant when building packages in Xcode since they use Xcode's own build system in that case.

@jsorge
Copy link
Author

jsorge commented Mar 12, 2021

Oh interesting, so is this more of an Xcode bug in that case?

@neonichu
Copy link
Member

Yes, but no need to file again. We will track the Xcode bug using the synced rdar://problem/75364848

@Mordil
Copy link

Mordil commented Apr 20, 2021

This seems to be fixed with Xcode 12.5 RC (12E262)

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

5 participants