Closed
Description
Description
The package manager supports mixing C family language sources within a single target. When adding a resource; however, compilation of the target fails because compiling the C sources will try to import Foundation.
Expected behavior
The package will build successfully.
Actual behavior
The package fails. Upon inspection of the build manifest, it appears that the resource_bundle_accessor.h
is being added as an input to the compilation of the C sources. This causes an error because resource_bundle_accessor.h
imports Foundation.
Steps to reproduce
I have provided a minimal, reproducible example: https://github.com/ncooke3/Package5923
- Clone it, and
cd
into the package - Run
swift build
Alternatively, without the example project:
- Create a package with an Objective-C header and implementation as well as a C header and implementation.
- Run
swift build
–– it should build. - Now, add a resource file to the package and specify it in the package manifest.
- Run
swift build
–– it should fail to build with the error see in the example project's README.
Swift Package Manager version/commit hash
Swift Package Manager - Swift 5.6.0
Swift & OS version (output of swift --version && uname -a
)
swift-driver version: 1.45.2 Apple Swift version 5.6 (swiftlang-5.6.0.323.62 clang-1316.0.20.8)
Target: x86_64-apple-macosx12.0
Darwin nickcooke-macbookpro 21.6.0 Darwin Kernel Version 21.6.0: Thu Sep 29 20:12:57 PDT 2022; root:xnu-8020.240.7~1/RELEASE_X86_64 x86_64