Skip to content

Commit db4ad9d

Browse files
authored
Set targetOS properly for HostModel (#42144)
1 parent 658288f commit db4ad9d

File tree

6 files changed

+16
-42
lines changed

6 files changed

+16
-42
lines changed

src/Installer/core-sdk-tasks/Enumerations/BuildPlatform.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Installer/redist-installer/targets/GetRuntimeInformation.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('WINDOWS')) ">win</HostOSName>
1212
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('OSX')) ">osx</HostOSName>
1313
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('FREEBSD')) ">freebsd</HostOSName>
14+
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('ILLUMOS')) ">illumos</HostOSName>
1415
<HostOSName Condition=" '$(HostOSName)' == '' AND '$(IsLinux)' == 'True' ">linux</HostOSName>
1516

1617
<OSName Condition=" '$(OSName)' == '' AND $(Rid) != '' ">$(Rid.Substring(0, $(Rid.LastIndexOf('-'))))</OSName>

src/Installer/redist-installer/targets/SetBuildDefaults.targets

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -7,6 +7,7 @@
77
<SkipBuildingInstallers Condition=" '$(SkipBuildingInstallers)' == '' AND
88
($(Rid.StartsWith('rhel.6'))
99
OR $(Rid.StartsWith('freebsd'))
10+
OR $(Rid.StartsWith('illumos'))
1011
OR $(Rid.StartsWith('linux-musl'))
1112
OR $(Rid.StartsWith('ubuntu.18.04')))">true</SkipBuildingInstallers>
1213
<SkipBuildingInstallers Condition=" '$(SkipBuildingInstallers)' == '' ">false</SkipBuildingInstallers>

src/Layout/toolset-tasks/Enumerations/BuildPlatform.cs

Lines changed: 0 additions & 20 deletions
This file was deleted.

src/Tasks/Microsoft.NET.Build.Tasks/GenerateBundle.cs

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,10 @@ public class GenerateBundle : TaskBase
3535
protected override void ExecuteCore()
3636
{
3737
OSPlatform targetOS = RuntimeIdentifier.StartsWith("win") ? OSPlatform.Windows :
38-
RuntimeIdentifier.StartsWith("osx") ? OSPlatform.OSX : OSPlatform.Linux;
38+
RuntimeIdentifier.StartsWith("osx") ? OSPlatform.OSX :
39+
RuntimeIdentifier.StartsWith("freebsd") ? OSPlatform.Create("FREEBSD") :
40+
RuntimeIdentifier.StartsWith("illumos") ? OSPlatform.Create("ILLUMOS") :
41+
OSPlatform.Linux;
3942

4043
Architecture targetArch = RuntimeIdentifier.EndsWith("-x64") || RuntimeIdentifier.Contains("-x64-") ? Architecture.X64 :
4144
RuntimeIdentifier.EndsWith("-x86") || RuntimeIdentifier.Contains("-x86-") ? Architecture.X86 :

src/Tasks/Microsoft.NET.Build.Tasks/ResolveReadyToRunCompilers.cs

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -185,7 +185,7 @@ private bool GetCrossgen2TargetOS(out string targetOS)
185185
string portablePlatform = NuGetUtils.GetBestMatchingRid(
186186
runtimeGraph,
187187
_targetPlatform,
188-
new[] { "linux", "linux-musl", "osx", "win", "freebsd" },
188+
new[] { "linux", "linux-musl", "osx", "win", "freebsd", "illumos" },
189189
out _);
190190

191191
// For source-build, allow the bootstrap SDK rid to be unknown to the runtime repo graph.
@@ -199,6 +199,14 @@ private bool GetCrossgen2TargetOS(out string targetOS)
199199
{
200200
portablePlatform = "linux";
201201
}
202+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")))
203+
{
204+
portablePlatform = "freebsd";
205+
}
206+
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")))
207+
{
208+
portablePlatform = "illumos";
209+
}
202210
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
203211
{
204212
portablePlatform = "osx";
@@ -212,6 +220,7 @@ private bool GetCrossgen2TargetOS(out string targetOS)
212220
"osx" => "osx",
213221
"win" => "windows",
214222
"freebsd" => "freebsd",
223+
"illumos" => "illumos",
215224
_ => null
216225
};
217226

0 commit comments

Comments
 (0)