Skip to content

Commit

Permalink
cross platform build fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
kll authored and arturcic committed Nov 14, 2018
1 parent 3bbfa11 commit 80b4f69
Show file tree
Hide file tree
Showing 2 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion build.cake
Original file line number Diff line number Diff line change
Expand Up @@ -179,7 +179,7 @@ Task("Test")
};
if(IsRunningOnUnix()) {
nunitSettings.Where = "cat != NoMono";
nunitSettings.Where = "cat!=NoMono";
nunitSettings.Agents = 1;
}
Expand Down
18 changes: 11 additions & 7 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,8 @@ $DotNetVersion = (Get-Content ./src/global.json | ConvertFrom-Json).sdk.version;

$NugetUrl = "https://dist.nuget.org/win-x86-commandline/latest/nuget.exe"

$PathSplitter = if ($IsWindows) { ';' } else { ':' }

# SSL FIX
[System.Net.ServicePointManager]::SecurityProtocol = [System.Net.SecurityProtocolType]::Tls12;

Expand All @@ -74,14 +76,14 @@ if (!(Test-Path $ToolPath)) {
function Remove-PathVariable([string]$VariableToRemove) {
$path = [Environment]::GetEnvironmentVariable("PATH", "User")
if ($path -ne $null) {
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "User")
$newItems = $path.Split($PathSplitter, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($PathSplitter, $newItems), "User")
}

$path = [Environment]::GetEnvironmentVariable("PATH", "Process")
if ($path -ne $null) {
$newItems = $path.Split(';', [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join(';', $newItems), "Process")
$newItems = $path.Split($PathSplitter, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove }
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($PathSplitter, $newItems), "Process")
}
}

Expand All @@ -108,10 +110,12 @@ if($FoundDotNetCliVersion -ne $DotNetVersion) {
$Cmd = "$InstallPath/$DotNetInstaller -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath -NoPath"
if (!$IsWindows) { $Cmd = "bash $Cmd" }
Invoke-Expression "& $Cmd"

Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath;$env:PATH"
}

# Ensure the installed .NET Core CLI is always used but putting it on the front of the path.
Remove-PathVariable "$InstallPath"
$env:PATH = "$InstallPath$PathSplitter$env:PATH"
$env:DOTNET_ROOT="$InstallPath"
}

# Temporarily skip verification of addins.
Expand Down

0 comments on commit 80b4f69

Please sign in to comment.