MSBuild doesn’t care, as long as the timestamp on those files can be compared with the Inputs to detect the out-of-date items. But since all we need those output files for is for incremental build support, they are actually written as empty files on Windows :). An interesting challenge there was that for MSBuild to determine that a given target doesn’t need run again (or that certain outputs are out of date with regards to their inputs), the Outputs files need to exist on the Windows side. The next step was to improve the targets to provide relevant Inputs/Outputs to enable incremental build. Some parts of the build are done on Windows, some parts on the Mac An example that doesn’t is the C# compiler itself, since the source code can be compiled to IL by Microsoft’s compiler on Windows without requiring a roundtrip to the Mac. One example of a task that always runs remotely is compiling iOS storyboards, since the tools to do so are provided by Xcode. The unit of remote invocation to the Mac is the MSBuild Task.Execute We evaluate tasks individually to determine if they must run remotely or if they can be run locally. The only difference is that the Windows version of the tasks do a remote invocation to the Mac whenever the tasks that need to run on the Mac are executed. This allows us to minimize inconsistencies between VS and XS builds. You can see that exactly the same targets and tasks are shared between the Mac and Windows. Also, we wanted to share 100% of the build logic from Xamarin.iOS targets on the Mac. MSBuild (and XBuild on the Mac) already support incremental builds, so the first challenge was to move away from batch-style of invoking XBuild remotely, to a fully “MSBuild-native” solution. MSBuild and Incremental Buildsįor anything but trivial apps, achieving incremental builds is key for productivity: you don’t want to be copying unnecessary files over the network to the Mac, neither you want to be optimizing PNGs, compiling storyboards and what-not if none of the source files have changed. But as Tim Cook said “the only thing that changed is everything”, so I’ll go over the details of how it works today with the new Xamarin 4 experience. What started as a (more or less) batch process of “zip sources, HTTP post to Mac, build, run” (with frequent rebuilds needed), is now a fine-tuned granular incremental build system driven by MSBuild, connecting to the Mac over a resilient, auto-deployed and always-on messaging layer running on top of a bi-directional binary protocol over TCP, secured by an SSH tunnel.Īt the user experience level, it might seem that little has changed other than a fancy new connection dialog. Clark way).ĭuring the past year and a half since the we joined Xamarin, we iterated (among other things) on this key component of the developer experience, culminating in our most recent release, Xamarin 4. I had the same feeling the first time I did the same thing against an Azure website. When we started working for Xamarin as consultants, a couple years ago, it was nothing short of amazing for us that Xamarin had already achieved a pretty solid “F5 experience” with an app building on the Mac and debugging like any regular local.
0 Comments
Leave a Reply. |
AuthorWrite something about yourself. No need to be fancy, just an overview. ArchivesCategories |