If we build multiple times the same code on our local system, it takes very less time as xcode caches the ouput from previous build command. It could be a good optimization for circle ci cache if it can provide additional handling for sharing xcode cache i.e. Derived data.
In current options available, at max we can try to include the derived data path too while saving cache. But! this wont work, as xcodebuild command also notices the file modification date, which changes while pulling the cache.
We’ve also had this issue; the other problem is that our DerivedData is huge, well beyond the 500MB it suggests for caching (I think it’s really hard for DerivedData for anything decently sizable to not be above that, to be honest)
We had the same issues. It often made the build take longer since we had to upload and download the files when we persisted parts of the workspace. We just build again for simplicity
If you place this step after your cache restore, then it will set all directories and files within DerivedData to the date specified (in YYMMDDHHMM format).
The || true at the end of the command will prevent the job from failing if DerivedData is empty (for example if there is no cache to restore).
I tested this myself and saw marginal gains, though the app I was testing is extremely small, so I would be interested to see if this benefits users with larger apps.