Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -17,16 +17,21 @@
</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 -->
<Target Name="EnsureAndroidTestAppRestored"
Condition="!Exists('$(MSBuildProjectDirectory)\..\AndroidTestApp\obj\project.assets.json')">
<Message Importance="high" Text="Restoring AndroidTestApp via MSBuild task..." />
<Exec Command="dotnet restore ../AndroidTestApp/AndroidTestApp.csproj --nologo" />
<PropertyGroup>
<AndroidTestAppRestored>true</AndroidTestAppRestored>
</PropertyGroup>
</Target>

<!-- Restore exactly once: https://learn.microsoft.com/en-gb/visualstudio/msbuild/run-target-exactly-once -->
<Target Name="BuildTestAPKsBeforeOuterBuild" DependsOnTargets="EnsureAndroidTestAppRestored"
Condition="'$(TargetPlatformIdentifier)' != 'android'"
BeforeTargets="DispatchToInnerBuilds" />

<!-- 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'">
<Target Name="BuildTestAPKs" BeforeTargets="BeforeBuild" Condition="'$(TargetPlatformIdentifier)' != 'android'">
<!-- Restore exactly once: https://learn.microsoft.com/en-gb/visualstudio/msbuild/run-target-exactly-once -->
<MSBuild Projects="$(MSBuildProjectFullPath)" Targets="EnsureAndroidTestAppRestored" RemoveProperties="TargetFramework" />
<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>
Expand Down
Loading