Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

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 swiftlang/swift-package-manager#6948 (comment)

The proper fix is already implemented swiftlang/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 {

@lucaArchidiacono
Copy link

lucaArchidiacono commented Jan 5, 2025

Updating to XCode 16.2 and setting the Swift version to 6 does not solve the issue for me.

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

Successfully merging this pull request may close these issues.

Plugin fails in Xcode Cloud: "You don’t have permission to save the file “Strings.swift” in the folder “SwiftGenPlugin”

3 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.