xamarin-macios/msbuild
Jonathan Peppers 7c2cf9aa52 [msbuild] $(ProduceReferenceAssembly) support (#6458)
Context: http://feedback.devdiv.io/600039
Context: 6321934237/Documentation/guides/MSBuildReferenceAssemblies.md
Context: https://github.com/dotnet/roslyn/blob/master/docs/features/refout.md#msbuild

For Xamarin.Android, we have been doing a bit of work to enable a new
MSBuild/Roslyn feature called "reference assemblies". You can opt into
this by setting $(ProduceReferenceAssembly)=true in a netstandard
project.

The benefit being that if the public API doesn't change in the
netstandard library, the head projects don't need to run `CoreCompile`
or `<Csc/>` during an incremental build.

Unfortunately, this seems to have uncovered a problem in the
Xamarin.iOS MSBuild targets. If you do a build with a XAML-only change,
you get:

    Target "_CompileToNative" in file "/Library/Frameworks/Mono.framework/External/xbuild/Xamarin/iOS/Xamarin.iOS.Common.targets":
    Skipping target "_CompileToNative" because all output files are up-to-date with respect to the input files.
    Input files: /Users/jonathanpeppers/Projects/HelloForms/HelloForms.iOS/bin/iPhoneSimulator/Debug/HelloForms.iOS.exe
    Output files: bin/iPhoneSimulator/Debug/device-builds/iphone11.8-12.2/HelloForms.iOS.app/HelloForms.iOS;bin/iPhoneSimulator/Debug/device-builds/iphone11.8-12.2/mtouch.stamp

Because we are using `$(ProduceReferenceAssembly)` the
`HelloForms.iOS.exe` assembly will have no changes. Only
`HelloForms.dll`, the netstandard project, has changes. We were able
to skip `CoreCompile` in the iOS head project. Faster builds, yeah!

However, we actually need `_CompileToNative` to run, or we won't see
any changes on the device or simulator... It only runs if
`$(TargetPath)` changes.

The fix here is to add new `Inputs`, so `_CompileToNative` runs when
any referenced assemblies change:

    <_CompileToNativeInput Include="$(TargetDir)$(TargetFileName);@(ReferencePath);@(MTouchReferencePath)" />

This fixes incremental builds (or changes) for:

* Any `<ProjectReference/>` that has `$(ProduceReferenceAssembly)`
* Any NuGet package that ships a reference assembly alongside its
"regular" assembly

I also moved the `<ItemGroup>`'s, just so the code made sense --
so we have all the important `<ItemGroup>`'s in one place.

I also updated the `XamarinForms` test to verify things are working.

I added a couple helpers to assist in writing MSBuild tests:

* `IsTargetSkipped` to check if a specific MSBuild target ran
* `Logger.Clear` to clear past MSBuild events within a single test
2019-07-12 21:34:06 +02:00
..
Xamarin.Mac.Tasks [msbuild] Add reference to `System.Drawing.Common.dll` to XI projects. (#6011) 2019-05-10 01:20:52 +02:00
Xamarin.Mac.Tasks.Core Add macOS Xcode archive support (#5862) 2019-04-15 15:20:18 -05:00
Xamarin.MacDev.Tasks [msbuild] Update xbuild assembly references to msbuild ones 2018-05-22 13:26:55 -04:00
Xamarin.MacDev.Tasks.Core [msbuild] Lock variables accessed in a Parallel.ForEach callback. (#6173) 2019-05-30 23:29:45 -07:00
Xamarin.ObjcBinding.Tasks [msbuild] Remove support for XI/Classic. (#976) 2016-10-13 10:47:46 +02:00
Xamarin.Shared Bump VSMac to 8.1.0.2742 to fix msbuild issues (#6279) 2019-06-19 07:07:26 +02:00
Xamarin.iOS.Tasks Add 'NoBindingEmbedding' style binding project support (#5167) 2018-12-12 09:55:57 -05:00
Xamarin.iOS.Tasks.Core [msbuild] $(ProduceReferenceAssembly) support (#6458) 2019-07-12 21:34:06 +02:00
tests [msbuild] $(ProduceReferenceAssembly) support (#6458) 2019-07-12 21:34:06 +02:00
.editorconfig Provide .editorconfig support for easier contributor formatting 2016-06-13 00:43:37 -03:00
.gitignore [builds] Improve mono/llvm dependencies. (#1948) 2017-03-31 20:23:38 +02:00
Makefile [xm][msbuild] Fix full profile FrameworkList file (#5674) 2019-02-27 12:38:38 -05:00
Xamarin.MacDev.Tasks.sln [msbuild] Added support for building CoreML models (#2714) 2017-11-28 11:16:44 -05:00