Skip to content
This repository has been archived by the owner on Jan 23, 2023. It is now read-only.
/ corefx Public archive

Commit

Permalink
Create FreeBSD build-target for corefx and add FreeBSD platform detec…
Browse files Browse the repository at this point in the history
…tion.

This partially adresses
https://github.com/dotnet/corefx/issues/1626
  • Loading branch information
josteink committed Jun 12, 2015
1 parent 211499a commit 37fd399
Show file tree
Hide file tree
Showing 3 changed files with 25 additions and 3 deletions.
4 changes: 3 additions & 1 deletion dir.props
Original file line number Diff line number Diff line change
Expand Up @@ -137,6 +137,7 @@
<OSGroup Condition="'$(OSGroup)'=='' and $(Configuration.StartsWith('Windows'))">Windows_NT</OSGroup>
<OSGroup Condition="'$(OSGroup)'=='' and $(Configuration.StartsWith('Linux'))">Linux</OSGroup>
<OSGroup Condition="'$(OSGroup)'=='' and $(Configuration.StartsWith('OSX'))">OSX</OSGroup>
<OSGroup Condition="'$(OSGroup)'=='' and $(Configuration.StartsWith('FreeBSD'))">FreeBSD</OSGroup>
<OSGroup Condition="'$(OSGroup)'==''">Windows_NT</OSGroup>
</PropertyGroup>

Expand Down Expand Up @@ -189,8 +190,9 @@
<TargetsWindows Condition="'$(OSGroup)' == 'Windows_NT'">true</TargetsWindows>
<TargetsLinux Condition="'$(OSGroup)' == 'Linux'">true</TargetsLinux>
<TargetsOSX Condition="'$(OSGroup)' == 'OSX'">true</TargetsOSX>
<TargetsFreeBSD Condition="'$(OSGroup)' == 'FreeBSD'">true</TargetsFreeBSD>

<TargetsUnix Condition="'$(TargetsLinux)' == 'true' or '$(TargetsOSX)' == 'true'">true</TargetsUnix>
<TargetsUnix Condition="'$(TargetsLinux)' == 'true' or '$(TargetsOSX)' == 'true' or '$(TargetsFreeBSD)' == 'true'">true</TargetsUnix>
</PropertyGroup>

<PropertyGroup>
Expand Down
15 changes: 15 additions & 0 deletions src/System.Runtime.Environment/src/RuntimeInformation.FreeBSD.cs
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
// Copyright (c) Microsoft. All rights reserved.
// Licensed under the MIT license. See LICENSE file in the project root for full license information.

namespace System.Runtime.InteropServices
{
public static class RuntimeInformation
{
private static readonly OSName freebsd = new OSName("FREEBSD");

public static bool IsOperatingSystem(OSName osName)
{
return freebsd == osName;
}
}
}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?xml version="1.0" encoding="utf-8"?>
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="12.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.props))\dir.props" />
<PropertyGroup>
Expand All @@ -17,6 +17,8 @@
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'OSX_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Windows_Release|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Debug|AnyCPU' " />
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'FreeBSD_Release|AnyCPU' " />
<ItemGroup Condition=" '$(TargetsWindows)' == 'true' ">
<Compile Include="RuntimeInformation.Windows.cs" />
</ItemGroup>
Expand All @@ -26,11 +28,14 @@
<ItemGroup Condition=" '$(TargetsOSX)' == 'true' ">
<Compile Include="RuntimeInformation.OSX.cs" />
</ItemGroup>
<ItemGroup Condition=" '$(TargetsFreeBSD)' == 'true' ">
<Compile Include="RuntimeInformation.FreeBSD.cs" />
</ItemGroup>
<ItemGroup>
<None Include="project.json" />
</ItemGroup>
<ItemGroup>
<Compile Include="OSName.cs" />
</ItemGroup>
<Import Project="$([MSBuild]::GetDirectoryNameOfFileAbove($(MSBuildThisFileDirectory), dir.targets))\dir.targets" />
</Project>
</Project>

0 comments on commit 37fd399

Please sign in to comment.