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

Enable building all of corefx with an "unknown" Unix #4402

Merged
merged 2 commits into from
Nov 8, 2015

Conversation

stephentoub
Copy link
Member

After all of the shim work that's been done, the vast majority of corefx assemblies now are either platform-agnostic or have a Windows build and a Unix build, without further specialization based on OS in managed code. We do still have a few such assemblies, though (and this is unlikely to change any time soon):

  • System.Diagnostics.Process
  • System.IO.FileSystem.Watcher
  • System.Net.NetworkInformation
  • System.Runtime.InteropServices.RuntimeInformation

As a result, attempting to do a full build for Unix targets other than Linux or OS X currently results in compilation failures. This commit adds a new TargetsUnknownUnix property to the build as well as stub implementations that throw PlatformNotSupportedException for all of the missing functionality that causes such compilation errors.

With this change, doing build.cmd /p:SkipTests=true /p:OSGroup=FreeBSD" now completes successfully, as does build.cmd /p:SkipTests=true /p:OSGroup=Stephenix.

cc: @ellismg, @nguerrera, @weshaggard, @mellinoe

After all of the shim work that's been done, the vast majority of corefx assemblies now are either platform-agnostic or have a Windows build and a Unix build, without further specialization based on OS in managed code.  We do still have a few such assemblies, though (and this is unlikely to change any time soon):
- System.Diagnostics.Process
- System.IO.FileSystem.Watcher
- System.Net.NetworkInformation
- System.Runtime.InteropServices.RuntimeInformation

As a result, attempting to do a full build for Unix targets other than Linux or OS X currently results in compilation failures. This commit adds a new TargetsUnknownUnix property to the build as well as stub implementations that throw PlatformNotSupportedException for all of the missing functionality that causes such compilation errors.

With this change, doing ```build.cmd /p:SkipTests=true /p:OSGroup=FreeBSD" now completes successfully, as does ```build.cmd /p:SkipTests=true /p:OSGroup=Stephenix```.
<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' or '$(TargetsFreeBSD)' == 'true'">true</TargetsUnix>
<TargetsUnknownUnix Condition="'$(TargetsUnix)' == 'true' AND '$(OSGroup)' != 'FreeBSD' AND '$(OSGroup)' != 'Linux' AND '$(OSGroup)' != 'OSX'">true</TargetsUnknownUnix>
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nit: indentation looks off.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks, will fix.

@nguerrera
Copy link
Contributor

LGTM.

When can I get a Stephenix drop to try this out? 😃

@stephentoub
Copy link
Member Author

When can I get a Stephenix drop to try this out?

😄

@ghost
Copy link

ghost commented Nov 7, 2015

Thank you @stephentoub. I am in contact with people on FreeBSD IRC channel to seek help with FileSystem stuff. Once I get somewhere, I will send a PR. :)
+1 for "stephenix" drop 😄

@ghost
Copy link

ghost commented Nov 7, 2015

Just to be sure; at the moment (aside from making sure all the required shims are available) we have eight .cs files to cover in order to bring any platform support? For instance, if someone wants to bring new platform support to CoreFX, say NetBSD, they would make sure that Native shim compile on that platform and then provide the counterparts for these eight .cs files to get on a par with OSX/Linux support. CMIIW please.

@mellinoe
Copy link
Contributor

mellinoe commented Nov 8, 2015

NetworkInformation stuff looks good to me. FWIW I think a lot of the OSX implementation can eventually be shared for BSD platforms, but it will require some more refactoring, and most importantly someone who is familiar with those 😄

stephentoub added a commit that referenced this pull request Nov 8, 2015
Enable building all of corefx with an "unknown" Unix
@stephentoub stephentoub merged commit e678832 into dotnet:master Nov 8, 2015
@weshaggard
Copy link
Member

LGTM. At first glance I couldn't figure out what causes TargetsUnix=true in your case of OSGroup=Stephenix? Is that because you actually build on a flavor of unix?

@stephentoub
Copy link
Member Author

Thanks, Wes.

At first glance I couldn't figure out what causes TargetsUnix=true in your case of OSGroup=Stephenix

I changed it to say that it TargetsUnix if it doesn't TargetsWindows:
https://github.com/dotnet/corefx/pull/4402/files#diff-0b192804a6349e8c26d2b027afbd89a2R252

@stephentoub stephentoub deleted the unknown_unix_build branch November 14, 2015 19:26
@karelz karelz modified the milestone: 1.0.0-rtm Dec 3, 2016
picenka21 pushed a commit to picenka21/runtime that referenced this pull request Feb 18, 2022
…uild

Enable building all of corefx with an "unknown" Unix

Commit migrated from dotnet/corefx@e678832
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants