-
-
Notifications
You must be signed in to change notification settings - Fork 19
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Slow incremental builds using xcodebuild
#201
Comments
Root CauseIt turns out that the issue is caused by the way the The difference between On top of that, What's NextIt's a very inefficient behavior, but unfortunately, I don't think it's possible to fix or configure it on our side. We need to wait for a fix provided by Apple, possibly to cache responses and optimize the signing. I have already created a ticket in Feedback Assistant: FB15478221. You can also follow the thread here. Initially, I assumed the local signing process was slow for some reason, but the discussion in that thread revealed that network requests were responsible for the delay. However, there is also good news, you can speed up builds by temporarily blocking that domain. In my case, it reduces an incremental build from 30 seconds down to 10 seconds. Below you will find details on how to do that. Caution Blocking that domain will most likely result in disabling some Xcode functions like automatic registering devices, capabilities, etc. Therefore, it's best to block it when you are working on code and you don't need any modifications related to signing or capabilities. Workaround 1Enable workaround: sudo bash -c "echo '127.0.0.1 developerservices2.apple.com' >>/etc/hosts" Disable workaround: sudo sed -i '' '/developerservices2\.apple\.com/d' /etc/hosts Workaround 2If you use some tool to sniff network traffic like Proxyman or Charles Proxy, you can block requests to Workaround 3 - plugin integrationNow, Still slower than Xcode 🥺This workaround improves build time significantly, but there is still some overhead introduced by In my case, incremental build using Xcode takes ~4s, and incremental build using Based on the response from Apple (#106) and my profiling, it looks like in the case of my project it takes an additional ~0.3s to initialize the tool, ~3s to load the project, and around ~2s of some extra time needed by It seems like If this issue is important to you I recommend creating a ticket in Feedback Assistant and referencing my ticket FB15478221. The more people report this issue, the greater the chance that it will be fixed. |
xcodebuild
?xcodebuild
I use Xcode 16.0. It looks like it might be connected with the number of targets in the project. I've got the main target + 3 extensions. The funny thing is that each request is exactly the same... very poor optimization. Update: Update 2: |
Yeah, and that would explain the fact that you've seen more improvement than I did as well. The project I've tested on doesn't have any extensions |
I found it mentioned in the developer forums and the difference is evident when you turn off the internet and see it does not hang on |
can confirm |
I'm working to integrate an automatic script to disable |
BREAKING CHANGE: (optional) please see `:h xcodebuild.xcodebuild-offline` to enable tool that improves build speed. More details about this issue here (#201): #201 (comment)
BREAKING CHANGE: (optional) please see `:h xcodebuild.xcodebuild-offline` to enable tool that improves build speed. More details about this issue here (#201): #201 (comment)
BREAKING CHANGE: (optional) please see `:h xcodebuild.xcodebuild-offline` to enable tool that improves build speed. More details about this issue here (#201): #201 (comment)
BREAKING CHANGE: (optional) please see `:h xcodebuild.xcodebuild-offline` to enable tool that improves build speed. More details about this issue here (#201): #201 (comment)
BREAKING CHANGE: (optional) please see `:h xcodebuild.xcodebuild-offline` to enable tool that improves build speed. More details about this issue here (#201): #201 (comment)
The script to automate applying the workaround has been integrated with xcodebuild.nvim. Here is the instruction explaining how to enable this feature: Don't forget to update the plugin first :)! |
follow |
Looks like your codesign command is incorrect - you forgot entitlements for the app. Also, don't pass --deep! Correct sign workflow is:
You can also check the codesign command that xcodebuild issues in Xcode build log or in the command line invocation (just don't pass -quiet for the latter). |
Does tuist also suffer from this? As far as I can see, running Is this a new Xcode 16.x thing or has it always been like this? I haven't paid enough attention to build times using tuist only as I've mostly used it for cold builds. Since this project is the first time I tried to work outside of Xcode – where remote work over SSH is the real benefit for me – I haven't been able to assess these things until now. |
@simpers If tuist uses xcodebuild without any hacks then most likely it affects them too. I’m not sure if it was introduced at some point, but for sure Xcode 15 & 16 are affected. |
Recently, I discovered that adding
CODE_SIGNING_ALLOWED=NO"
toxcodebuild
commands significantly speeds up incremental builds. However, the problem is that you can't run the app built this way, because obviously it's unsigned.I suspect that
xcodebuild
signing process is for some reason very slow, so if we could figure out a way to sign in afterwards, maybe we could speed up builds. Unfortunately, I haven't yet found a way to sign the app.So far I tried:
and also signing all frameworks and bundles before signing the whole app, but it doesn't work - the app can't be launched.
The text was updated successfully, but these errors were encountered: