forked from dotnet/android
-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[tests, build] multi-target Xamarin.Android.Build.Tests
There are various tests in `Xamarin.Android.Build.Tests` that execute MSBuild tasks directly. This means the changes in dotnet#4820 are not quite complete. We need to actually *run* the tests under .NET Core to see if these tests would pass under a One .NET context. The solution (you would think), would be to make the test assembly `netstandard2.0` so you could run either: > nunit3-console Xamarin.Android.Build.Tests.dll > dotnet test Xamarin.Android.Build.Tests.dll `nunit3-console` would execute the tests under .NET framework/Mono and `dotnet test` would run under .NET Core or .NET 5+. Unfortunately, `nunit3-console` can't run tests from a `netstandard2.0` library! So we multi-target: <TargetFrameworks>net472;net5.0</TargetFrameworks> Unfortunately, the `net5.0` causes MSBuild to fail with: > msbuild Xamarin.Android.sln ... (GetReferenceAssemblyPaths target) -> C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(1177,5): error MSB3644: The reference assemblies for .NETFramework,Version=v5.0 were not found. To resolve this, install the Developer Pack (SDK/Targeting Pack) for this framework version or retarget your application. You can download .NET Framework Developer Packs at https://aka.ms/msbuild/developerpacks I think there is some expectation to use `dotnet build` for .NET 5 instead. We don't want to move our *entire* build over to `dotnet build` yet (we probably can't!), so instead we can do: <TargetFrameworks>net472;netcoreapp3.1</TargetFrameworks> This allows `msbuild Xamarin.Android.sln` to continue to work. This might also be something that gets fixed in a future MSBuild version. I updated various `.yaml` definitions so we can run NUnit tests via `nunit3-console` or `dotnet test` as needed. Other things that broke here: * We need `Microsoft.NET.Test.Sdk` for `dotnet test` to work. * `Builder.UseDotNet` can now be set based on a `#if` instead of an NUnit parameter. * `Xamarin.Android.Tools.Aidl` needs to be `netstandard2.0`. This required including a `System.CodeDom` package. * `Xamarin.Android.Build.Tasks` can't use `FSharp.Core` in `netcoreapp3.1`. I just removed it, since it is not used. * Updated various paths to `Xamarin.Android.Build.Tests.dll`. * Usage of System.Drawing crashed on macOS. I replaced this with ImageSharp: https://www.nuget.org/packages/SixLabors.ImageSharp/
- Loading branch information
1 parent
f27e7cd
commit f1481ab
Showing
18 changed files
with
87 additions
and
93 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.