-
-
Notifications
You must be signed in to change notification settings - Fork 580
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
Ensure generate works on additional disk volumes #327
Ensure generate works on additional disk volumes #327
Conversation
Resolves tuist#324 - Using `replaceItemAt` has a caveat where it requires the item and its replacement to be on the same volume (see https://developer.apple.com/documentation/foundation/filemanager/2293212-replaceitemat) - To mitigate this, the documentation suggests creating a temporary file within that volume - The item can be moved there first - Then a `replaceItemAt` can be performed Test Plan: - Manually create a RAM disk e.g. `diskutil erasevolume HFS+ “RAMDisk” `hdiutil attach -nomount ram://524288`` (this creates a 250MB RAM disk) - Create a new folder within that disk - run `tuist --init` - run `tuist generate` - Verify the generation succeeds
Generated by 🚫 Danger |
@@ -37,9 +37,7 @@ final class GeneratedProject { | |||
/// - Parameter path: Path to the project (.xcodeproj) | |||
/// - Returns: GeneratedProject instance. | |||
func at(path: AbsolutePath) throws -> GeneratedProject { | |||
let xcode = try XcodeProj(pathString: path.pathString) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Initially before testing on a RAM Disk, I was testing on Google Drive :p - and there I found this step fails sometimes as the generated file fails to be read from disk (if done immediately).
Technically we can automate a test for this using the steps described above, though I worry this would be flakey as it involves mounting / un-mounting disks :/ - as such may not be worthwhile. |
Codecov Report
@@ Coverage Diff @@
## master #327 +/- ##
==========================================
+ Coverage 89.47% 89.48% +0.01%
==========================================
Files 278 278
Lines 12354 12366 +12
==========================================
+ Hits 11054 11066 +12
Misses 1300 1300
Continue to review full report at Codecov.
|
Agree. Having addressed this scenario and considering that we don't touch that logic much I think the trade-off of not having tests vs having flakey tests is worth it. |
Resolves #324
Short description 📝
Running
tuist generate
on external volumes fails:e.g.
Solution 📦
Using
replaceItemAt
has a caveat where it requires the item and its replacement to be on the same volume (seereplaceItemAt
documentation)To mitigate this, the documentation suggests creating a temporary file within that volume where the new item can be moved to first before performing the replace.
Implementation 👩💻👨💻
FileHandler.replace
Test Plan 🛠
(this creates a 250MB RAM disk)
tuist init
tuist generate