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

Workaround for using SwiftGenPlugin in Xcode Cloud #1102

Open
wants to merge 1 commit into
base: develop
Choose a base branch
from

Conversation

shadone
Copy link

@shadone shadone commented Feb 9, 2024

The atomic version of api has a bug as of Swift 5.9.2 where writing to DerivedData folder located on external drives fails. This is also how Xcode Cloud is setup, hence writing generated files with SwiftGen fails there too.

See more details apple/swift-package-manager#6948 (comment)

The proper fix is already implemented apple/swift-package-manager#6910 but not released yet (as of Swift 5.9.2)

Fixes SwiftGen/SwiftGenPlugin#18

I've tested this by making a private binary release of this change and testing with a fork of SwiftGenPlugin, see more here SwiftGen/SwiftGenPlugin#18 (comment)

@shadone shadone changed the base branch from stable to develop February 9, 2024 10:49
The atomic version of api has a bug as of Swift 5.9.2 where writing to
DerivedData folder located on external drives fails. This is also how Xcode
Cloud is setup, hence writing generated files with SwiftGen fails there too.
Copy link
Member

@djbe djbe left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thank you for this PR. Am I correct in assuming that Xcode 15.3, which contains Swift 5.10, no longer needs requires this change?

extension Path {
/// Workaround for a bug in SPM that prevents SwiftGen from writing files to DerivedData folder located on an external drive.
/// https://github.com/apple/swift-package-manager/issues/6948#issuecomment-1747196926
public func writeFix(_ string: String, encoding: String.Encoding = String.Encoding.utf8) throws {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'd prefer a slightly better name:

Suggested change
public func writeFix(_ string: String, encoding: String.Encoding = String.Encoding.utf8) throws {
public func writeNonAtomically(_ string: String, encoding: String.Encoding = String.Encoding.utf8) throws {

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
2 participants