Solve some portability issues with PS Core 6.x on MacOSX#198
Solve some portability issues with PS Core 6.x on MacOSX#198rkeithhill merged 2 commits intopsake:masterfrom
Conversation
|
Ohh ace! Was about to make the changes myself. Although you can get away with a little less change. As well as there's a bunch more aliases contained as detailed by PSScriptAnalyzer. |
| {($_ -eq '4.6') -or ($_ -eq '4.6.1')} { | ||
| $versions = @('v4.0.30319') | ||
| $buildToolsVersions = @('14.0') | ||
| if (!(Get-Variable -Name IsWindows -ErrorAction SilentlyContinue) -or $IsWindows) { |
There was a problem hiding this comment.
I wonder if it wouldn't be better to create some new functions: ConfigureWindowsBuildEnvironment(), ConfigureLinuxBuildEnvironment() and ConfigureMacOSBuildEnvironment().
Then have your if test call the Windows one, then add a test for $IsLinux and call the Linux one (ditto for $IsOSX). For now, those functions could just write-warning that "build environment support for this platform has not been implemented yet.".
|
Last call for comments on this PR. If there are none then I'll merge this PR in a few days. With .NET Core 2.0 on the cusp of being finalized, it is time to get serious about supporting psake cross-platform. |
This should solve #197. The solution I came up with in the end was to simply check for the presence and value of
$IsWindows:This variable should be present in PS Core and set to $True on windows. So if that variable is not present or if it is true we detect frameworks. If not this part is simply ignored.
The rest of the changes are only aliases that I had to replace with their full cmdlet names because they do not exist under MacOSX or Linux.