Description
Description
I’m adding SwiftPM support to a CocoaPods framework. Currently, I have the following layout of the repo, and for backward compatibility, I can’t move files around.
Repo root/
|
|-- Sources/
| |
| |-- SourceFile.swift
|
|-- Resources/
| |
| |-- Assets.xcassets/
| |
| |-- en.lproj/
| | |
| | |-- Localizable.strings
| |
| |-- es.lproj/
| | |
| | |-- Localizable.strings
Because of this layout, I have to manually point Package.swift
to the resources.
When I use the resources: [.process("../Resources/")]
parameter, package resolution seemingly succeeds. However, attempts to access Bundle.module
in code result in a build-time error that reads:
Type 'Bundle' has no member 'module'
I also tried to fix this by creating a symbolic link (Sources/Resources → Resources
) but this resulted in Xcode hung while resolving the package.
For debugging, I moved the resources to the expected location in Sources
and removed the resources
parameter from Package.swift
. Now package resolution fails—but it tells the real reason Bundle.module
was unavailable:
manifest property 'defaultLocalization' not set; it is required in the presence of localized resources
With the resources moved to the original location and the defaultLocalization
parameter present in Package.swift
, Bundle.module
is now available.
Expected behavior
Package resolution fails, pointing to the actual reason resources were not resolved (no defaultLocalization
specified). No building should be needed to find out about the error.
Actual behavior
Package resolution succeeds, but building the library doesn’t. The compiler output is confusing because package resolution doesn’t report any issues.
Steps to reproduce
No response
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.9.0
Swift & OS version (output of swift --version ; uname -a
)
swift-driver version: 1.87.3 Apple Swift version 5.9.2 (swiftlang-5.9.2.2.56 clang-1500.1.0.2.5)
Target: x86_64-apple-macosx14.0