Open
Conversation
When stripping XCTests, some `.framework` folders will left empty. Such folders are expected to have a valid framework inside and installing the resultting `.ipa` will result in errors. Make sure that any directory that was empties as a result of our stripping process is also deleted.
trufae
requested changes
Nov 30, 2025
| removedDirs = new Set<string>(); | ||
| for (const d of dirsToCheck) { | ||
| if (fs.readdirSync(d).length === 0) { | ||
| this.emit('message', 'Deleting ' + d); |
Member
There was a problem hiding this comment.
Use “ instead of ‘ (see ci complains)
| walk.walkSync(dir, (basedir: string, filename: string, stat: any) => { | ||
| const target = path.join(basedir, filename); | ||
| // if (target.toLowerCase().indexOf('/xct') !== -1) | ||
| if (target.toLowerCase().indexOf("xctest") !== -1) { |
Member
There was a problem hiding this comment.
Suggested change
| if (target.toLowerCase().indexOf("xctest") !== -1) { | |
| if (target.toLowerCase().indexOf(".xctest") !== -1) { |
This check is probably safer
| dirsToCheck.add(basedir); | ||
| } | ||
| }); | ||
| let removedDirs: Set<string> = new Set<string>(); |
Member
There was a problem hiding this comment.
It’s unclear to me the need to define a set of paths, an array should be fine and simpler because you cant have two different paths with the same path
Member
There was a problem hiding this comment.
simplify the loop iteration, the filter to remove the element from the set is adding an extra complication that is not necessary.
| if (fs.readdirSync(d).length === 0) { | ||
| this.emit('message', 'Deleting ' + d); | ||
| fs.rmdirSync(d); | ||
| removedDirs.add(d); |
Member
There was a problem hiding this comment.
From what i understand this code is deleting empty directories. But if an empty directory is contained within a directory that only had this one it wont be removed, so the removal must happen recursively.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
When stripping XCTests, some
.frameworkfolders will left empty. Such folders are expected to have a valid framework inside and installing the resultting.ipawill result in errors.Make sure that any directory that was empties as a result of our stripping process is also deleted.