dotnet-installer/build/BuildInfo.targets
Justin Goshi 45a1e9e56c Allow host info passed in from the command line to override machine settings (#5904)
* Allow host info passed in from the command line to override machine settings

* Simplify the logic

* Address PR comments to keep a separate HostRid and HostOSName that are static

* Rename to BuildInfo.props

* Address PR comments

* Fix the previous merge

* Fix spacing

* Address PR comments
2017-03-08 09:10:53 -10:00

39 lines
1.6 KiB
XML

<Project ToolsVersion="15.0">
<Target Name="WriteBuildInfoProps"
DependsOnTargets="BuildDotnetCliBuildFramework">
<GetCurrentRuntimeInformation>
<Output TaskParameter="Rid" PropertyName="HostRid" />
<Output TaskParameter="OSName" PropertyName="HostOSName" />
</GetCurrentRuntimeInformation>
<PropertyGroup>
<Rid Condition=" '$(Rid)' == '' ">$(HostRid)</Rid>
<Architecture Condition=" '$(Architecture)' == '' ">x64</Architecture>
<OSName Condition=" '$(OSName)' == '' ">$(HostOSName)</OSName>
<BuildInfoPropsContent>
&lt;Project ToolsVersion=&quot;15.0&quot;&gt;
&lt;PropertyGroup&gt;
&lt;Rid&gt;$(Rid)&lt;/Rid&gt;
&lt;Architecture&gt;$(Architecture)&lt;/Architecture&gt;
&lt;OSName&gt;$(OSName)&lt;/OSName&gt;
&lt;/PropertyGroup&gt;
&lt;/Project&gt;
</BuildInfoPropsContent>
<ExistingBuildInfoPropsContent Condition=" Exists('$(BuildInfoProps)') ">
$([System.IO.File]::ReadAllText($(BuildInfoProps)))
</ExistingBuildInfoPropsContent>
<ShouldOverwriteBuildInfoPropsFile>false</ShouldOverwriteBuildInfoPropsFile>
<ShouldOverwriteBuildInfoPropsFile
Condition=" '$(ExistingBuildInfoPropsContent.Trim())' != '$(BuildInfoPropsContent.Trim())' ">true</ShouldOverwriteBuildInfoPropsFile>
</PropertyGroup>
<WriteLinesToFile File="$(BuildInfoProps)"
Lines="$(BuildInfoPropsContent)"
Condition=" '$(ShouldOverwriteBuildInfoPropsFile)' == 'true' "
Overwrite="true" />
</Target>
</Project>