-
-
Notifications
You must be signed in to change notification settings - Fork 230
Expand file tree
/
Copy pathSentry.Android.AssemblyReader.Tests.csproj
More file actions
67 lines (57 loc) · 4.21 KB
/
Sentry.Android.AssemblyReader.Tests.csproj
File metadata and controls
67 lines (57 loc) · 4.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
<Project Sdk="Microsoft.NET.Sdk">
<PropertyGroup>
<TargetFrameworks>net9.0;net8.0</TargetFrameworks>
<!-- IMPORTANT: We must test with new TFMs as the store format changes with new versions of .NET -->
<TargetFrameworks Condition="'$(NO_ANDROID)' == ''">$(TargetFrameworks);net8.0-android34.0;net9.0-android35.0</TargetFrameworks>
<Nullable>enable</Nullable>
</PropertyGroup>
<ItemGroup>
<ProjectReference Include="..\..\src\Sentry.Android.AssemblyReader\Sentry.Android.AssemblyReader.csproj" />
<ProjectReference Include="..\Sentry.Testing\Sentry.Testing.csproj" />
</ItemGroup>
<ItemGroup>
<Folder Include="TestAPKs\" />
</ItemGroup>
<!-- Target to ensure AndroidTestApp is restored -->
<Target Name="EnsureAndroidTestAppRestored" Condition="'$(TargetPlatformIdentifier)' != 'android' and '$(AndroidTestAppRestored)' != 'true'">
<!-- Only restore once. Spawn as a separate process to escape any "no-restore" arguments to the build -->
<Exec Command="dotnet restore ../AndroidTestApp/AndroidTestApp.csproj --nologo" />
<PropertyGroup>
<AndroidTestAppRestored>true</AndroidTestAppRestored>
</PropertyGroup>
</Target>
<!-- Build the Android test app in various configurations during the build of this test project. -->
<Target Name="BuildTestAPKs" BeforeTargets="DispatchToInnerBuilds;BeforeBuild" DependsOnTargets="EnsureAndroidTestAppRestored" Condition="'$(TargetPlatformIdentifier)' != 'android'">
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerBuildTestAPKs" Properties="TargetFramework=net8.0-android" Condition="$(TargetFramework) == 'net8.0'" />
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_InnerBuildTestAPKs" Properties="TargetFramework=net9.0-android" Condition="$(TargetFramework) == 'net9.0'" />
</Target>
<Target Name="_InnerBuildTestAPKs">
<!-- https://learn.microsoft.com/visualstudio/msbuild/msbuild-batching -->
<ItemGroup>
<_TestAPK Include="1" Properties="_Aot=False;_Store=False;_Compressed=False" />
<_TestAPK Include="2" Properties="_Aot=False;_Store=False;_Compressed=True" />
<_TestAPK Include="3" Properties="_Aot=False;_Store=True;_Compressed=False" />
<_TestAPK Include="4" Properties="_Aot=False;_Store=True;_Compressed=True" />
<_TestAPK Include="5" Condition="!$(TargetFramework.StartsWith('net8'))" Properties="_Aot=True;_Store=False;_Compressed=False" />
<_TestAPK Include="6" Condition="!$(TargetFramework.StartsWith('net8'))" Properties="_Aot=True;_Store=False;_Compressed=True" />
<_TestAPK Include="7" Condition="!$(TargetFramework.StartsWith('net8'))" Properties="_Aot=True;_Store=True;_Compressed=False" />
<_TestAPK Include="8" Condition="!$(TargetFramework.StartsWith('net8'))" Properties="_Aot=True;_Store=True;_Compressed=True" />
</ItemGroup>
<MSBuild Projects="$(MSBuildProjectFile)" Targets="_BuildTestAPK" Properties="%(_TestAPK.Properties)" BuildInParallel="false" />
</Target>
<Target Name="_BuildTestAPK">
<PropertyGroup>
<_ConfigString>A=$(_Aot)-S=$(_Store)-C=$(_Compressed)</_ConfigString>
<SourceAPK>..\AndroidTestApp\bin\$(TargetFramework)\$(_ConfigString)\com.companyname.AndroidTestApp-Signed.apk</SourceAPK>
<DestinationAPK>TestAPKs\$(TargetFramework)-$(_ConfigString).apk</DestinationAPK>
</PropertyGroup>
<MSBuild Projects="..\AndroidTestApp\AndroidTestApp.csproj" Targets="Build" Properties="Configuration=Release;PublishAot=$(_Aot);_IsPublishing=true;RuntimeIdentifier=android-x64;AndroidUseAssemblyStore=$(_Store);AndroidEnableAssemblyCompression=$(_Compressed);OutDir=bin\$(TargetFramework)\$(_ConfigString)\" Condition="!Exists('$(DestinationAPK)')" />
<Message Text="Copying APK from $(SourceAPK) to $(DestinationAPK)" Importance="high" />
<Copy SourceFiles="$(SourceAPK)" DestinationFiles="$(DestinationAPK)" Condition="!Exists('$(DestinationAPK)')" />
<PropertyGroup>
<DestinationAPKExists Condition="Exists('$(DestinationAPK)')">True</DestinationAPKExists>
<DestinationAPKExists Condition="!Exists('$(DestinationAPK)')">False</DestinationAPKExists>
</PropertyGroup>
<Message Text="APK copy result: Exists('$(DestinationAPK)') = $(DestinationAPKExists)" Importance="high" />
</Target>
</Project>