Skip to content

Commit

Permalink
Let HostModel set the target info
Browse files Browse the repository at this point in the history
  • Loading branch information
am11 committed Jul 14, 2024
1 parent 045d0bc commit d1f012b
Show file tree
Hide file tree
Showing 6 changed files with 15 additions and 48 deletions.
20 changes: 0 additions & 20 deletions src/Installer/core-sdk-tasks/Enumerations/BuildPlatform.cs

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('WINDOWS')) ">win</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('OSX')) ">osx</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('FREEBSD')) ">freebsd</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND $([MSBuild]::IsOSPlatform('ILLUMOS')) ">illumos</HostOSName>
<HostOSName Condition=" '$(HostOSName)' == '' AND '$(IsLinux)' == 'True' ">linux</HostOSName>

<OSName Condition=" '$(OSName)' == '' AND $(Rid) != '' ">$(Rid.Substring(0, $(Rid.LastIndexOf('-'))))</OSName>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
<SkipBuildingInstallers Condition=" '$(SkipBuildingInstallers)' == '' AND
($(Rid.StartsWith('rhel.6'))
OR $(Rid.StartsWith('freebsd'))
OR $(Rid.StartsWith('illumos'))
OR $(Rid.StartsWith('linux-musl'))
OR $(Rid.StartsWith('ubuntu.18.04')))">true</SkipBuildingInstallers>
<SkipBuildingInstallers Condition=" '$(SkipBuildingInstallers)' == '' ">false</SkipBuildingInstallers>
Expand Down
20 changes: 0 additions & 20 deletions src/Layout/toolset-tasks/Enumerations/BuildPlatform.cs

This file was deleted.

10 changes: 3 additions & 7 deletions src/Tasks/Microsoft.NET.Build.Tasks/GenerateBundle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -34,9 +34,6 @@ public class GenerateBundle : TaskBase

protected override void ExecuteCore()
{
OSPlatform targetOS = RuntimeIdentifier.StartsWith("win") ? OSPlatform.Windows :
RuntimeIdentifier.StartsWith("osx") ? OSPlatform.OSX : OSPlatform.Linux;

Architecture targetArch = RuntimeIdentifier.EndsWith("-x64") || RuntimeIdentifier.Contains("-x64-") ? Architecture.X64 :
RuntimeIdentifier.EndsWith("-x86") || RuntimeIdentifier.Contains("-x86-") ? Architecture.X86 :
RuntimeIdentifier.EndsWith("-arm64") || RuntimeIdentifier.Contains("-arm64-") ? Architecture.Arm64 :
Expand All @@ -58,10 +55,9 @@ protected override void ExecuteCore()
AppHostName,
OutputDir,
options,
targetOS,
targetArch,
version,
ShowDiagnosticOutput);
targetArch: targetArch,
targetFrameworkVersion: version,
diagnosticOutput: ShowDiagnosticOutput);

var fileSpec = new List<FileSpec>(FilesToBundle.Length);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ private bool GetCrossgen2TargetOS(out string targetOS)
string portablePlatform = NuGetUtils.GetBestMatchingRid(
runtimeGraph,
_targetPlatform,
new[] { "linux", "linux-musl", "osx", "win", "freebsd" },
new[] { "linux", "linux-musl", "osx", "win", "freebsd", "illumos" },
out _);

// For source-build, allow the bootstrap SDK rid to be unknown to the runtime repo graph.
Expand All @@ -199,6 +199,14 @@ private bool GetCrossgen2TargetOS(out string targetOS)
{
portablePlatform = "linux";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("FREEBSD")))
{
portablePlatform = "freebsd";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.Create("ILLUMOS")))
{
portablePlatform = "illumos";
}
else if (RuntimeInformation.IsOSPlatform(OSPlatform.OSX))
{
portablePlatform = "osx";
Expand All @@ -212,6 +220,7 @@ private bool GetCrossgen2TargetOS(out string targetOS)
"osx" => "osx",
"win" => "windows",
"freebsd" => "freebsd",
"illumos" => "illumos",
_ => null
};

Expand Down

0 comments on commit d1f012b

Please sign in to comment.