Our build pipeline builds 2 projects, but each one takes ~ 13 mins for just the “Build” portion.
The “Link Assemblies” and “Compile” steps take quite a while. And it seems that they don’t / can’t benefit from repeat building.
Any tips would be greatly appreciated.
Is this a Swift project?
Which step(s) you’re referring to? Xcode Test / Xcode Archive?
@viktorbenei - This is a C# Xamarin.iOS project.
We’re building using the xbuild command:
xbuild "/p:Configuration='%s' /p:Platform=iPhone /p:OutputPath='bin/%s/' /p:ArchiveOnBuild='true' /t:'Build'
The slow xbuild/msbuild target is: Target _CompileToNative. In particular, the “Link Assemblies” and “Compile” steps of this Target take quite a while. Around 13 minutes.
Ahh, sorry, I missed the Xamarin part.
So, in general we saw significantly slower builds for some projects with Xamarin + Xcode 8.2
We worked with other users to see if there’s anything we could do, but it seems to be a Xamarin issue, where Xamarin + Xcode 8.1 compiled the same project significantly faster than Xamarin + Xcode 8.2, although in general Xcode 8.2 is faster for native iOS projects.
This might or might not be an issue in your case, as it doesn’t affect all projects.
Things to try
Managed Linker configuration
One thing might worth a try is to change the “Managed Linker” configuration in your Xamarin project settings (http://blog.bitrise.io/2016/09/10/weekly-vm-updates.html)
- In Xamarin Studio’s project navigator open your iOS project’s Project Options (by double clicking on the project/rigth click Options).
- Select iOS Build in the side menu
- Change the Linker behavior (in the Code Generation & Runtime section)
Switch the Xamarin Stack to another Xamarin channel stack
Try to build on the Xamarin Stable
, Xamarin Beta
, Xamarin Alpha
stacks, we have a stack for all three Xamarin channels, updated every week to the latest update of that channel.
What do you mean by this? Repeated compile/build steps in the same build or through multiple, separate Bitrise builds?
The build environment is always destroyed at the end of the build (Code security - Bitrise Docs), there’s no cache kept between builds unless you set one up and configure what to cache (Redirecting… - Bitrise Docs).
I saw the explanation about the build environments being completely clean - which means builds won’t suffer from cache problems. Makes sense, but in the case of Xamarin projects, if we use the Managed Linker as recommended locally, the initial linking cost is pretty high, but subsequent builds are significantly faster. I’m assuming that’s because some caching happens at some level (not entirely sure). With a Bitrise build, it seems that linking cost is incurred each time.