-
Notifications
You must be signed in to change notification settings - Fork 1.4k
[SR-13560] swiftpm: SWIFTPM_MODULE_BUNDLE returning nil #4500
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
Comments
@swift-ci create |
also experiencing a related issue with an all Swift Package: SR-13714 |
With 5.5 I'm still getting My most recent attempt is on https://github.com/thomasvl/gtm-session-fetcher/tree/swiftpm_updates. |
Notice that this introduces an error when running `swift test`: ``` $ swift test Building for debugging... /Users/gio/Developer/a8c/tracks-apple-pod/Sources/Model/ObjC/Common/Core Data/TracksContextManager.m:24:24: error: use of undeclared identifier 'SWIFTPM_MODULE_BUNDLE' NSBundle *bundle = SWIFTPM_MODULE_BUNDLE; ^ 1 error generated. [0/6] Compiling TracksContextManager.m error: fatalError ``` This is a known Swift Package Manager issue. See: - swiftlang/swift-package-manager#4500 - https://forums.swift.org/t/5-3-resources-support-not-working-on-with-swift-test/40381 However, `bundle exec fastlane test`, which uses `xcodebuild` under the hood, works. Given our workflow is based on Xcode locally and Fastlane in CI, the regression seems acceptable. The reason I'm keen to upgrade to 5.5 is that it's the required tooling version to integrate Buildkite's Test Analytics. See https://github.com/buildkite/test-collector-swift/blob/v0.1.0/Package.swift#L1
We run into this issue, too, with 5.5. It can be verified by checking out this commit. For what is worth, |
Looks like the implementation is
IIRC, the main bundle when executing tests is the test runner, so it makes sense that this would return nil. In Xcode's build system, a more comprehensive implementation is generated that is similar to what we do for Swift. |
…5921) motivation: I noticed an issue when trying to access a Clang package's resources when testing the target from the SwiftPM CLI. In short, the resource bundle is placed in the same place when building a Clang-only or Swift-only package, but the generated resource_bundle_accessor.m's logic tries to create an NSBundle for a path that DNE. The difference becomes clear when comparing the logic to the resource_bundle_accessor.swift that is generated from Swift-only packages with resources.
Additional Detail from JIRA
md5: 54f1a590f07af2575ba60b5ea19e1321
is duplicated by:
Issue Description:
An all ObjC package is getting
nil
fromSWIFTPM_MODULE_BUNDLE
when usingswift test
, but if thePackage.swift
is directly opened in Xcode 12, then the tests pass as the bundle is returned.Project: https://github.com/google/gtm-session-fetcher
Commit attempt to move the 5.3 Resource support: thomasvl/gtm-session-fetcher@f38d107
Raised in https://forums.swift.org/t/5-3-resources-support-not-working-on-with-swift-test/40381
The text was updated successfully, but these errors were encountered: