A Swift-based package imported in an ObjC-based package is not visible when ObjC package is itself imported in another Swift package #72518
Labels
bug
A deviation from expected or documented behavior. Also: expected but undesirable behavior.
triage needed
This issue needs more specific labels
Description
Given a Swift package containing Swift code named TestPackage.
This package is a dependency of another Swift package which contains ObjC code, call it TestObjCPackage.
TestObjCPackage builds perfectly fine on its own. In it there's a public header include/Header.h which has the line '@import TestPackage;'.
On top of that I have another Swift package, containing Swift code, which has TestObjCPackage as a dependency, call it TestLvl2Package.
Problem : when building TestLvl2Package, I get an error "Module 'TestPackage' not found" on TestObjCPackage/include/Header.h.
The only way around this is to add an unsafe flag in TestLvl2Package to specify the modulemap of TestPackage :
.target( name: "TestLvl2Package", dependencies: [.product(name: "TestObjCPackage", package: "TestObjCPackage")], swiftSettings: [.unsafeFlags(["-Xcc", "-fmodule-map-file=$GENERATED_MODULEMAP_DIR/TestPackage.modulemap"])] )
I'm adding a zip file with the packages for easy reproduction.
TestPackages.zip
Reproduction
Expected behavior
No build error and no need to add an unsafe flag.
Environment
swift-driver version: 1.90.11.1 Apple Swift version 5.10 (swiftlang-5.10.0.13 clang-1500.3.9.4)
Additional information
No response
The text was updated successfully, but these errors were encountered: