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

Changed copy with move in writeXcodeProject. Resolves #1409 #1410

Closed
wants to merge 7 commits into from
Closed
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@

- Fixed source file `includes` not working when no paths were found #1337 @shnhrrsn
- Supports specifying multiple package products #1395 @simonbs
- Fixed generation of multiple schemes when running xcodegen in preAction scheme script

## 2.37.0

Expand Down
5 changes: 2 additions & 3 deletions Sources/XcodeGenKit/FileWriter.swift
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,11 @@ public class FileWriter {
let tempPath = try Path.processUniqueTemporary() + "XcodeGen"
try? tempPath.delete()
if projectPath.exists {
try projectPath.copy(tempPath)
try projectPath.move(tempPath)
Copy link
Owner

Choose a reason for hiding this comment

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

If the project is open, this would yank the project file out from underneath Xcode, which would complain no?

Copy link
Author

@arkonxu arkonxu Nov 6, 2023

Choose a reason for hiding this comment

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

Thank you for your concern! I've tested the changes multiple times, as I mentioned in the issue description, both by using the scheme preAction and from the terminal. It appears that there are no issues with the project file in my environment, and I haven't encountered any complains in Xcode. If you have specific test cases or scenarios in mind that you'd like me to investigate, please feel free to share them!

If you think it can be dangerous and you have any other idea or solution please tell me, because with this copy it also doesn't work properly

}
try xcodeProject.write(path: tempPath, override: true)
try? projectPath.delete()
try tempPath.copy(projectPath)
try? tempPath.delete()
try tempPath.move(projectPath)
}

public func writePlists() throws {
Expand Down