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

[SR-11328] Xcode fails to compile a project with SPM package and build configuration other than Debug/Release. #4674

Closed
swift-ci opened this issue Aug 18, 2019 · 4 comments

Comments

@swift-ci
Copy link
Contributor

Previous ID SR-11328
Radar https://feedbackassistant.apple.com/feedback/6506096
Original Reporter DenTelezhkin (JIRA User)
Type Improvement
Status Closed
Resolution Done

Attachment: Download

Additional Detail from JIRA
Votes 11
Component/s Package Manager
Labels Improvement
Assignee None
Priority Medium

md5: a49f78cbddbcebdf98552b59d8ca328f

Issue Description:

When dealing with multiple server environments, it's useful to have additional build configurations other than Debug/Release to match them with actual server environment build is running on.

For example, we use following environments:

DebugDevelop - Debug build with development server 
DebugStaging - Debug build with staging server 
DebugProduction - Debug build with production server 
ReleaseStaging - Release build with staging server, used for testing via TestFlight 
ReleaseProduction - Release build with production server, used for testing via TestFlight and releasing to AppStore

When trying to integrate SwiftPM package into a project that uses those build configurations, Xcode fails to compile a project, and throws following error:

No such module '<Package name>'

Observations

This might be related to a fact, that Xcode seems to ignore DebugDevelop configuration name, and continues to build for Debug configuration instead. If you go into DerivedData folders, specifically Build/Products folder, you can see that there are two folders present : `DebugDevelop-iphonesimulator`, in which app build products are located, and `Debug-iphonesimulator` folder, in which package build products are located. Product -> Archive also fails, because ReleaseProduction configuration is ignored as well. This leads me to believe that DebugDevelop build configuration is ignored when building dependencies using SwiftPM.

Attaching sample project that reproduces the problem.

@swift-ci
Copy link
Contributor Author

swift-ci commented Sep 2, 2019

Comment by Randy R (JIRA)

We attempted various workarounds for this issue, all resulted in the module not being found:

  1. Tried various permutations of renaming the configurations to Release.Alpha and Release.Beta instead of Alpha or Beta.

  2. Using a Scheme instead of a Configuration (that’s a hard road)

  3. Having Packages be a separate project in the workspace, like Pods with its own Debug and Release configurations.

  4. Generating a static lib via Fix small typo in DevelopingPackages document #3

  5. Generating a Packages.framework via Fix small typo in DevelopingPackages document #3

@swift-ci
Copy link
Contributor Author

Comment by Karl Shea (JIRA)

I'm having exactly the same issue. I use different build configurations to set variables for dev, stage, & prod API URLs.

Can't there be a way to set Swift Package Manager's configuration to Debug/Release inside the build configuration?

@swift-ci
Copy link
Contributor Author

Comment by Michael Lenaghan (JIRA)

I just ran into this and discovered that my schemes referenced old configurations, configurations that no longer existed. Once I updated them to the correct configurations the build succeeded.

(I'm leaving this comment about a year later. It's possible that what I ran into is completely different from what was originally reported. Still, it took me quite a while to track the problem down, so I wanted to leave a note that might save others time.)

@swift-ci
Copy link
Contributor Author

Comment by Denys Telezhkin (JIRA)

This issue seems to be resolved in Xcode 12 beta 4, attached project no longer reproduces the problem, which is fantastic! Closing.

@swift-ci swift-ci transferred this issue from apple/swift-issues Apr 25, 2022
@shahmishal shahmishal transferred this issue from apple/swift May 4, 2022
m-chojnacki added a commit to m-chojnacki/XcodeGen that referenced this issue Feb 17, 2023
ProjectSpec states that Swift Packages don't work in projects with configurations other than `Debug` and `Release`. It provides a link to Swift bugtracker to issue marked as duplicate. Original issue that it points to is closed and fixed since 2020 with Xcode 12.

Let's remove misleading note from ProjectSpec.

apple/swift-package-manager#4674
yonaskolb pushed a commit to yonaskolb/XcodeGen that referenced this issue Feb 18, 2023
ProjectSpec states that Swift Packages don't work in projects with configurations other than `Debug` and `Release`. It provides a link to Swift bugtracker to issue marked as duplicate. Original issue that it points to is closed and fixed since 2020 with Xcode 12.

Let's remove misleading note from ProjectSpec.

apple/swift-package-manager#4674
This issue was closed.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant