Closed samuelsainz closed 2 years ago
From what I see, the cocoapods plugin doesn't reorder build phases but it just shuffles them in the .pbxproj. Am I right?
If so, can we integrate also a check that ensures that Xcode build phases order is valid (as expected) and indeed we don't have to modify .pbxproj at all? I am just afraid that without that, we could lead to a wrong order if someone used a version prior to #74.
Hi @polac24, thanks for reviewing this :)
I am not sure if I follow but the order in the .pbxproj actually defines the build phases order—i.e. If I move the order of the build phases for a target in the Xcode it is modified in the .pbxproj and viceversa.
To clarify a bit, what is happening is this:
The bug is because of this code being executed every time we run pod install—assuming the Prebuild phase is after the Sources phase:
compile_phase_index = target.build_phases.index(target.source_build_phase)
target.build_phases.insert(compile_phase_index, target.build_phases.delete(prebuild_script))
Thanks, now it makes sense. I was able to reproduce that every second time, the order is indeed incorrect.
Description
Once I configure XCRemoteCache using the cocoapods plugin, when I reinstall the pods the script moves the "Prebuild" phase after the "Compile sources" phase.
Solution
Moving the Prebuild build phase is needed only the first time we insert it in the target build phases. When the build phase exists then it is already in the right order.