Skip to content

Commit

Permalink
Merge branch 'develop'
Browse files Browse the repository at this point in the history
  • Loading branch information
dustinmoris committed Oct 17, 2018
2 parents 2352b10 + 9499106 commit 2946006
Show file tree
Hide file tree
Showing 17 changed files with 2,191 additions and 1,966 deletions.
66 changes: 53 additions & 13 deletions .psscripts/build-functions.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,20 @@ function Test-IsWindows
[environment]::OSVersion.Platform -ne "Unix"
}

function Get-UbuntuVersion
{
<#
.DESCRIPTION
Gets the Ubuntu version.
.EXAMPLE
$ubuntuVersion = Get-UbuntuVersion
#>

$version = Invoke-Cmd "lsb_release -r -s"
return $version
}

function Invoke-UnsafeCmd ($cmd)
{
<#
Expand Down Expand Up @@ -235,7 +249,10 @@ function Get-NetCoreSdkFromWeb ($version)
The SDK version which should be downloaded.
#>

$os = if (Test-IsWindows) { "windows" } else { "linux" }
Write-Host "Downloading .NET Core SDK $version..."

$os = if (Test-IsWindows) { "windows" } else { "linux" }
$ext = if (Test-IsWindows) { ".zip" } else { ".tar.gz" }

$response = Invoke-WebRequest `
-Uri "https://www.microsoft.com/net/download/thank-you/dotnet-sdk-$version-$os-x64-binaries" `
Expand All @@ -247,13 +264,17 @@ function Get-NetCoreSdkFromWeb ($version)
| Where-Object { $_.onclick -eq "recordManualDownload()" } `
| Select-Object -Expand href

$tempFile = [System.IO.Path]::GetTempFileName()
$tempFile = [System.IO.Path]::GetTempFileName() + $ext

$webClient = New-Object System.Net.WebClient
$webClient.DownloadFile($downloadLink, $tempFile)

Write-Host "Download finished. SDK has been saved to '$tempFile'."

return $tempFile
}

function Install-NetCoreSdk ($sdkZipPath)
function Install-NetCoreSdkFromArchive ($sdkArchivePath)
{
<#
.DESCRIPTION
Expand All @@ -263,13 +284,35 @@ function Install-NetCoreSdk ($sdkZipPath)
The zip archive which contains the .NET Core SDK.
#>

if (Test-IsWindows)
{
$env:DOTNET_INSTALL_DIR = [System.IO.Path]::Combine($pwd, ".dotnetsdk")
New-Item $env:DOTNET_INSTALL_DIR -ItemType Directory -Force | Out-Null
Write-Host "Created folder '$env:DOTNET_INSTALL_DIR'."
Expand-Archive -LiteralPath $sdkArchivePath -DestinationPath $env:DOTNET_INSTALL_DIR -Force
Write-Host "Extracted '$sdkArchivePath' to folder '$env:DOTNET_INSTALL_DIR'."
$env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
Write-Host "Added '$env:DOTNET_INSTALL_DIR' to the environment variables."
}
else
{
$dotnetInstallDir = "$env:HOME/.dotnetsdk"
Invoke-Cmd "mkdir -p $dotnetInstallDir"
Write-Host "Created folder '$dotnetInstallDir'."
Invoke-Cmd "tar -xf $sdkArchivePath -C $dotnetInstallDir"
Write-Host "Extracted '$sdkArchivePath' to folder '$dotnetInstallDir'."
$env:PATH = "$env:PATH:$dotnetInstallDir"
Write-Host "Added '$dotnetInstallDir' to the environment variables."
}
}

$env:DOTNET_INSTALL_DIR = "$pwd\.dotnetsdk"
New-Item $env:DOTNET_INSTALL_DIR -ItemType Directory -Force

Add-Type -AssemblyName System.IO.Compression.FileSystem;
[System.IO.Compression.ZipFile]::ExtractToDirectory($sdkZipPath, $env:DOTNET_INSTALL_DIR)
$env:Path = "$env:DOTNET_INSTALL_DIR;$env:Path"
function Install-NetCoreSdkForUbuntu ($ubuntuVersion, $sdkVersion)
{
Invoke-Cmd "wget -q https://packages.microsoft.com/config/ubuntu/$ubuntuVersion/packages-microsoft-prod.deb"
Invoke-Cmd "sudo dpkg -i packages-microsoft-prod.deb"
Invoke-Cmd "sudo apt-get install apt-transport-https"
Invoke-Cmd "sudo apt-get update"
Invoke-Cmd "sudo apt-get -y install dotnet-sdk-$sdkVersion"
}

# ----------------------------------------------
Expand All @@ -280,14 +323,11 @@ function Test-IsAppVeyorBuild { return ($env:APPVEYOR -eq $true
function Test-IsAppVeyorBuildTriggeredByGitTag { return ($env:APPVEYOR_REPO_TAG -eq $true) }
function Get-AppVeyorGitTag { return $env:APPVEYOR_REPO_TAG_NAME }

function Update-AppVeyorBuildVersion ($projFile)
function Update-AppVeyorBuildVersion ($version)
{
if (Test-IsAppVeyorBuild)
{
Write-Host "Updating AppVeyor build version..." -ForegroundColor Magenta

[xml]$xml = Get-Content $projFile
$version = $xml.Project.PropertyGroup.Version
$buildVersion = "$version-$env:APPVEYOR_BUILD_NUMBER"
Write-Host "Setting AppVeyor build version to $buildVersion."
Update-AppveyorBuild -Version $buildVersion
Expand Down
20 changes: 19 additions & 1 deletion .psscripts/install-dotnet.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,27 @@
# Install .NET Core SDK
# ----------------------------------------------

param
(
[switch] $ForceUbuntuInstall
)

$ErrorActionPreference = "Stop"

Import-module "$PSScriptRoot\build-functions.ps1" -Force

if ($ForceUbuntuInstall.IsPresent)
{
$desiredSdk = Get-DesiredSdk
$versionParts = $desiredSdk.Split(".")
$majorMinorVer = $versionParts[0] + "." + $versionParts[1]
$ubuntuVersion = Get-UbuntuVersion

Write-Host "Ubuntu version: $ubuntuVersion"
Install-NetCoreSdkForUbuntu $ubuntuVersion $majorMinorVer
return
}

# Rename the global.json before making the dotnet --version call
# This will prevent AppVeyor to fail because it might not find
# the desired SDK specified in the global.json
Expand All @@ -27,10 +44,11 @@ if ($desiredSdk -eq $currentSdk)
}

Write-Host "The current .NET SDK ($currentSdk) doesn't match the project's desired .NET SDK ($desiredSdk)." -ForegroundColor Yellow

Write-Host "Attempting to download and install the correct .NET SDK..."

$sdkZipPath = Get-NetCoreSdkFromWeb $desiredSdk
Install-NetCoreSdk $sdkZipPath
Install-NetCoreSdkFromArchive $sdkZipPath

Write-Host ".NET SDK installation complete." -ForegroundColor Green
dotnet-version
2 changes: 1 addition & 1 deletion .psscripts/nuget-updates.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ Write-Host " Scanning all projects for NuGet package upgrades "
Write-Host "--------------------------------------------------"
Write-Host ""

$projects = Get-ChildItem "..\**\*.*proj" -Recurse | % { $_.FullName }
$projects = Get-ChildItem "$PSScriptRoot\..\**\*.*proj" -Recurse | % { $_.FullName }

foreach ($project in $projects)
{
Expand Down
6 changes: 6 additions & 0 deletions RELEASE_NOTES.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
Release Notes
=============

## 0.19.0

- Updated Giraffe to version 3.2.x
- Updated Giraffe.Razor to version 2.0.x
- Added TaskBuilder.fs as dependency to all templates

## 0.18.0

- Updated all templates to latest Giraffe version
Expand Down
7 changes: 3 additions & 4 deletions build.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -21,14 +21,14 @@ Import-module "$PSScriptRoot/.psscripts/build-functions.ps1" -Force
Write-BuildHeader "Starting giraffe-template build script"

$nuspec = "./src/giraffe-template.nuspec"
$version = Get-NuspecVersion $nuspec

Update-AppVeyorBuildVersion $nuspec
Update-AppVeyorBuildVersion $version

if (Test-IsAppVeyorBuildTriggeredByGitTag)
{
$gitTag = Get-AppVeyorGitTag
$nuspecVersion = Get-NuspecVersion $nuspec
Test-CompareVersions $nuspecVersion $gitTag
Test-CompareVersions $version $gitTag
}

Write-DotnetCoreVersions
Expand Down Expand Up @@ -91,7 +91,6 @@ if ($UpdatePaketDependencies.IsPresent -or $TestPermutations.IsPresent -or $Crea
$giraffeInstallation
if ($giraffeInstallation.Length -lt 6) { Invoke-Cmd "dotnet new -u giraffe-template" }

$version = Get-NuspecVersion $nuspec
$nupkg = Get-ChildItem "./giraffe-template.$version.nupkg"
$nupkgPath = $nupkg.FullName

Expand Down
2 changes: 1 addition & 1 deletion global.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"projects": [ "src", "tests" ],
"sdk": {
"version": "2.1.401"
"version": "2.1.403"
}
}
Loading

0 comments on commit 2946006

Please sign in to comment.