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

A Swift-based package imported in an ObjC-based package is not visible when ObjC package is itself imported in another Swift package #72518

Open
glaurent opened this issue Mar 22, 2024 · 0 comments
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels

Comments

@glaurent
Copy link

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

@glaurent glaurent added bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels labels Mar 22, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug A deviation from expected or documented behavior. Also: expected but undesirable behavior. triage needed This issue needs more specific labels
Projects
None yet
Development

No branches or pull requests

1 participant