Skip to content
This repository has been archived by the owner on Jun 27, 2023. It is now read-only.

xcode 11 file fixes #208

Merged
merged 1 commit into from
Sep 19, 2019
Merged

xcode 11 file fixes #208

merged 1 commit into from
Sep 19, 2019

Conversation

tanner0101
Copy link
Member

@tanner0101 tanner0101 commented Jun 11, 2019

Swift packages fetched directly by Xcode 11 are stored in a different location than packages fetched by swift package generate-xcodeproj. Because of this, hacks that were previously used to automatically determine working directory no longer work in Xcode 11.

Luckily, Xcode 11's native SPM integration allows for persistence of project settings. This was a limitation that the original auto-detection hacks were attempting to work around. Because of this, we recommend that all Vapor 3 and 4 users using Xcode 11's native SPM support set a Custom Working Directory in their Run scheme to the desired folder:

Screen Shot 2019-06-11 at 4 06 33 PM

This folder is usually the folder that contains your project's Package.swift file.


In order for the Custom Working Directory to pass through correctly, a check has been added for a unique string that should only appear when Xcode 11's native SPM integration is being used. This should allow for Vapor 3 projects to continue working normally with swift package generate-xcodeproj.

For Vapor 4, these hacks have been removed entirely, and directory config detection will always expect a Custom Working Directory to be set in the project's Run scheme.

@tanner0101
Copy link
Member Author

tanner0101 commented Jun 11, 2019

Update: It may be possible that Xcode 11 could help us remedy this issue by exposing an environment variable containing the Swift package's root directory.

@tanner0101
Copy link
Member Author

tanner0101 commented Aug 28, 2019

Update to the previous comment: It looks like SPM will not be exposing an environment variable. They gave this response to the feedback assistant request:

We have determined that this issue is not to be fixed/changed.

We considered this but decided not to do it because a package root can change depending on the context. For example, it can be inside a project/workspace.

Thank you for your feedback.

@0xTim
Copy link
Member

0xTim commented Aug 30, 2019

As an FYI this bug also breaks integrations with the .env support

@tanner0101 tanner0101 merged commit 18f2436 into master Sep 19, 2019
@tanner0101 tanner0101 deleted the xcode11-file-fix branch September 19, 2019 14:09
@tonyarnold
Copy link

Oh wow, am I allowed to say that manually setting this scheme configuration is going to be massive PITA when working in Xcode? This essentially means hardcoding an absolute path on a specific machine as the custom working directory, right?

Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants