Skip to content

Commit e46a93d

Browse files
committed
[TrimmableTypeMap] Integration parity test slice
1 parent 03926b5 commit e46a93d

File tree

5 files changed

+1385
-0
lines changed

5 files changed

+1385
-0
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,56 @@
1+
<Project Sdk="Microsoft.NET.Sdk">
2+
3+
<PropertyGroup>
4+
<TargetFramework>$(DotNetTargetFramework)</TargetFramework>
5+
<LangVersion>latest</LangVersion>
6+
<Nullable>enable</Nullable>
7+
<IsPackable>false</IsPackable>
8+
<RootNamespace>Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests</RootNamespace>
9+
<SignAssembly>true</SignAssembly>
10+
<AssemblyOriginatorKeyFile>..\..\product.snk</AssemblyOriginatorKeyFile>
11+
<OutputPath>..\..\bin\Test$(Configuration)</OutputPath>
12+
</PropertyGroup>
13+
14+
<ItemGroup>
15+
<PackageReference Include="xunit" Version="2.9.3" />
16+
<PackageReference Include="xunit.runner.visualstudio" Version="3.0.2" />
17+
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.5.0" />
18+
</ItemGroup>
19+
20+
<!-- Exclude the fixture assembly source files from this project -->
21+
<ItemGroup>
22+
<Compile Remove="UserTypesFixture\**" />
23+
</ItemGroup>
24+
25+
<ItemGroup>
26+
<ProjectReference Include="..\..\src\Microsoft.Android.Sdk.TrimmableTypeMap\Microsoft.Android.Sdk.TrimmableTypeMap.csproj" />
27+
<ProjectReference Include="..\..\src\Xamarin.Android.Build.Tasks\Xamarin.Android.Build.Tasks.csproj" />
28+
<!-- Mono.Android is built as a dependency so the ref assembly is available on disk.
29+
ReferenceOutputAssembly=false because we read it with SRM/Cecil, not compile against it directly.
30+
Instead, we reference the ref assembly below so we can use typeof(Java.Lang.Object). -->
31+
<ProjectReference Include="..\..\src\Mono.Android\Mono.Android.csproj"
32+
ReferenceOutputAssembly="false" />
33+
<!-- User-type fixture assembly: built as a dependency, scanned via SRM/Cecil in tests.
34+
ReferenceOutputAssembly=false because we don't compile against it — we just need the DLL on disk. -->
35+
<ProjectReference Include="UserTypesFixture\UserTypesFixture.csproj"
36+
ReferenceOutputAssembly="false" />
37+
</ItemGroup>
38+
39+
<!-- Discover the Mono.Android ref assembly path and add a direct Reference to it.
40+
This lets tests use typeof(Java.Lang.Object).Assembly.Location to find the assembly. -->
41+
<Target Name="_AddMonoAndroidReference" BeforeTargets="ResolveAssemblyReferences">
42+
<ItemGroup>
43+
<_MonoAndroidRefCandidate Include="$(MSBuildThisFileDirectory)..\..\bin\$(Configuration)\lib\packs\Microsoft.Android.Ref.*\*\ref\net*\Mono.Android.dll" />
44+
</ItemGroup>
45+
<PropertyGroup>
46+
<_MonoAndroidRefAssembly>@(_MonoAndroidRefCandidate, ';')</_MonoAndroidRefAssembly>
47+
<_MonoAndroidRefAssembly>$(_MonoAndroidRefAssembly.Split(';')[0])</_MonoAndroidRefAssembly>
48+
</PropertyGroup>
49+
<ItemGroup Condition=" '$(_MonoAndroidRefAssembly)' != '' ">
50+
<Reference Include="Mono.Android">
51+
<HintPath>$(_MonoAndroidRefAssembly)</HintPath>
52+
</Reference>
53+
</ItemGroup>
54+
</Target>
55+
56+
</Project>
Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,22 @@
1+
using System;
2+
using System.Collections;
3+
using Microsoft.Build.Framework;
4+
5+
namespace Microsoft.Android.Sdk.TrimmableTypeMap.IntegrationTests;
6+
7+
/// <summary>
8+
/// Minimal IBuildEngine implementation for use with TaskLoggingHelper in tests.
9+
/// </summary>
10+
sealed class MockBuildEngine : IBuildEngine
11+
{
12+
public bool ContinueOnError => false;
13+
public int LineNumberOfTaskNode => 0;
14+
public int ColumnNumberOfTaskNode => 0;
15+
public string ProjectFileOfTaskNode => "";
16+
17+
public bool BuildProjectFile (string projectFileName, string [] targetNames, IDictionary globalProperties, IDictionary targetOutputs) => true;
18+
public void LogCustomEvent (CustomBuildEventArgs e) { }
19+
public void LogErrorEvent (BuildErrorEventArgs e) { }
20+
public void LogMessageEvent (BuildMessageEventArgs e) { }
21+
public void LogWarningEvent (BuildWarningEventArgs e) { }
22+
}

0 commit comments

Comments
 (0)