[XM] Improve XM msbuild support and add roslyn netstandard test case - #1846
Conversation
- Significant changes to target file under msbuild, ImplicitFacade processing in particular - Tests are disabled due to https://bugzilla.xamarin.com/show_bug.cgi?id=53164 where we can't tests local target files only global - Requires a mono msbuild with mono/msbuild@95ab657 for tests to pass - Until then, this is a workaround: sudo cp /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Roslyn/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/
|
Build success |
| --> | ||
|
|
||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- Unfortuntly Microsoft.NETFramework.CurrentVersion.targets defines this and is not included in Mobile/Modern builds so we'll add it here --> |
There was a problem hiding this comment.
Unfortunately my spelling is as bad as it looks...
| Copyright (C) 2015 Xamarin Inc. All rights reserved. | ||
| *********************************************************************************************** | ||
| --> | ||
| <!-- Rename file --> |
| <Import Project="$(MSBuildBinPath)\Microsoft.CSharp.targets" /> | ||
| <Import Project="Xamarin.Mac.ObjCBinding.Common.targets" /> | ||
|
|
||
| <PropertyGroup> |
There was a problem hiding this comment.
Will this work with F# projects too (does XM even have support for F#)?
There was a problem hiding this comment.
It does in theory. I did not look into getting it working with msbuild, but let me see how bad it is...
There was a problem hiding this comment.
So I tested it out and with msbuild fsharp works with this change, I did not dig into why.
Now, that file in particular is with binding project, but they really don't have F# support (you can bind the libs and use them in F# though).
|
Build success |
| <!-- Implicitly references all portable design-time facades if the user is referencing a System.Runtime-based portable library --> | ||
| <Target Name="ImplicitlyExpandDesignTimeFacades" DependsOnTargets="$(ImplicitlyExpandDesignTimeFacadesDependsOn)"> | ||
|
|
||
| <PropertyGroup> |
There was a problem hiding this comment.
Indent all the elements under the Target.
| --> | ||
|
|
||
| <Project DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> | ||
| <!-- Microsoft.NETFramework.CurrentVersion.targets defines this and that target file is not pulled in to Mobile/Modern builds --> |
There was a problem hiding this comment.
IMHO, it would be useful to make this more prominent/visible for future readers, especially the part that the default targets file will not be pulled in for Mobile/Modern builds.
There was a problem hiding this comment.
Also, mention or mark the portions of this file which are from Microsoft.NETFramework.CurrentVersion.targets, and point out any changes from that. It will be useful for debugging in future or sync'ing up changes from that file.
| this file. This file also defines targets to produce an error if the specified targets | ||
| file does not exist, but the project is built anyway (command-line or IDE build). | ||
|
|
||
| Copyright (C) 2015 Xamarin Inc. All rights reserved. |
| Condition="'$(UseXamMacFullFramework)' == 'true' And '$(IsXBuild)' == 'true' "/> | ||
|
|
||
| <Import Project="$(MSBuildThisFileDirectory)Xamarin.Mac.msbuild.targets" | ||
| Condition="'$(IsXBuild)' == 'false' "/> |
There was a problem hiding this comment.
The usual pattern is - '$(IsXBuild)' != 'true', that way the default/empty value "means" false. Just a nitpick.
|
The was marked dont-merge because it started failing tests locally for me, but it turns out after research that I reinstalled mono and "lost" the System.Reflection.Metadata.dll hack noted above. That meant it would fail first build and pass second. With the hack it works first and second time. |
|
@radical 's code review requests are in. |
|
LGTM! 👍 |
|
Build success |
|
While reviewing the diff one last time, I noticed my (commented out for now) tests were not executing the built project. While technically it isn't needed, seeing if the app actually works seems like a great idea. Landed change in PR. Will submit when it builds green. |
|
Build failure |
|
Test failure was a random one: |
sudo cp /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/Roslyn/System.Reflection.Metadata.dll /Library/Frameworks/Mono.framework/Versions/Current/lib/mono/msbuild/15.0/bin/