Skip to content

Commit

Permalink
[CI] Install the android and iOS dotnet version when they are diff to…
Browse files Browse the repository at this point in the history
… the maui one. (dotnet#13228)

* [CI] Install the android and iOS dotnet version when they are diff to the maui one.

This extra conditional command execution allows to install the donet
versions needed by the android and iOS runtimes. This will allow us to
be able to work around a situation in which there is a mismatch between
the SDKs.

* Get the versions from the sdk props.

* Fix pwsh install, use MicrosoftNETCoreAppRefPackageVersion

---------

Co-authored-by: Peter Collins <[email protected]>
  • Loading branch information
2 people authored and TJ Lambert committed Feb 21, 2023
1 parent 267547d commit 50a2ed8
Showing 1 changed file with 29 additions and 0 deletions.
29 changes: 29 additions & 0 deletions src/DotNet/DotNet.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
<PropertyGroup>
<_ProvisionDependsOn>
_DownloadDotNetInstallScript;
_GetExternalDotNetSdkVersions;
_InstallDotNet;
_AcquireWorkloadManifests;
_InstallWorkloadPacks;
Expand Down Expand Up @@ -94,11 +95,39 @@
/>
</Target>

<!-- if we are building in the unified pipeline we want to install the runtimes from the props of the sdks -->
<Target Name="_GetExternalDotNetSdkVersions">
<XmlPeek
Condition="Exists('$(AndroidSrcPath)\eng\Versions.props')"
XmlInputPath="$(AndroidSrcPath)\eng\Versions.props"
Query="/Project/PropertyGroup/MicrosoftNETCoreAppRefPackageVersion/text()">
<Output TaskParameter="Result" PropertyName="VersionFromAndroid" />
</XmlPeek>
<XmlPeek
Condition="Exists('$(MaciosSrcPath)\eng\Versions.props')"
XmlInputPath="$(MaciosSrcPath)\eng\Versions.props"
Query="/Project/PropertyGroup/MicrosoftNETCoreAppRefPackageVersion/text()">
<Output TaskParameter="Result" PropertyName="VersionFromMacios" />
</XmlPeek>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('windows'))">
<DotNetXARuntimeInstallCommand>&amp; '$(DotNetInstallScriptPath)' -Version $(VersionFromAndroid) -InstallDir '$(DotNetDirectory)' -Verbose -Runtime dotnet</DotNetXARuntimeInstallCommand>
<DotNetXMRuntimeInstallCommand>&amp; '$(DotNetInstallScriptPath)' -Version $(VersionFromMacios) -InstallDir '$(DotNetDirectory)' -Verbose -Runtime dotnet</DotNetXMRuntimeInstallCommand>
<DotNetXARuntimeInstallCommand>powershell -ExecutionPolicy ByPass -NoProfile -Command &quot;$(DotNetXARuntimeInstallCommand)&quot;</DotNetXARuntimeInstallCommand>
<DotNetXMRuntimeInstallCommand>powershell -ExecutionPolicy ByPass -NoProfile -Command &quot;$(DotNetXMRuntimeInstallCommand)&quot;</DotNetXMRuntimeInstallCommand>
</PropertyGroup>
<PropertyGroup Condition="$([MSBuild]::IsOSPlatform('osx'))">
<DotNetXARuntimeInstallCommand>bash '$(DotNetInstallScriptPath)' --version $(VersionFromAndroid) --install-dir '$(DotNetDirectory)' --verbose -Runtime dotnet</DotNetXARuntimeInstallCommand>
<DotNetXMRuntimeInstallCommand>bash '$(DotNetInstallScriptPath)' --version $(VersionFromMacios) --install-dir '$(DotNetDirectory)' --verbose -Runtime dotnet</DotNetXMRuntimeInstallCommand>
</PropertyGroup>
</Target>

<Target Name="_InstallDotNet"
Inputs="$(_Inputs)"
Outputs="$(DotNetDirectory).stamp">
<RemoveDir Directories="$(DotNetDirectory)" />
<Exec Command="$(DotNetInstallCommand)" />
<Exec Condition=" '$(VersionFromAndroid)' != '' " Command="$(DotNetXARuntimeInstallCommand)" />
<Exec Condition=" '$(VersionFromMacios)' != '' " Command="$(DotNetXMRuntimeInstallCommand)" />
<Touch Files="$(DotNetDirectory).stamp" AlwaysCreate="true" />

<!-- This is used by iOS pair to mac because pair to mac can't
Expand Down

0 comments on commit 50a2ed8

Please sign in to comment.