I've been thinking a bit about the workflow of branch switching when you use XcodeGen. Currently many people are regenerating the project after a checkout (sometimes in a git checkout hook) to make sure the project is up to date, in case the project spec has changed or files have been added or removed. In a very large project, this can potentially take a couple of seconds.
I propose adding a project lock file that is used to track whether generation is necessary.
- Every time the project is generated, all the files it includes in the project are looped through and collected. These files would be things source files and xcconfig files. Then all these file paths along with the spec itself would be written to a
project.lock file (name TBD).
- A new argument can be added to
xcodegen, something like --check-lock (name?). When this is provided it checks for a project.lock file and compares the current spec with the one included in the lock file.
- if it's different generate the file
- if it's the same then collect all the files in the current spec the same as it does when writing the lock file
- if these files differ from what is in the lock file then generate
For those using Cocoapods, a pod install has to be run after project generation. Another argument --pod-install could run pod install after generation. This would mean it only runs if get past the lock file.
This command could then be added as a git checkout hook (perhaps with a command in XcodeGen itself)
Thoughts?
I've been thinking a bit about the workflow of branch switching when you use XcodeGen. Currently many people are regenerating the project after a checkout (sometimes in a git checkout hook) to make sure the project is up to date, in case the project spec has changed or files have been added or removed. In a very large project, this can potentially take a couple of seconds.
I propose adding a project lock file that is used to track whether generation is necessary.
project.lockfile (name TBD).xcodegen, something like--check-lock(name?). When this is provided it checks for aproject.lockfile and compares the current spec with the one included in the lock file.For those using Cocoapods, a pod install has to be run after project generation. Another argument
--pod-installcould run pod install after generation. This would mean it only runs if get past the lock file.This command could then be added as a git checkout hook (perhaps with a command in XcodeGen itself)
Thoughts?