CocoaPods / Xcodeproj

Create and modify Xcode projects from Ruby.
http://rubygems.org/gems/xcodeproj
MIT License
2.36k stars 457 forks source link

Deleting BuildFiles while browsing them in a BuildPhase makes #each browse only half of the build files #35

Closed pbernery closed 12 years ago

pbernery commented 12 years ago

I am trying to fix an issue in Xcodeproj.

I try to update an Xcode project by removing build files. I found a problem when deleting while browsing them in a build phase: the each method of AbstractBuildPhase#files does not return all files.

I added a spec that points out the problem. I commited it in the branch https://github.com/CocoaPods/Xcodeproj/tree/fix_build_files_removal branch. The commit that adds the spec: https://github.com/CocoaPods/Xcodeproj/commit/52cb6e1b46aa21b4268ba869cfc4b2ad0b5d5905.

The test is called removes several build files from a build phase. You can adjust the number_of_files variable in this test. #each calls the block _number_offiles / 2 with an even number, _number_offiles / 2 + 1 with an odd number.

pbernery commented 12 years ago

Deleting them outside #each makes the spec pass, however I wonder if it is the right behavior as build files are unrelated.

EDIT: well, of course modifying an array while browsing it has side effects... I think I misuse the API.

pbernery commented 12 years ago

I updated the spec accordingly.