-
-
Notifications
You must be signed in to change notification settings - Fork 404
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'devlead-feature/packageicon' into develop
- Loading branch information
Showing
8 changed files
with
179 additions
and
95 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,3 @@ | ||
#!/usr/bin/env bash | ||
CAKE_VERSION=0.34.1 | ||
DOTNET_VERSION=3.0.100-rc1-014190 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,120 +1,154 @@ | ||
$CakeVersion = "0.25.0" | ||
$DotNetChannel = "LTS"; | ||
$DotNetVersion = "2.1.4"; | ||
$IsRunningOnUnix = [System.Environment]::OSVersion.Platform -eq [System.PlatformID]::Unix | ||
#!/usr/bin/env pwsh | ||
$DotNetInstallerUri = 'https://dot.net/v1/dotnet-install.ps1'; | ||
$DotNetUnixInstallerUri = 'https://dot.net/v1/dotnet-install.sh' | ||
$DotNetChannel = 'LTS' | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
|
||
[string] $CakeVersion = '' | ||
[string] $DotNetVersion= '' | ||
foreach($line in Get-Content (Join-Path $PSScriptRoot 'build.config')) | ||
{ | ||
if ($line -like 'CAKE_VERSION=*') { | ||
$CakeVersion = $line.SubString(13) | ||
} | ||
elseif ($line -like 'DOTNET_VERSION=*') { | ||
$DotNetVersion =$line.SubString(15) | ||
} | ||
} | ||
|
||
|
||
if ([string]::IsNullOrEmpty($CakeVersion) -or [string]::IsNullOrEmpty($DotNetVersion)) { | ||
'Failed to parse Cake / .NET Core SDK Version' | ||
exit 1 | ||
} | ||
|
||
# Make sure tools folder exists | ||
$PSScriptRoot = Split-Path $MyInvocation.MyCommand.Path -Parent | ||
$ToolPath = Join-Path $PSScriptRoot "tools" | ||
if (!(Test-Path $ToolPath)) { | ||
Write-Verbose "Creating tools directory..." | ||
New-Item -Path $ToolPath -Type directory | out-null | ||
New-Item -Path $ToolPath -Type Directory -Force | out-null | ||
} | ||
|
||
|
||
if ($PSVersionTable.PSEdition -ne 'Core') { | ||
# Attempt to set highest encryption available for SecurityProtocol. | ||
# PowerShell will not set this by default (until maybe .NET 4.6.x). This | ||
# will typically produce a message for PowerShell v2 (just an info | ||
# message though) | ||
try { | ||
# Set TLS 1.2 (3072), then TLS 1.1 (768), then TLS 1.0 (192), finally SSL 3.0 (48) | ||
# Use integers because the enumeration values for TLS 1.2 and TLS 1.1 won't | ||
# exist in .NET 4.0, even though they are addressable if .NET 4.5+ is | ||
# installed (.NET 4.5 is an in-place upgrade). | ||
[System.Net.ServicePointManager]::SecurityProtocol = 3072 -bor 768 -bor 192 -bor 48 | ||
} catch { | ||
Write-Output 'Unable to set PowerShell to use TLS 1.2 and TLS 1.1 due to old .NET Framework installed. If you see underlying connection closed or trust errors, you may need to upgrade to .NET Framework 4.5+ and PowerShell v3' | ||
} | ||
} | ||
|
||
########################################################################### | ||
# INSTALL .NET CORE CLI | ||
########################################################################### | ||
|
||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 | ||
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
$env:DOTNET_ROLL_FORWARD_ON_NO_CANDIDATE_FX=1 | ||
|
||
|
||
Function Remove-PathVariable([string]$VariableToRemove) | ||
{ | ||
$SplitChar = ';' | ||
if ($IsMacOS -or $IsLinux) { | ||
$SplitChar = ':' | ||
} | ||
|
||
$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($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } | ||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $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($SplitChar, [StringSplitOptions]::RemoveEmptyEntries) | Where-Object { "$($_)" -inotlike $VariableToRemove } | ||
[Environment]::SetEnvironmentVariable("PATH", [System.String]::Join($SplitChar, $newItems), "Process") | ||
} | ||
} | ||
|
||
# Get .NET Core CLI path if installed. | ||
$env:DOTNET_SKIP_FIRST_TIME_EXPERIENCE=1 | ||
$env:DOTNET_CLI_TELEMETRY_OPTOUT=1 | ||
$FoundDotNetCliVersion = $null | ||
|
||
|
||
$FoundDotNetCliVersion = $null; | ||
if (Get-Command dotnet -ErrorAction SilentlyContinue) { | ||
$FoundDotNetCliVersion = dotnet --version | ||
$FoundDotNetCliVersion = dotnet --version; | ||
} | ||
|
||
if($FoundDotNetCliVersion -ne $DotNetVersion) | ||
{ | ||
if($FoundDotNetCliVersion -ne $DotNetVersion) { | ||
$InstallPath = Join-Path $PSScriptRoot ".dotnet" | ||
Remove-PathVariable "$InstallPath" | ||
$env:PATH = "$InstallPath;$env:PATH" | ||
|
||
if (!(Test-Path $InstallPath)) { | ||
New-Item -ItemType Directory -Force $InstallPath | Out-Null; | ||
New-Item -Path $InstallPath -ItemType Directory -Force | Out-Null; | ||
} | ||
|
||
[string] $InstalledDotNetVersion = Get-ChildItem -Path ./.dotnet -File ` | ||
| Where-Object { $_.Name -eq 'dotnet' -or $_.Name -eq 'dotnet.exe' } ` | ||
| ForEach-Object { &$_.FullName --version } | ||
if ($IsMacOS -or $IsLinux) { | ||
$ScriptPath = Join-Path $InstallPath 'dotnet-install.sh' | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetUnixInstallerUri, $ScriptPath); | ||
& bash $ScriptPath --version "$DotNetVersion" --install-dir "$InstallPath" --channel "$DotNetChannel" --no-path | ||
|
||
if ($InstalledDotNetVersion -eq $DotNetVersion) | ||
{ | ||
} | ||
elseif ($IsRunningOnUnix) | ||
{ | ||
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.sh"; | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath/dotnet-install.sh"); | ||
sudo bash "$InstallPath/dotnet-install.sh" --version $DotNetVersion --install-dir "$InstallPath" --no-path | ||
Remove-PathVariable "$InstallPath" | ||
$env:PATH = "$($InstallPath):$env:PATH" | ||
} | ||
else | ||
{ | ||
$DotNetInstallerUri = "https://raw.githubusercontent.com/dotnet/cli/v2.1.4/scripts/obtain/dotnet-install.ps1"; | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, "$InstallPath\dotnet-install.ps1"); | ||
& $InstallPath\dotnet-install.ps1 -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; | ||
else { | ||
$ScriptPath = Join-Path $InstallPath 'dotnet-install.ps1' | ||
(New-Object System.Net.WebClient).DownloadFile($DotNetInstallerUri, $ScriptPath); | ||
& $ScriptPath -Channel $DotNetChannel -Version $DotNetVersion -InstallDir $InstallPath; | ||
|
||
Remove-PathVariable "$InstallPath" | ||
$env:PATH = "$InstallPath;$env:PATH" | ||
} | ||
$env:DOTNET_ROOT=$InstallPath | ||
} | ||
|
||
########################################################################### | ||
# INSTALL CAKE | ||
########################################################################### | ||
|
||
Add-Type -AssemblyName System.IO.Compression.FileSystem | ||
Function Unzip | ||
{ | ||
param([string]$zipfile, [string]$outpath) | ||
# Make sure Cake has been installed. | ||
[string] $CakeExePath = '' | ||
[string] $CakeInstalledVersion = Get-Command dotnet-cake -ErrorAction SilentlyContinue | % {&$_.Source --version} | ||
|
||
[System.IO.Compression.ZipFile]::ExtractToDirectory($zipfile, $outpath) | ||
if ($CakeInstalledVersion -eq $CakeVersion) { | ||
# Cake found locally | ||
$CakeExePath = (Get-Command dotnet-cake).Source | ||
} | ||
else { | ||
$CakePath = [System.IO.Path]::Combine($ToolPath,'.store', 'cake.tool', $CakeVersion) # Old PowerShell versions Join-Path only supports one child path | ||
|
||
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) | ||
|
||
# Make sure Cake has been installed. | ||
$CakePath = Join-Path $ToolPath "Cake.$CakeVersion" | ||
$CakeExePath = Join-Path $CakePath "Cake.exe" | ||
$CakeZipPath = Join-Path $ToolPath "Cake.zip" | ||
if (!(Test-Path $CakeExePath)) { | ||
Write-Host "Installing Cake $CakeVersion..." | ||
(New-Object System.Net.WebClient).DownloadFile("https://www.nuget.org/api/v2/package/Cake/$CakeVersion", $CakeZipPath) | ||
Unzip $CakeZipPath $CakePath | ||
Remove-Item $CakeZipPath | ||
|
||
if ((!(Test-Path -Path $CakePath -PathType Container)) -or (!(Test-Path $CakeExePath -PathType Leaf))) { | ||
|
||
if ((![string]::IsNullOrEmpty($CakeExePath)) -and (Test-Path $CakeExePath -PathType Leaf)) | ||
{ | ||
& dotnet tool uninstall --tool-path $ToolPath Cake.Tool | ||
} | ||
|
||
& dotnet tool install --tool-path $ToolPath --version $CakeVersion Cake.Tool | ||
if ($LASTEXITCODE -ne 0) | ||
{ | ||
'Failed to install cake' | ||
exit 1 | ||
} | ||
$CakeExePath = (Get-ChildItem -Path $ToolPath -Filter "dotnet-cake*" -File| ForEach-Object FullName | Select-Object -First 1) | ||
} | ||
} | ||
|
||
########################################################################### | ||
# RUN BUILD SCRIPT | ||
########################################################################### | ||
if ($IsRunningOnUnix) | ||
& "$CakeExePath" ./build.cake --bootstrap | ||
if ($LASTEXITCODE -eq 0) | ||
{ | ||
& mono "$CakeExePath" --bootstrap | ||
if ($LASTEXITCODE -eq 0) | ||
{ | ||
& mono "$CakeExePath" $args | ||
} | ||
exit $LASTEXITCODE | ||
& "$CakeExePath" ./build.cake $args | ||
} | ||
else | ||
{ | ||
& "$CakeExePath" --bootstrap | ||
if ($LASTEXITCODE -eq 0) | ||
{ | ||
& "$CakeExePath" $args | ||
} | ||
exit $LASTEXITCODE | ||
} | ||
exit $LASTEXITCODE |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
{ | ||
"projects": [ | ||
"src" | ||
], | ||
"sdk": { | ||
"version": "3.0.100-rc1-014190" | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.